<!-- Slide number: 1 -->
Zhang Luxiao zwx635163
2020-02-20
New
Notes:
<!-- Slide number: 2 -->
Machine Learning Overview
Notes:
<!-- Slide number: 3 -->
Machine learning is a core research field of AI, and it is also a necessary knowledge for deep learning. Therefore, this chapter mainly introduces the main concepts of machine learning, the classification of machine learning, the overall process of machine learning, and the common algorithms of machine learning.
<!-- Slide number: 4 -->
Upon completion of this course, you will be able to:
Master the learning algorithm definition and machine learning process.
Know common machine learning algorithms.
Understand concepts such as hyperparameters, gradient descent, and cross validation.
Notes:
<!-- Slide number: 5 -->
Machine Learning Definition
Machine Learning Types
Machine Learning Process
Other Key Machine Learning Methods
Common Machine Learning Algorithms
Case Study
Notes:
<!-- Slide number: 6 -->
Machine Learning Algorithms (1)
Notes:
<!-- Slide number: 7 -->
Machine Learning Algorithms (2)
Experience
Induction
Prediction
Input
New problems
Future
Regularity
Historical data
Training
Prediction
Input
New data
Future attributes
Model
Notes:
<!-- Slide number: 8 -->
Created by: Jim Liang
Differences Between Machine Learning Algorithms and Traditional Rule-Based Algorithms
Machine learning
Rule-based algorithms
Training data
Machine learning
Prediction
Model
New data
Samples are used for training.
The decision-making rules are complex or difficult to describe.
Rules are automatically learned by machines.
Explicit programming is used to solve problems.
Rules can be manually specified.
Notes:
<!-- Slide number: 9 -->
Application Scenarios of Machine Learning (1)
The solution to a problem is complex, or the problem may involve a large amount of data without a clear data distribution function.
Machine learning can be used in the following scenarios:
Task rules change over time. For example, in the part-of-speech tagging task, new words or meanings are generated at any time.
Rules are complex or cannot be described, such as voice recognition.
Data distribution changes over time, requiring constant readaptation of programs, such as predicting the trend of commodity sales.
Notes:
<!-- Slide number: 10 -->
Application Scenarios of Machine Learning (2)
Complex
Machine learning algorithms
Rule complexity
Manual rules
Simple
Rule-based algorithms
Simple problems
Small
Large
Scale of the problem
Notes:
<!-- Slide number: 11 -->
Rational Understanding of Machine Learning Algorithms
Ideal
Actual
Learning algorithms
Target function f is unknown. Learning algorithms cannot obtain a perfect function f.
Assume that hypothesis function g approximates function f, but may be different from function f.
Notes:
<!-- Slide number: 12 -->
Main Problems Solved by Machine Learning
Notes:
<!-- Slide number: 13 -->
Machine Learning Definition
Machine Learning Types
Machine Learning Process
Other Key Machine Learning Methods
Common Machine Learning Algorithms
Case study
Notes:
<!-- Slide number: 14 -->
Machine Learning Classification
Supervised learning: Obtain an optimal model with required performance through training and learning based on the samples of known categories. Then, use the model to map all inputs to outputs and check the output for the purpose of classifying unknown data.
Unsupervised learning: For unlabeled samples, the learning algorithms directly model the input datasets. Clustering is a common form of unsupervised learning. We only need to put highly similar samples together, calculate the similarity between new samples and existing ones, and classify them by similarity.
Semi-supervised learning: In one task, a machine learning model that automatically uses a large amount of unlabeled data to assist learning directly of a small amount of labeled data.
Reinforcement learning: It is an area of machine learning concerned with how agents ought to take actions in an environment to maximize some notion of cumulative reward. The difference between reinforcement learning and supervised learning is the teacher signal. The reinforcement signal provided by the environment in reinforcement learning is used to evaluate the action (scalar signal) rather than telling the learning system how to perform correct actions.
Notes:
Supervised learning: We give a computer a bunch of choice questions (training samples) and provide standard answers. The computer tries to adjust its model parameters to make their predictions close to standard answers. In this way, the computer learns how to deal with this type of problem. Then the computer can help us reply to choice questions whose answers are not given (test samples).
Unsupervised learning: We give a computer a bunch of choice questions (training samples), but do not provide standard answers. The computer tries to analyze the relationships between these questions and classify them. It does not know the answers to these questions, but it thinks that the answers to the questions in the same category should be the same.
<!-- Slide number: 15 -->
Machine Learning Classification
Supervised learning: Obtain an optimal model with required performance through training and learning based on the samples of known categories. Then, use the model to map all inputs to outputs and check the output for the purpose of classifying unknown data.
Unsupervised learning: For unlabeled samples, the learning algorithms directly model the input datasets. Clustering is a common form of unsupervised learning. We only need to put highly similar samples together, calculate the similarity between new samples and existing ones, and classify them by similarity.
Semi-supervised learning: In one task, a machine learning model that automatically uses a large amount of unlabeled data to assist learning directly of a small amount of labeled data.
Reinforcement learning: It is an area of machine learning concerned with how agents ought to take actions in an environment to maximize some notion of cumulative reward. The difference between reinforcement learning and supervised learning is the teacher signal. The reinforcement signal provided by the environment in reinforcement learning is used to evaluate the action (scalar signal) rather than telling the learning system how to perform correct actions.
Notes:
Semi-supervised learning: Traditional supervised learning uses a large number of labeled training samples to create a model for predicting the labels of new samples. For example, in a classification task, a label indicates the category of a sample while in a regression task, a label is a real-value output of the sample. As our data collection and storage capabilities are developing, we can easily gain a large amount of unlabeled data from many tasks. However, labeling the data is labor-consuming and time-consuming. For example, for web page recommendation, users need to label web pages they like, but only a few users are willing to spend a lot of time doing this. Then we get limited labeled web page data and a large amount of unlabeled web page data.
Reinforcement learning: We give a computer a bunch of choice questions (training samples), but do not provide standard answers. It tries to solve these questions, and we check whether the answers are correct as teachers. If the computer generates more correct answers, we offer more rewards. The computer adjusts its model parameters to make its predictions correct and obtain more rewards. Not strictly speaking, reinforcement learning can be understood as unsupervised learning plus supervised learning (unsupervised learning before supervised learning).
<!-- Slide number: 16 -->
Supervised Learning
Data feature
Label
Feature 1
Goal
...
Feature n
Supervised learning algorithm
...
Goal
Feature n
Feature 1
Feature 1
Feature n
...
Goal
| Weather | Temperature | Wind Speed |
| --- | --- | --- |
| Sunny | Warm | Strong |
| Rainy | Cold | Fair |
| Sunny | Cold | Weak |
| Enjoy Sports |
| --- |
| Yes |
| No |
| Yes |
Notes:
<!-- Slide number: 17 -->
Supervised Learning - Regression Questions
Regression: reflects the features of attribute values of samples in a sample dataset. The dependency between attribute values is discovered by expressing the relationship of sample mapping through functions.
How much will I benefit from the stock next week?
What's the temperature on Tuesday?
Notes:
<!-- Slide number: 18 -->
Supervised Learning - Classification Questions
Classification: maps samples in a sample dataset to a specified category by using a classification model.
Will there be a traffic jam on XX road during the morning rush hour tomorrow?
Which method is more attractive to customers:5 yuan voucher or 25% off?
Notes:
Publicité
<!-- Slide number: 19 -->
Unsupervised Learning
Data Feature
Feature 1
...
Feature n
Internal similarity
Unsupervised learning algorithm
...
Feature n
Feature 1
Feature 1
Feature n
...
| Monthly Consumption | Commodity | Consumption Time |
| --- | --- | --- |
| 1000–2000 | Badminton racket | 6:00–12:00 |
| 500–1000 | Basketball | 18:00–24:00 |
| 1000–2000 | Game console | 00:00–6:00 |
| Category |
| --- |
| Cluster 1 |
| Cluster 2 |
Notes:
<!-- Slide number: 20 -->
Unsupervised Learning - Clustering Questions
Clustering: classifies samples in a sample dataset into several categories based on the clustering model. The similarity of samples belonging to the same category is high.
Which audiences like to watch movies of the same subject?
Which of these components are damaged in a similar way?
Notes:
<!-- Slide number: 21 -->
Semi-Supervised Learning
Data Feature
Label
Feature 1
Goal
...
Feature n
Semi-supervised learning algorithms
...
Unknown
Feature n
Feature 1
Feature 1
Feature n
...
Unknown
| Weather | Temperature | Wind Speed |
| --- | --- | --- |
| Sunny | Warm | Strong |
| Rainy | Cold | Fair |
| Sunny | Cold | Weak |
| Enjoy Sports |
| --- |
| Yes |
| / |
| / |
Notes:
<!-- Slide number: 22 -->
Reinforcement Learning
The model perceives the environment, takes actions, and makes adjustments and choices based on the status and award or punishment.
Model
Environment
Notes:
Reinforcement learning uses a series of actions to maximize the reward function to learn models.
Both good and bad behaviors can help reinforcement learning in model learning.
For example, autonomous vehicles learn by continuously interacting with the environment.
<!-- Slide number: 23 -->
Reinforcement Learning - Best Behavior
Reinforcement learning: always looks for best behaviors. Reinforcement learning is targeted at machines or robots.
Autopilot: Should it brake or accelerate when the yellow light starts to flash?
Cleaning robot: Should it keep working or go back for charging?
Notes:
<!-- Slide number: 24 -->
Machine learning algorithm
Machine Learning Classification
Machine Learning Process
Other Key Machine Learning Methods
Common Machine Learning Algorithms
Case study
Notes:
<!-- Slide number: 25 -->
Machine Learning Process
Model deployment and integration
Feature extraction and selection
Model evaluation
Data collection
Data cleansing
Model training
Feedback and iteration
Notes:
<!-- Slide number: 26 -->
Basic Machine Learning Concept — Dataset
Dataset: a collection of data used in machine learning tasks. Each data record is called a sample. Events or attributes that reflect the performance or nature of a sample in a particular aspect are called features.
Training set: a dataset used in the training process, where each sample is referred to as a training sample. The process of creating a model from data is called learning (training).
Test set: Testing refers to the process of using the model obtained after learning for prediction. The dataset used is called a test set, and each sample is called a test sample.
Notes:
<!-- Slide number: 27 -->
Checking Data Overview
Typical dataset form
Feature 3
Feature 1
Feature 2
Label
| No. | Area | School Districts | Direction | House Price |
| --- | --- | --- | --- | --- |
| 1 | 100 | 8 | South | 1000 |
| 2 | 120 | 9 | Southwest | 1300 |
| 3 | 60 | 6 | North | 700 |
| 4 | 80 | 9 | Southeast | 1100 |
| 5 | 95 | 3 | South | 850 |
Training set
Test set
Notes:
<!-- Slide number: 28 -->
Importance of Data Processing
Data is crucial to models. It is the ceiling of model capabilities. Without good data, there is no good model.
Data preprocessing
Data cleansing
Data normalization
Normalize data to reduce noise and improve model accuracy.
Fill in missing values, and detect and eliminate causes of dataset exceptions.
Data dimension reduction
Simplify data attributes to avoid dimension explosion.
Notes:
<!-- Slide number: 29 -->
Workload of Data Cleansing
Statistics on data scientists' work in machine learning
3% Remodeling training datasets
5% Others
4% Optimizing models
9% Mining modes from data
19% Collecting datasets
60% Cleansing and sorting data
CrowdFlower Data Science Report 2016
Notes:
<!-- Slide number: 30 -->
Data Cleansing
Most machine learning models process features, which are usually numeric representations of input variables that can be used in the model.
In most cases, the collected data can be used by algorithms only after being preprocessed. The preprocessing operations include the following:
Data filtering
Processing of lost data
Processing of possible exceptions, errors, or abnormal values
Combination of data from multiple data sources
Data consolidation
Notes:
<!-- Slide number: 31 -->
Dirty Data (1)
Generally, real data may have some quality problems.
Incompleteness: contains missing values or the data that lacks attributes
Noise: contains incorrect records or exceptions.
Inconsistency: contains inconsistent records.
Notes:
<!-- Slide number: 32 -->
Dirty Data (2)
| # | Id | Name | Birthday | Gender | IsTeacher | #Students | Country | City |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | 111 | John | 31/12/1990 | M | 0 | 0 | Ireland | Dublin |
Publicité
| 2 | 222 | Mery | 15/10/1978 | F | 1 | 15 | Iceland | |
| 3 | 333 | Alice | 19/04/2000 | F | 0 | 0 | Spain | Madrid |
| 4 | 444 | Mark | 01/11/1997 | M | 0 | 0 | France | Paris |
| 5 | 555 | Alex | 15/03/2000 | A | 1 | 23 | Germany | Berlin |
| 6 | 555 | Peter | 1983-12-01 | M | 1 | 10 | Italy | Rome |
| 7 | 777 | Calvin | 05/05/1995 | M | 0 | 0 | Italy | Italy |
| 8 | 888 | Roxane | 03/08/1948 | F | 0 | 0 | Portugal | Lisbon |
| 9 | 999 | Anne | 05/09/1992 | F | 0 | 5 | Switzerland | Geneva |
| 10 | 101010 | Paul | 14/11/1992 | M | 1 | 26 | Ytali | Rome |
Missing value
Invalid value
Value that should be in another column
Invalid duplicate item
Misspelling
Incorrect format
Attribute dependency
Notes:
<!-- Slide number: 33 -->
Data Conversion
After being preprocessed, the data needs to be converted into a representation form suitable for the machine learning model. Common data conversion forms include the following:
With respect to classification, category data is encoded into a corresponding numerical representation.
Value data is converted to category data to reduce the value of variables (for age segmentation).
Other data
In the text, the word is converted into a word vector through word embedding (generally using the word2vec model, BERT model, etc).
Process image data (color space, grayscale, geometric change, Haar feature, and image enhancement)
Feature engineering
Normalize features to ensure the same value ranges for input variables of the same model.
Feature expansion: Combine or convert existing variables to generate new features, such as the average.
Notes:
<!-- Slide number: 34 -->
Necessity of Feature Selection
Generally, a dataset has many features, some of which may be redundant or irrelevant to the value to be predicted.
Feature selection is necessary in the following aspects:
Notes:
<!-- Slide number: 35 -->
Feature Selection Methods - Filter
Filter methods are independent of the model during feature selection.
By evaluating the correlation between each feature and the target attribute, these methods use a statistical measure to assign a value to each feature. Features are then sorted by score, which is helpful for preserving or eliminating specific features.
Common methods
Pearson correlation coefficient
Chi-square coefficient
Mutual information
Limitations
The filter method tends to select redundant variables as the relationship between features is not considered.
Select the optimal feature subset
Traverse all features
Train models
Evaluate the performance
Procedure of a filter method
Notes:
<!-- Slide number: 36 -->
Feature Selection Methods - Wrapper
Wrapper methods use a prediction model to score feature subsets.
Wrapper methods consider feature selection as a search issue for which different combinations are evaluated and compared. A predictive model is used to evaluate a combination of features and assign a score based on model accuracy.
Common methods
Recursive feature elimination (RFE)
Limitations
Wrapper methods train a new model for each subset, resulting in a huge number of computations.
A feature set with the best performance is usually provided for a specific type of model.
Select the optimal feature subset
Generate a feature subset
Traverse all features
Train models
Evaluate models
Procedure of a wrapper method
Notes:
<!-- Slide number: 37 -->
Feature Selection Methods - Embedded
Embedded methods consider feature selection as a part of model construction.
The most common type of embedded feature selection method is the regularization method.
Regularization methods are also called penalization methods that introduce additional constraints into the optimization of a predictive algorithm that bias the model toward lower complexity and reduce the number of features.
Common methods
Lasso regression
Ridge regression
Select the optimal feature subset
Generate a feature subset
Train models
+ Evaluate the effect
Traverse all features
Procedure of an embedded method
Notes:
The penalty attribute of the model is highlighted, which is used to eliminate unimportant features.
<!-- Slide number: 38 -->
Overall Procedure of Building a Model
Model Building Procedure
1 2 3
Data splitting:
Divide data into training sets, test sets, and validation sets.
Model training:
Use data that has been cleaned up and feature engineering to train a model.
Model verification:
Use validation sets to validate the model validity.
6
5
4
Model fine-tuning:
Continuously tune the model based on the actual data of a service scenario.
Model deployment:
Deploy the model in an actual production scenario.
Model test:
Use test data to evaluate the generalization capability of the model in a real environment.
Notes:
After data cleansing and feature extraction, we need to start building the model. The general procedure for building a model is shown above (supervised learning).
<!-- Slide number: 39 -->
Examples of Supervised Learning - Learning Phase
Use the classification model to predict whether a person is a basketball player.
Feature (attribute)
Target
| Name | City | Age | Label |
| --- | --- | --- | --- |
| Mike | Miami | 42 | yes |
| Jerry | New York | 32 | no |
| Bryan | Orlando | 18 | no |
| Patricia | Miami | 45 | yes |
| Elodie | Phoenix | 35 | no |
| Remy | Chicago | 72 | yes |
| John | New York | 48 | yes |
Service data
Training set
The model searches for the relationship between features and targets.
(Cleansed features and tags)
Splitting
Task: Use a classification model to predict whether a person is a basketball player under a specific feature.
Test set
Use new data to verify the model validity.
Model training
Each feature or a combination of several features can provide a basis for a model to make a judgment.
Notes:
Model example
<!-- Slide number: 40 -->
Examples of Supervised Learning - Prediction Phase
| Name | City | Age | Label |
| --- | --- | --- | --- |
| Marine | Miami | 45 | ? |
| Julien | Miami | 52 | ? |
| Fred | Orlando | 20 | ? |
| Michelle | Boston | 34 | ? |
| Nicolas | Phoenix | 90 | ? |
Unknown data
Recent data, it is not known whether the people are basketball players.
New data
IF city = Miami → Probability = +0.7
IF city= Orlando → Probability = +0.2
IF age > 42 → Probability = +0.05*age + 0.06
IF age ≤ 42 → Probability = +0.01*age + 0.02
Application model
| Name | City | Age | Prediction |
| --- | --- | --- | --- |
| Marine | Miami | 45 | 0.3 |
| Julien | Miami | 52 | 0.9 |
| Fred | Orlando | 20 | 0.6 |
| Michelle | Boston | 34 | 0.5 |
| Nicolas | Phoenix | 90 | 0.4 |
Possibility prediction
Apply the model to the new data to predict whether the customer will change the supplier.
New data
Prediction data
Notes:
Publicité
Model example
The model here can be considered similar to the decision tree model.
<!-- Slide number: 41 -->
What Is a Good Model?
Generalization capability
Can it accurately predict the actual service data?
Interpretability
Is the prediction result easy to interpret?
Prediction speed
How long does it take to predict each piece of data?
Practicability
Is the prediction rate still acceptable when the service volume increases with a huge data volume?
Notes:
Which factors are used to determine a model?
The last three are engineering factors. The generalization capability is the most important factor.
<!-- Slide number: 42 -->
Model Validity (1)
Generalization capability: The goal of machine learning is that the model obtained after learning should perform well on new samples, not just on samples used for training. The capability of applying a model to new samples is called generalization or robustness.
Error: difference between the sample result predicted by the model obtained after learning and the actual sample result.
Training error: error that you get when you run the model on the training data.
Generalization error: error that you get when you run the model on new samples. Obviously, we prefer a model with a smaller generalization error.
Underfitting: occurs when the model or the algorithm does not fit the data well enough.
Overfitting: occurs when the training error of the model obtained after learning is small but the generalization error is large (poor generalization capability).
Notes:
Once the form of a problem's hypothesis is given, all possible functions constitute a space, which is hypothesis space. The problem of machine learning is searching for a suitable fitting function in a hypothesis space.
Overfitting: It occurs frequently in complex mathematical models. To prevent overfitting, we can simplify mathematical models, end training before overfitting, or use dropout/weight decay methods.
Underfitting: It occurs if the mathematical model is too simple or the training time is too short. To solve the underfitting problem, use a more complex model or extend the training time.
<!-- Slide number: 43 -->
Model Validity (2)
Model capacity: model's capability of fitting functions, which is also called model complexity.
When the capacity suits the task complexity and the amount of training data provided, the algorithm effect is usually optimal.
Models with insufficient capacity cannot solve complex tasks and underfitting may occur.
A high-capacity model can solve complex tasks, but overfitting may occur if the capacity is higher than that required by a task.

