Natural Language UnderstandingMachine Learning Basic


原 PPT 独立图片资源
Natural Language
Understanding

Machine Learning Basic
Mingming Sun
BIMSA

Outline


原 PPT 独立图片资源
Outline
What is Machine Learning
Building A Machine Learning System
Machine Learning Models
Optimization Methods
Generalization and Model Selection
Suggested Readings

0.3 Machine Learning Basics 0.3.1 What Is Machine Learning



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.1 What Is Machine Learning

原 PPT 独立图片资源

Domains of AI


原 PPT 独立图片资源
Domains of AI

Domains of Artificial Intelligence (AI)
https://www.instagram.com/dataprocomputersofficial/p/C11GBTPRn-F/

What is Machine Learning


原 PPT 独立图片资源
What is Machine Learning
Learning is any process by which a system improves performance from experience. —— Herbert Simon
Machine Learning is the field of study that gives computers the ability to learn without being explicitly programmed. —— Arthur Samuel, 1959
Machine Learning is the science (and art) of programming computers so they can learn from data (experience).

A Formal Definition by Tom Mitchell (1998)


原 PPT 独立图片资源
A Formal Definition by Tom Mitchell (1998)
Machine Learning is the study of algorithms that
improve their performance P
at some task T
with experience E.
A well-defined learning task is given by <P, T, E>.

Why Machine Learning (I)


原 PPT 独立图片资源
Why Machine Learning (I)
The traditional approach:
You must read and understand the experience yourself;
Write a long list of complex rules pretty hard to maintain.

原 PPT 独立图片资源
https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

Why Machine Learning (II)


原 PPT 独立图片资源
Why Machine Learning (II)
The Machine Learning approach:
Machine learns from experience;
Faster to generate a program (model);
The performance is generally better.

原 PPT 独立图片资源
https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

Why Machine Learning (III)


原 PPT 独立图片资源
Why Machine Learning (III)
Machine Learning helps human learning, think and discover.

原 PPT 独立图片资源
https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

Why Machine Learning (IV)


原 PPT 独立图片资源
Why Machine Learning (IV)
Machine Learning is great for:
Problems for which existing solutions require a lot of hand-tuning or long lists of rules: one Machine Learning algorithm can often simplify code and perform better.
Complex problems for which there is no good solution at all using a traditional approach: the best Machine Learning techniques can find a solution.

https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

0.3 Machine Learning Basics 0.3.2 Building Machine Learning Systems



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.2 Building Machine Learning Systems

原 PPT 独立图片资源

Building A Machine Learning System (I)


原 PPT 独立图片资源
Building A Machine Learning System (I)

https://insights.blackcoffer.com/the-workflow-of-a-machine-learning-artificial-intelligence-project/
原 PPT 独立图片资源

Building A Machine Learning System (II)


原 PPT 独立图片资源
Building A Machine Learning System (II)

Yae Won Park, et.al, Radiomics features of hippocampal regions in magnetic resonance imaging can differentiate medial temporal lobe epilepsy patients from healthy controls, Scientific Reports 2020
Workflow of image processing, radiomics feature extraction, and machine learning.


Preprocessing


原 PPT 独立图片资源
Preprocessing



Preprocessing step receives the raw data, and prepare the samples for feature extraction using following steps:
Data selection: Filter relevant part of data;
Clean data: Removes low quality, inconsistent data;
Handles missing values: Ensures no critical information is lost.
Normalizes data: Brings data to a common scale for better convergence;
…

Feature Extraction


原 PPT 独立图片资源
Feature Extraction



Feature Extraction bridges the raw input data of the task to the learning model;
It generally convert text, sounds, images, videos into vector of features;
Methods:
Text: word index in vocabulary, word pos-tag catetory, TF-IDF vector of document;
Image: SIFT, Gabor;
Speech: Wavelet
…

Choose the Model Family


原 PPT 独立图片资源
Choose the Model Family



Model Families:
Linear Model, Decision Tree, Support Vector Machines, Neural Network
Key Considerations
Problem Type: Classification vs Regression.
Data: Size and complexity.
Resources: Simpler models for less computation.
Key Takeaway
Start with simple models (linear models, decision trees) and move to complex models (SVM, neural networks) if needed.

Model Training and Evaluation


原 PPT 独立图片资源
Model Training and Evaluation



Model Training
Training Data: Labeled data used to teach the model.
Loss Function: Measures model performance (e.g., MSE, Cross-Entropy).
Optimization: Adjusts parameters to minimize error (e.g., gradient descent).
Model Evaluation
Test Set: Used to evaluate the final model’s real-world performance.
Evaluation Metrics: Accuracy, Precision, Recall, F1 Score; RMSE.
Common Challenges
Overfitting: Model captures noise, mitigated by regularization.
Underfitting: Model too simple, mitigated by using more complex models.

