Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

CE880_lecture5_slides

Uploaded by

Anand A J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

CE880_lecture5_slides

Uploaded by

Anand A J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

School of Computer Science and Electronics Engineering, University of Essex

ILecture 5: Machine Learning and Types


CE880: An Approachable Introduction to Data Science

Haider Raza
Tuesday, 14th February 2023

1
About Myself

I Name: Haider Raza


I Position: Senior Lecturer in AI
I Research interest: AI, Machine Learning, Data Science
I Contact: h.raza@essex.ac.uk
I Academic Support Hours: 1-2PM on Tuesday via zoom. Zoom link is available
on Moodle
I Website: www.sagihaider.com

2
What is Machine Learning?

I A set of features or covariates X


I A set of target or class variables Y
I A joint distribution P(Y,X) or P(Y ∩ X) (i.e. Probability of Y and X)
I (X → Y): Y is determined by values of X (e.g. credit card fraud detection)
Predictive models (e.g. Logistic Regression, SVM, and Neural Networks)
I (Y → X): Y determines the values of X (e.g. medical diagnosis) Generative
models (e.g. GMM, HMM, and Naive Bayes)
I The joint distribution P(Y,X) can be written as: * P(Y|X)P(X) in X → Y
problems * P(X|Y)P(Y) in Y → X problems
I Ptr : Data distribution in training
I Pts : Data distribution in testing

3
What is Machine Learning?

Machine learning is a branch of artificial intelligence (AI) and computer science which
focuses on the use of data and algorithms to imitate the way that humans learn,
gradually improving its accuracy.

0
https://christophm.github.io/

4
Example: Spam Filtering

Input: an email
Output: “SPAM” or “NOT SPAM”
A binary classification problem, because only 2 possible outputs.

5
Example: Medical Diagnosis

Input: Symptoms (fever, cough, fast breathing, shaking, nausea,...)


Output: Diagnosis (pneumonia, flu, common cold, bronchitis, ...)
A multiclass classification problem: choosing one of several [discrete] outputs.

How to express uncertainty?


Probabilistic classification or soft classification:
P(pneumonia) = 0.7
P(cold) = 0.2
P(flu) = 0.07

6
Example: Machine Learning: Predicting a Stock Price

Input: History of stock’s prices


Output: Predict stock’s price at close of next day

Regression analysis mathematically describes the relationship between a set of


independent variables and a dependent variable.

7
The Prediction Function

I A prediction function f takes input x and produces an output y .


I We‘re looking for prediction function (f ) that solve particular problem.
I Machine learning helps find the best prediction function.

8
Rule-based System

Consider medical diagnosis

I Consult textbooks and medical doctors (i.e. “experts”).


I Understand their diagnosis process
I Implement this as an algorithm (a “rule-based system”)
Doesn’t sound too bad. It was very popular in the 1980s.

9
Issues with Rule-based Systems:

I Very labor intensive to build


I Rules work very well for areas they cover
I Don’t naturally handle uncertainty
I Expert systems seen as “fragile”

10
Modern AI: Machine Learning

I Don‘t reverse engineer an expert‘s decision process.


I Machine “learns” on its own.
I We provide “training data” (i.e. many examples of (input x , output y) pairs)
I Learning from training data of this form is called supervised learning.

11
Key concepts of ML

Most common ML problem types

I Classification (hard or soft/probabilistic)


I Multiclass (hard or soft/probabilistic)
I Regression
Prediction function

I Predicts output y given input x


Training data

I A set of (input x, output y ) pairs

12
Types of Machine Learning

Three Most common ML types

I Supervised learning
I Unsupervised learning
I Reinforcement learning
There are other types as well

I Semi-supervised learning
I Transductive learning

13
14
Supervised Learning

Supervised learning is a type of ML where the model is provided with labeled training
data.

I In supervised machine learning, you feed the features and their corresponding
labels into an algorithm in a process called training. During training, the
algorithm gradually determines the relationship between features and their
corresponding labels. This relationship is called the model. Often times in
machine learning, the model is very complex.

15
Unsupervised Learning

Supervised learning is a type of ML where the model is provided only with unlabeled
data.

I In unsupervised learning, the goal is to identify meaningful patterns in the


data. To accomplish this, the machine must learn from an unlabeled data set. In
other words, the model has no hints how to categorize each piece of data and
must infer its own rules for doing so.

16
Reinforcement Learning

Reinforcement Learning(RL) is a type of machine learning technique that enables an


agent to learn in an interactive environment by trial and error using feedback from its
own actions and experiences.

17
Types of ML Problems

There are several sub-classes of ML problems based on what the prediction task looks
like. In the table below, you can see examples of common supervised and unsupervised
ML problems.

18
Feeding Inputs to ML Algorithms

Raw input types can be:

I Text documents
I Variable-length time series
I Images
I Sounds recordings
But most ML prediction functions like their input as:

I fixed-length arrays of numbers


I double[d] – for the computer scientists
I R d – for the mathematicians

19
Feature Extraction

Mapping raw input x to R d is called feature extraction or featurization.

Feature vectors are often called input vectors.

20
Feature Extraction

Mapping raw input x to R d is called feature extraction or featurization.

Feature vectors are often called input vectors.

21
Supervised Learning: Regression and Classification

22
Supervised Learning: Regression and Classification..

23
Popular Classification Algorithms

I Logistic Regression
I Naive Bayes
I K-Nearest Neighbors
I Decision Tree
I Support Vector Machines

24
Popular Regression Algorithms

I Logistic Regression
I Linear Regression
I Ridge Regression
I Neural Network Regression
I Lasso Regression
I Decision Tree Regression

25
Evaluating a Prediction Function

I Brilliant data science intern gives you a prediction function


I How do we evaluate performance?
I Very important part of machine learning
I It can be subtle
I How do we evaluate performance?

26
Evaluating a Single Prediction: The Loss Function

A loss function scores how far off a prediction is from the desired “target” output

I loss(prediction, target) returns a number called “the loss”


I Big Loss = Bad Error
I Small Loss = Minor Error
I Zero Loss = No Error

27
Classic Loss Function

Classification loss or “0/1 Loss”

I Loss is 1 if prediction is wrong


I Loss is 0 if prediction is correct
Square loss for regression

I loss = (predicted − target)2

28
Partitioning Dataset

29
Bias–variance tradeoff

30
Bias–variance tradeoff

I High Bias and low variance is the case of underfitting


I Low Bias and high variance is the case of overfitting
31
32

You might also like