Underfitting
Not all features are learned.
Good fitting
Overfitting
Noises are learned.
Notes:
The effective capacity is restricted by algorithms, parameters, and regularization.
<!-- Slide number: 44 -->
Overfitting Cause — Error
Total error of final prediction = Bias2 + Variance + Irreducible error
Generally, the prediction error can be divided into two types:
Error caused by "bias"
Error caused by "variance"
Variance:
Offset of the prediction result from the average value
Error caused by the model's sensitivity to small fluctuations in the training set
Bias:
Difference between the expected (or average) prediction value and the correct value we are trying to predict.
Variance
Bias
Notes:
About the unresolvable error
Theoretically, if there is infinite amount of data and a perfect model, the error can be eliminated.
Actually, all models are imperfect, and our data volume is limited.
<!-- Slide number: 45 -->
Variance and Bias
Combinations of variance and bias are as follows:
Low bias & low variance –> Good model
Low bias & high variance
High bias & low variance
High bias & high variance –> Poor model
Ideally, we want a model that can accurately capture the rules in the training data and summarize the invisible data (new data). However, it is usually impossible for the model to complete both tasks at the same time.
Notes:
<!-- Slide number: 46 -->
Model Complexity and Error
As the model complexity increases, the training error decreases.
As the model complexity increases, the test error decreases to a certain point and then increases in the reverse direction, forming a convex curve.
Low bias & high variance
High bias & low variance