0.3 Machine Learning Basics 0.3.3 Machine Learning Models



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.3 Machine Learning Models

原 PPT 独立图片资源

Types of Machine Learning Systems


原 PPT 独立图片资源
Types of Machine Learning Systems

Supervised Learning
Mapping samples to given label system.
Unsupervised Learning
Explore and find inner-structure of data.
Reinforcement Learning
Learning from feedbacks from the environment.

Supervised Learning


原 PPT 独立图片资源
Supervised Learning
In supervised learning, the training data feed to the algorithm includes the desired output (labels).


Regression: when y is real.
Classification: when y is discrete.

原 PPT 独立图片资源

Supervised Learning


原 PPT 独立图片资源
Supervised Learning
原 PPT 独立图片资源

https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

Supervised Learning


原 PPT 独立图片资源
Supervised Learning

k-Nearest Neighbors
Linear Regression
Logistic Regression
Support Vector Machines (SVMs)
Decision Trees and Random Forests
Feed-Forward Neural networks

Logistic Regression


原 PPT 独立图片资源
Logistic Regression

Decision Surface for Logistic Regression on a Binary Classification Task
https://machinelearningmastery.com/plot-a-decision-surface-for-machine-learning/
Binary classification by predicting the probability of 0 or 1.
Components:
Model:   𝑧=∑𝑤𝑖𝑥𝑖+𝑏;
Prediction: 𝑃(𝑦=1|𝑋) = 11+𝑒−𝑧;
Loss function: Cross-Entropy
Optimization: Gradient Descent

Unsupervised Learning


原 PPT 独立图片资源
Unsupervised Learning
In unsupervised learning, the training data is unlabeled. The system tries to learn without a teacher.


No labels are given to the learning algorithm, leaving it on its own to explore or find structure in the data.

原 PPT 独立图片资源

Unsupervised Learning


原 PPT 独立图片资源
Unsupervised Learning
原 PPT 独立图片资源

https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

Unsupervised Learning


原 PPT 独立图片资源
Unsupervised Learning

Distribution Estimation:
MLE, VAE, Language Model;
Clustering:
K-Means, GMM, Affinity Propagation;
Dimensionality Reduction
PCA, ICA
Visualization
t-SNE

Gaussian Mixture Model


原 PPT 独立图片资源
Gaussian Mixture Model

原 PPT 独立图片资源
https://pomegranate.readthedocs.io/en/latest/tutorials/B_Model_Tutorial_2_General_Mixture_Models.html
Estimate the density of data by a mixture of several Gaussian distributions
Components:
Model: p(x)=∑𝑝𝑘𝒩(𝑥|𝜇𝑘,Σ𝑘);
Loss: negative log-likelihood 
Optimization: EM algorithm;
Application: Clustering, Anomaly Detection

Reinforcement Learning


原 PPT 独立图片资源
Reinforcement Learning
Agent learns to make decisions by interacting with an environment to maximize a reward signal over time.
Exploration vs. Exploitation:
Exploration refers to trying new actions to discover potentially better rewards.
Exploitation means choosing the action that gives the highest known reward based on past experience.
The agent interacts with the environment by taking actions, receiving rewards, and updating its policy to maximize future rewards.

Reinforcement Learning


原 PPT 独立图片资源
Reinforcement Learning
原 PPT 独立图片资源

https://www.slideshare.net/slideshow/the-fundamentals-of-machine-learning/238653218

0.3 Machine Learning Basics 0.3.4 Optimization Methods



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.4 Optimization Methods

原 PPT 独立图片资源

Optimization for Machine Learning


原 PPT 独立图片资源
Optimization for Machine Learning
Optimization: find the best parameters 𝜃 for the machine  𝑀  that minimize the loss function (or cost function)  ℒ(𝑀(𝜃)) , where  𝑀(𝜃)  represents the machine’s predictions based on parameters  𝜃 .
min𝜃 ℒ(𝑀(𝜃))+𝜆 ℛ(𝜃)
Where:
ℛ(𝜃) is the regularization term (e.g., L1 or L2 regularization).
𝜆  is the regularization strength.

Gradient Decent


原 PPT 独立图片资源
Gradient Decent

Gradient descent
https://easyai.tech/en/ai-definition/gradient-descent/
Objective: Minimize loss function 𝐽(𝜃) by updating parameters 𝜃.
Update Rule:
𝜃 =𝜃 −𝛼 ∇𝜃 𝐽(𝜃)
Challenges:
Choosing Learning Rate.
Local Minima

Policy Gradient


原 PPT 独立图片资源
Policy Gradient
Sample trajectories;
Compute return  𝑅𝑡;
Compute the gradient:
∇𝜃 𝐽(𝜃) = 𝔼𝜋(𝜃)[ ∇𝜃 𝑙𝑜𝑔 𝜋𝜃(𝑎𝑡|𝑠𝑡)⋅𝑅𝑡]
Update the policy;
Repeat until convergence.

