You are on page 1of 49

5/18/2021

SRI RAMAKRISHNA ENGINEERING COLLEGE


[Educational Service : SNR Sons Charitable Trust]
[Autonomous Institution, Accredited by NAAC with ‘A’ Grade]
[Approved by AICTE and Permanently Affiliated to Anna University, Chennai]
[ISO 9001:2015 Certified and all Eligible Programmes Accredited by NBA]
VATTAMALAIPALAYAM, N.G.G.O. COLONY POST, COIMBATORE – 641 022.

Department of Computer Science and Engineering

Workshop on Machine Learning

Machine Learning
S.Birundha,
Assistant Professor, CSE

1
5/18/2021
Machine Learning
a
Comprehensive
Overview

S.Birundha, AP/CSE
2
5/18/2021
AGENDA
● Discussion – Python IDE and Google Colab
● Python Libraries
● Machine Learning
Introduction to Sci-kit Learn

S.Birundha, AP/CSE

● Linear Regression – Problem Solving


3
PYTHON IDE

S.Birundha, AP/CSE 5/18/2021


4
5/18/2021
Google Colab

• Link to work on Google Colab

• https://colab.research.google.com/

S.Birundha, AP/CSE
5
Python Libraries

S.Birundha, AP/CSE 5/18/2021


6
5/18/2021
What happens when you add
learning and automation to
analytics?

S.Birundha, AP/CSE
7
S.Birundha, AP/CSE 5/18/2021
8
S.Birundha, AP/CSE 5/18/2021
9
S.Birundha, AP/CSE 5/18/2021
10
S.Birundha, AP/CSE 5/18/2021
11
S.Birundha, AP/CSE 5/18/2021
12
S.Birundha, AP/CSE 5/18/2021
13
S.Birundha, AP/CSE 5/18/2021
14
S.Birundha, AP/CSE 5/18/2021
15
S.Birundha, AP/CSE 5/18/2021
16
S.Birundha, AP/CSE 5/18/2021
17
S.Birundha, AP/CSE 5/18/2021
18
Breakthroughs in AI

S.Birundha, AP/CSE 5/18/2021*


19
5/18/2021
Breakthroughs in AI – contd…

S.Birundha, AP/CSE
20
What the fun is

5/18/2021*
machine
learning?

S.Birundha, AP/CSE
21
Machine Learning

S.Birundha, AP/CSE 5/18/2021


22
Supervised Learning

S.Birundha, AP/CSE 5/18/2021


23
Unsupervised Learning

S.Birundha, AP/CSE 5/18/2021


24
S.Birundha, AP/CSE 5/18/2021
25
Reinforcement Learning

S.Birundha, AP/CSE 5/18/2021


26
S.Birundha, AP/CSE 5/18/2021
27
5/18/2021
Types of Machine Learning

S.Birundha, AP/CSE
28
5/18/2021
Supervised Learning in ML

S.Birundha, AP/CSE
29
5/18/2021
Supervised Learning in ML

S.Birundha, AP/CSE
30
5/18/2021
Unsupervised Learning in ML

S.Birundha, AP/CSE
31
5/18/2021
Semi-Supervised Learning in ML

S.Birundha, AP/CSE
32
Reinforcement Learning in ML

5/18/2021
• Agent, learns by interacting with its environment.

S.Birundha, AP/CSE
33
5/18/2021*
Machine Learning 101
• Classifying a person as MALE or FEMALE

1. Male:
1. Weight > 75kg
1. Height
2. Height > 5’9’’
1. Weight
1. Female:
1. Weight < 70kg
2. Height < 5’7’’

Data points Feature extraction Classification

S.Birundha, AP/CSE
1. Feature extraction: How to represent the data points ?
2. Classification: How to use the features to distinguish the classes ?

LOSS OF GENERALIZATION !!! 34


5/18/2021*
Machine Learning 101
• Learn a classifier: learn a mapping function w

1. M: <h1, w1>
2. F: <h2, w2>
3. …

N. M: <hn, wn>

Data points h
Feature extraction Classification

S.Birundha, AP/CSE
1. Boundary: Can be linear or non-linear boundary
2. Method: Can be a generative classifier or discriminative classifier
Examples: Naïve Bayes, Decision trees, Neural Network, Support Vector Machines etc.
Classification is only as good as feature extraction !!!
35
5/18/2021*
Machine Learning - Pipeline

Gather Clean Extract


Learn Predict
Data Data Features

• Feature extraction
• Manual feature engineering – define what features to extract manually
• Unsupervised feature learning – learn the features automatically
• Deep learning is one way of unsupervised feature learning

S.Birundha, AP/CSE
• Learning
• Rule based learning – rules for classification are defined manually
• Machine Learning – learn the classification rules (boundary) automatically

36
ML Vs DL

S.Birundha, AP/CSE 5/18/2021


37
Machine Learning Applications

5/18/2021
S.Birundha, AP/CSE
38
5/18/2021
Machine Learning Softwares

S.Birundha, AP/CSE
39
5/18/2021
Introduction to Sci-Kit Learn
• Scikit Learn is built on top of several common data and math Python
libraries.
• It uses the following libraries:
• NumPy: For any work with matrices, especially math operations
• SciPy: Scientific and technical computing
• Matplotlib: Data visualisation
• IPython: Interactive console for Python

S.Birundha, AP/CSE
• Sympy: Symbolic mathematics
• Pandas: Data handling, manipulation, and analysis

40
5/18/2021
Introduction to Sci-Kit Learn –
Contd…
• Scikit’s robust set of algorithm offerings includes:
• Regression: Fitting linear and non-linear models
• Clustering: Unsupervised classification
• Decision Trees: Tree induction and pruning for both classification
and regression tasks
• Neural Networks: End-to-end training for both classification and
regression. Layers can be easily defined in a tuple

S.Birundha, AP/CSE
• SVMs: for learning decision boundaries
• Naive Bayes: Direct probabilistic modelling

41
Scikit Learn

S.Birundha, AP/CSE 5/18/2021


42
Regression Analysis

S.Birundha, AP/CSE 5/18/2021


43
5/18/2021
Regression Analysis
• Regression analysis is a form of predictive modelling technique which
investigates the relationship between
a dependent (target) and independent variable (s) (predictor).

S.Birundha, AP/CSE
44
Example

S.Birundha, AP/CSE 5/18/2021


45
5/18/2021
Types of Regression

• Linear Regression
• Logistic Regression
• Polynomial Regression
• Stepwise Regression
• Ridge Regression
• Lasso Regression

S.Birundha, AP/CSE
• ElasticNet Regression

46
5/18/2021
Problem Solving - Linear
Regression
• In this regression task,
• Predict the percentage of marks that a student is expected to score
based upon the number of hours they studied.
• This is a simple linear regression task as it involves just two variables.

• The equation of the line is :


• Y= mx + b

S.Birundha, AP/CSE
• Where b is the intercept and m is the slope of the line.

47
Performance of an Alogorithm

5/18/2021
• Mean Absolute Error (MAE) is the mean of the absolute value of the
errors. It is calculated as:

• Mean Squared Error (MSE) is the mean of the squared errors and is
calculated as:

S.Birundha, AP/CSE
• Root Mean Squared Error (RMSE) is the square root of the mean of
the squared errors:

48
Open Discussion

S.Birundha, AP/CSE 5/18/2021*


49

You might also like