Testing error
Error
Model Complexity
Training error
Notes:
<!-- Slide number: 47 -->
Machine Learning Performance Evaluation - Regression
Notes:
<!-- Slide number: 48 -->
Machine Learning Performance Evaluation - Classification (1)
Confusion matrix
Notes:
<!-- Slide number: 49 -->
Machine Learning Performance Evaluation - Classification (2)
Notes:
<!-- Slide number: 50 -->
Example of Machine Learning Performance Evaluation
Notes:
<!-- Slide number: 51 -->
Machine Learning Definition
Machine Learning Types
Machine Learning Process
Other Key Machine Learning Methods
Common Machine Learning Algorithms
Case study
Notes:
<!-- Slide number: 52 -->
Machine Learning Training Method - Gradient Descent (1)
Cost surface


Notes:
<!-- Slide number: 53 -->
Machine Learning Training Method - Gradient Descent (2)
Batch Gradient Descent (BGD) uses the samples (m in total) in all datasets to update the weight parameter based on the gradient value at the current point.
Stochastic Gradient Descent (SGD) randomly selects a sample in a dataset to update the weight parameter based on the gradient value at the current point.
Mini-Batch Gradient Descent (MBGD) combines the features of BGD and SGD and selects the gradients of n samples in a dataset to update the weight parameter.
Notes:
<!-- Slide number: 54 -->
Machine Learning Training Method - Gradient Descent (3)
Comparison of three gradient descent methods
In the SGD, samples selected for each training are stochastic. Such instability causes the loss function to be unstable or even causes reverse displacement when the loss function decreases to the lowest point.
BGD has the highest stability but consumes too many computing resources. MBGD is a method that balances SGD and BGD.
BGD
Uses all training samples for training each time.
SGD
Uses one training sample for training each time.
MBGD
Uses a certain number of training samples for training each time.
Notes:
Reverse displacement is caused by noise data from datasets.
<!-- Slide number: 55 -->
Parameters and Hyperparameters in Models
The model contains not only parameters but also hyperparameters. The purpose is to enable the model to learn the optimal parameters.
Parameters are automatically learned by models.
Hyperparameters are manually set.