原 PPT 独立图片资源
https://jonathan-hui.medium.com/rl-policy-gradients-explained-9b13b688b146

Expectation Maximization


原 PPT 独立图片资源
Expectation Maximization
Goal: Maximize the likelihood 𝐿(𝜃 | 𝑋) =∑𝑍𝑃(𝑋, 𝑍 | 𝜃)  given latent variables 𝑍.
E-step (Expectation):
Estimate the latent variables 𝑃(𝑍 | 𝑋, 𝜃).
M-step (Maximization):
Update the parameters 𝜃 to maximize  𝔼[𝑙𝑜𝑔 𝑃(𝑋, 𝑍 | 𝜃)] .

undefined
https://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm

0.3 Machine Learning Basics 0.3.5 Generalization and Model Selection



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.5 Generalization and Model Selection

原 PPT 独立图片资源

Generalization, Underfitting and Overfitting


原 PPT 独立图片资源
Generalization, Underfitting and Overfitting
Generalization: The ability of a model to perform well on unseen data.
Underfitting: Model cannot capture the underlying patterns of the data.
Overfitting: Model learns the noise or random fluctuations in the training data, rather than the underlying patterns.

Degree 1 MSE = 4.08e-01(+/- 4.25e-01), Degree 4 MSE = 4.32e-02(+/- 7.08e-02), Degree 15 MSE = 1.82e+08(+/- 5.46e+08)
https://scikit-learn.org/stable/auto_examples/model_selection/plot_underfitting_overfitting.html

Generalization, Underfitting and Overfitting


原 PPT 独立图片资源
Generalization, Underfitting and Overfitting

https://vitalflux.com/overfitting-underfitting-concepts-interview-questions/
Overfitting and Underfitting in Machine Learning

Statistical Learning Setting


原 PPT 独立图片资源
Statistical Learning Setting
Given:
Data Distribution: (𝑋,𝑌)
Model: set ℱ of candidate predictors of the form 𝑓:𝒳↦𝒴
Loss function: 𝑙:𝒴×𝒴↦ℝ+
Goal: 𝑓∗=argmin𝑓∈ℱ⁡𝐸[𝑙(𝑌,𝑓(𝑋))]

Introduction to Statistical Learning Theory. J. Saketha Nath (IIT Bombay)

Statistical Learning Setting


原 PPT 独立图片资源
Statistical Learning Setting
Given a sampled training data set
𝐷={(𝑥1,𝑦1),(𝑥2,𝑦2), …,(𝑥𝑚,𝑦𝑚)}
Empirical Error: {1𝑚∑𝑖=1𝑚𝑙(𝑌𝑖,𝑓(𝑋𝑖))}𝑚=1∞ →     p       𝐸[𝑙(𝑌, 𝑓(𝑋))]
We can obtain a machine 𝑓^ by minimize the empirical error;
We study the statistical property of 𝑓^ given different sampling form data distributions.

Bias Variance Trade-off


原 PPT 独立图片资源
The bias is the difference between the expected value of the model’s prediction and the true value of the target


The variance measures how much the model’s prediction fluctuates when trained on different training sets.
Bias Variance Trade-off

https://scott.fortmann-roe.com/docs/BiasVariance.html
原 PPT 独立图片资源
原 PPT 独立图片资源
原 PPT 独立图片资源
原 PPT 独立图片资源

Bias Variance Trade-off


原 PPT 独立图片资源
Bias Variance Trade-off

https://scott.fortmann-roe.com/docs/BiasVariance.html
原 PPT 独立图片资源

Regularization


原 PPT 独立图片资源
Regularization
Simpler Model
Smoother Model
Add Noise
Early Stop

An image that shows how regularization tries to reduce model flexibility in an effort to reduce and minimize validation error.
https://www.sharpsightlabs.com/blog/regularization-explained/

Model Selection


原 PPT 独立图片资源
Model Selection

原 PPT 独立图片资源
https://insights.blackcoffer.com/the-workflow-of-a-machine-learning-artificial-intelligence-project/
Resampling Methods: Cross-Validation

0.3 Machine Learning Basics 0.3.6 Suggested Readings



原 PPT 独立图片资源

0.3 Machine Learning Basics 0.3.6 Suggested Readings

原 PPT 独立图片资源

Books


原 PPT 独立图片资源
Books
The Elements of Statistical Learning: Data Mining, Inference, and Prediction.by Trevor Hastie, Robert Tibshirani, Jerome Friedman https://hastie.su.domains/ElemStatLearn/

Any Questions?



原 PPT 独立图片资源
Any Questions?
原 PPT 独立图片资源