Computer ScienceChapter 4: Data and Analysis
4.1.9 Choose an appropriate machine learning model
Choosing an appropriate machine learning model
Explanation level
Introduction
As we learned different models, how will we decide which machine learning model to use for a certain problem? First, we will define our problem — what output or solution we want. Do we want to identify some items, classify the given items, or forecast some future value? The next step is to analyze the given data.
Definition
Choosing an appropriate machine learning model is the process of selecting the right learning approach (supervised, unsupervised, or reinforcement) based on the nature of the problem and the type of data available.
Main Idea
The choice of machine learning model depends on:
- The problem type: What do we want to achieve?
- The data type: Is the data labeled or unlabeled?
- The goal: Do we want to classify, predict, or discover patterns?
Core Concept
The decision process can be summarized as:
- If the given data has labels or questions/answers information, then we can use supervised learning model.
- If we don't have apparent labels and data have various groups which may have some similarities and some differences, we can apply unsupervised learning model.
- If in the given data, you identify some agent must achieve some goal, then you will apply reinforcement learning model.
Detailed Explanation
Step 1: Define the Problem
Ask yourself:
- Do I want to identify items? (Classification)
- Do I want to classify given items? (Classification)
- Do I want to forecast some future value? (Regression)
- Do I want to group similar items? (Clustering)
- Do I want an agent to learn a task? (Reinforcement)
Step 2: Analyze the Data
Ask yourself:
- Is the data labeled (with correct answers)? → Supervised
- Is the data unlabeled (no answers)? → Unsupervised
- Is there an agent interacting with an environment? → Reinforcement
Step 3: Select the Model
| Situation | Model to Use |
|---|---|
| Data has labels (questions with answers) | Supervised Learning |
| Data has no labels, but has groups with similarities/differences | Unsupervised Learning |
| There is an agent that must achieve a goal | Reinforcement Learning |
Machine Learning Process Steps
Following is the brief description of Machine Learning Model:
Step 1: The preprocessed, cleaned data is split into Training data and Testing data. Sometimes we divide it into three parts and keep a small amount of data to validate the final results.
Step 2: A suitable algorithm is selected to train the machine. There are several algorithms like neural network, decision tree, etc.
Step 3: The model is trained on the training set. It learns the pattern from data and develops a decision-making ability.
Step 4: After the model is trained, test data and validation data are provided to the model and results are compared with actual values. The performance of the model can be improved by changing or improving the algorithm or by adjusting other necessary parameters.
Intermediate Level
At the intermediate level, you should understand the decision tree for choosing a model.
Decision Tree:
- Yes → Supervised Learning
- No → Go to step 2
- Yes → Reinforcement Learning
- No → Unsupervised Learning
Examples:
| Problem | Data | Model |
|---|---|---|
| Predict house prices | Labeled (price known) | Supervised (Regression) |
| Classify emails as spam/not spam | Labeled (spam/not spam) | Supervised (Classification) |
| Group customers by behavior | Unlabeled | Unsupervised (Clustering) |
| Train a robot to navigate a maze | Agent + environment | Reinforcement |
| Detect fraudulent transactions | Labeled (fraud/not fraud) | Supervised (Classification) |
| Find similar news articles | Unlabeled | Unsupervised (Clustering) |
Important Points
- - Choose the model based on the problem and data.
- - Labeled data → Supervised.
- - Unlabeled data → Unsupervised.
- - Agent + environment → Reinforcement.
- - ML process: split data, select algorithm, train, test, validate.
- - Consider data size, quality, interpretability, and resources.
Remember
- - Labeled data → Supervised.
- - Unlabeled data → Unsupervised.
- - Agent + goal → Reinforcement.
- - Define problem first.
- - Analyze data second.
- - Select model third.
- - Process: split, select, train, test, validate.
Common Mistakes
- - Choosing a model without understanding the problem.
- - Using supervised learning when data is unlabeled.
- - Using unsupervised learning when labels are available.
- - Forgetting to split data into training and testing sets.
- - Not validating the model on unseen data.
- - Choosing a complex model when a simple one would work.
- - Ignoring data quality and preprocessing.
- - Assuming that one model works for all problems.
Quick Revision
- Choosing a model depends on the problem and data.
- Labeled data → Supervised learning.
- Unlabeled data → Unsupervised learning.
- Agent + environment → Reinforcement learning.
- ML process: split data, select algorithm, train, test, validate.
- Consider data size, quality, interpretability, resources.
- Examples: house prices (supervised), customer groups (unsupervised), robot navigation (reinforcement).
60-Second Revision
- Labeled → Supervised.
- Unlabeled → Unsupervised.
- Agent + goal → Reinforcement.
- Define problem → Analyze data → Select model.
- Process: split, select, train, test, validate.
- Warning: Don't choose a model without understanding the problem and data first.
Did you understand this topic?
Your answer is saved with your learning record. It does not mark the topic as mastered.
Quick revision
Revision Zone
Review the key facts, formulas and checks before you move on.4.1.9 Choose an appropriate machine learning model
Sticky Notes · Quick Revision
Key Point 1
- Labeled → Supervised.
Key Point 2
- Unlabeled → Unsupervised.
Key Point 3
- Agent + goal → Reinforcement.
Key Point 4
- Define problem → Analyze data → Select model.
Key Point 5
- Process: split, select, train, test, validate.
Key Point 6
- Consider data size, quality, resources.
Same supplied content as this Notes page (shared canonical source).