Model parameters are "distilled" from data.
Model
Training
Use hyperparameters to control training.
Notes:
<!-- Slide number: 56 -->
Hyperparameters of a Model
Often used in model parameter estimation processes.
Often specified by the practitioner.
Can often be set using heuristics.
Often tuned for a given predictive modeling problem.
Model hyperparameters are external configurations of models.
Common model hyperparameters
Notes:
Parameters are a part of a model that is learned from historical training data and key to machine learning algorithms. They have the following features:
They are required by a model to make predictions.
Their values define the model functions.
They are obtained by data estimation or data learning.
They are often not set manually by the practitioner.
They are often saved as a part of the learned model.
Examples:
Weights in an artificial neural network
Support vectors in a support vector machine
Coefficients in linear regression or logistic regression
<!-- Slide number: 57 -->
Hyperparameter Search Procedure and Method
Publicité
Procedure for searching hyperparameters
Dividing a dataset into a training set, validation set, and test set.
Optimizing the model parameters using the training set based on the model performance indicators.
Searching for the model hyper-parameters using the validation set based on the model performance indicators.
Perform step 2 and step 3 alternately. Finally, determine the model parameters and hyperparameters and assess the model using the test set.
Search algorithm (step 3)
Grid search
Random search
Heuristic intelligent search
Bayesian search
Notes:
<!-- Slide number: 58 -->
Hyperparameter Searching Method - Grid Search
Grid search attempts to exhaustively search all possible hyperparameter combinations to form a hyperparameter value grid.
In practice, the range of hyperparameter values to search is specified manually.
Grid search is an expensive and time-consuming method.
This method works well when the number of hyperparameters is relatively small. Therefore, it is applicable to generally machine learning algorithms but inapplicable to neural networks (see the deep learning part).
Grid search
5
Hyperparameter 1
4
3
2
1
4
2
0
1
5
3
Hyperparameter 2
Notes:
<!-- Slide number: 59 -->
Hyperparameter Searching Method - Random Search
When the hyperparameter search space is large, random search is better than grid search.
In random search, each setting is sampled from the distribution of possible parameter values, in an attempt to find the best subset of hyperparameters.
Note:
Search is performed within a coarse range, which then will be narrowed based on where the best result appears.
Some hyperparameters are more important than others, and the search deviation will be affected during random search.
Random search
Parameter 1
Parameter 2
Notes:
<!-- Slide number: 60 -->
Cross Validation (1)
Notes:
<!-- Slide number: 61 -->
Cross Validation (2)
Entire dataset
Training set
Test set
Training set
Validation set
Test set
Note: The K value in K-fold cross validation is also a hyperparameter.
Notes:
<!-- Slide number: 62 -->
Machine Learning Definition
Machine Learning Types
Machine Learning Process
Other Key Machine Learning Methods
Common Machine Learning Algorithms
Case study
Notes:
<!-- Slide number: 63 -->
Machine Learning Algorithm Overview
Machine learning
Unsupervised learning
Supervised learning
Classification
Regression
Clustering
Others
Linear regression
Logistic regression
Correlation rule
K-means
Hierarchical clustering
Principal component analysis (PCA)
SVM
SVM
Density-based clustering
Gaussian mixture model (GMM)
Neural network
Neural network
Decision tree
Decision tree
Random forest
Random forest
GBDT
GBDT
KNN
Naive Bayes
Notes:
<!-- Slide number: 64 -->
Linear Regression (1)
Linear regression: a statistical analysis method to determine the quantitative relationships between two or more variables through regression analysis in mathematical statistics.
Linear regression is a type of supervised learning.
Multi-dimensional linear regression
Unary linear regression
Notes:
<!-- Slide number: 65 -->
Linear Regression (2)
Notes:
<!-- Slide number: 66 -->
Linear Regression Extension - Polynomial Regression
Polynomial regression is an extension of linear regression. Generally, the complexity of a dataset exceeds the possibility of fitting by a straight line. That is, obvious underfitting occurs if the original linear regression model is used. The solution is to use polynomial regression.
Comparison between linear regression and polynomial regression
Notes:
<!-- Slide number: 67 -->
Linear Regression and Overfitting Prevention
Notes:
<!-- Slide number: 68 -->
Logistic Regression (1)

Notes:
<!-- Slide number: 69 -->
Logistic Regression (2)
Notes:
After regularization terms are added, logistic regression can also prevent overfitting.
<!-- Slide number: 70 -->
Logistic Regression Extension - Softmax Function (1)
Logistic regression applies only to binary classification problems. For multi-class classification problems, use the Softmax function.
Binary classification problem
Multi-class classification problem
Grape?
Orange?
Male?
Apple?
Female?
Banana?
Notes:
<!-- Slide number: 71 -->
Logistic Regression Extension - Softmax Function (2)
Softmax regression is a generalization of logistic regression that we can use for K-class classification.
The Softmax function is used to map a K-dimensional vector of arbitrary real values to another K-dimensional vector of real values, where each vector element is in the interval (0, 1).
The regression probability function of Softmax is as follows:
Notes:
<!-- Slide number: 72 -->
Logistic Regression Extension - Softmax Function (3)
Softmax assigns a probability to each class in a multi-class problem. These probabilities must add up to 1.
Softmax may produce a form belonging to a particular class. Example:
Category
Probability
Grape?
0.09
Sum of all probabilities:
0.09 + 0.22 + 0.68 + 0.01 =1
Most probably, this picture is an apple.
0.22
Orange?
Apple?
0.68
Banana?
0.01
Notes:
<!-- Slide number: 73 -->
Decision Tree
Publicité
A decision tree is a tree structure (a binary tree or a non-binary tree). Each non-leaf node represents a test on a feature attribute. Each branch represents the output of a feature attribute in a certain value range, and each leaf node stores a category. To use the decision tree, start from the root node, test the feature attributes of th...