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

Lecture 1 - Introduction

Uploaded by

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

Lecture 1 - Introduction

Uploaded by

sasith.wickrama
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Mathematics required for the module

• Calculus (Differential equations)


• Statistics
• Linear Algebra
• Matrix operations
• Cartesian geometry

Programming languages : Octave (Matlab open source),


Python
Tools: Jupyter Notebook (Anaconda Distribution),
Octave, Azure ML Studio
1
Machine Learning – An
Introduction

2
About me
• Dharshana Kasthurirathna
• Main building, 6th floor, Malabe SLIIT campus
• dharshana.k@sliit.lk
Agenda

• Why ML?

• Introduction to ML

• Types of Machine learning

• Common Issues and Challenges

4
About
• Subfield of Artificial Intelligence (AI)/Application of optimization

• Name is derived from the concept that it deals with


“construction and study of systems that can learn from data”
• Can be seen as building blocks to make computers learn to
behave more intelligently
• It is an applied field of study. There are various techniques with
various implementations.
• Supports Other fields in CS (Vision, Data Mining, OCR, NLP, etc.)

5
Why now?
• Flood of available data (especially with the
advent of the Internet)
• Increasing computational power (e.g. Multi-
core)
• Growing progress in available algorithms and
theory developed by researchers
• Increasing support from industries
• Cloud computing

6
In other words…

“A computer program is said to learn


from experience (E) with some class of
tasks (T) and a performance measure (P)
if its performance at tasks in T as
measured by P improves with E”

7
ML vs Traditional programming
Traditional Programming

Data
Computer Output
Program

Machine Learning Learning Algorithm

Data
Computer Program
Output
8
Motivating Example
Learning to Filter Spam

Example: Spam Filtering


Spam - is all email the user does not
want to receive and has not asked to
receive
T: Identify Spam Emails
P:
% of spam emails that were filtered
% of ham/ (non-spam) emails that
were incorrectly filtered-out
E: a database of emails that were
labelled by users 9
Terminology
• Features
– The number of features or distinct traits that can be used to describe
each item in a quantitative manner.
• Samples
– A sample is an item to process (e.g. classify). It can be a document, a
picture, a sound, a video, a row in database or CSV file, or whatever you
can describe with a fixed set of quantitative traits.
• Feature vector
– is an n-dimensional vector of numerical features that represent some
object.
• Feature extraction
– Preparation of feature vector
– transforms the data in the high-dimensional space to a space of
fewer dimensions.
• Training/Evolution set
– Set of data to discover potentially predictive relationships. 10
The Learning Process

Model Model
Learning Testin
g

11
The Learning Process in our Example

Model Model
Learning Testin
g

● Number of recipients
● Size of message
● Number of attachments
● Number of "re's" in the
subject line
Email Server …
12
Data Set
Target
Input Attributes
Attribute

Email Type Customer Country Email Number of


Type (IP) Length (K) new
Recipients
Ham Gold Germany 2 0
Ham Silver Germany 4 1
Spam Bronze Nigeria 2 5
Instances

Spam Bronze Russia 4 2


Ham Bronze Germany 4 3
Ham Silver USA 1 0
Spam Silver USA 2 4

Numeric Nominal Ordinal 13


Model Learning

Learner Classifier
Database
Inducer Classification Model
Training Set
Induction Algorithm

14
Model Testing

Database Learner
Training Set Inducer
Classifier
Induction Algorithm
Classification Model

15
Workflow

16
Categories

• Supervised Learning

• Unsupervised Learning

• Reinforcement Learning

• Semi-Supervised Learning

• Self-supervised learning

• Bayesian learning
17
Use-Cases
• Spam Email Detection (Classification)
• Image Search (Similarity/Classification)
• Clustering (KMeans) : Amazon
Recommendations
• Autonomous driving/flying : Reinforcement
learning

continued…
18
Supervised Learning (Classification)
• the correct classes (labels) of the training data
are known

Credit: http://us.hudson.com/legal/blog/postid/513/predictive-analytics-artificial-intelligence-science-fiction-e-discovery-truth 19
Supervised learning examples

• A Bank may have borrower details (age,


income, gender, etc.) of the past (features)
• Also it may have details of the borrowers
who defaulted in the past (labels)
• Based on the above, can train a classifier
to learn the patterns of borrowers who are
likely to default on their payments
20
Supervised learning

• Used when the dataset has classes/labels

• Includes a ‘training’ phase with the dataset and a


‘testing’ phase to validate the accuracy of the
classifier
• Algorithms – Regression, Support Vector Machines,
Neural Networks, Convolutional Neural Networks,
Decision Trees, Logistic Regression, Random Forest,
Naïve Bayesian, etc. 21
Supervised learning
• Regression – Predict continuous variables (salary,
rent)
• Binary classification (facial recognition, whether
a tumor is benign or malignant)
• Multi-class classification (the type of a vehicle,
the stage of progression of a cancer – level 1,2,3)

22
Linear regression
“Predictor”:
40
Evaluate line:
Target y

return r
20

0
0 10 20
Feature x

• Define form of function f(x) explicitly


• Find a good f(x) within that family
23
Unsupervised learning

• Used when the dataset does not have the labels


(classes)
• Used to group/cluster the data into clusters,
which may then be used for decision making,
making recommendations, classification, etc.
• Algorithms – K-means, Self Organizing Maps,
Deep belief Networks, etc. 24
Unsupervised Learning/Clustering
• The correct classes of the training data are not known

Credit: http://us.hudson.com/legal/blog/postid/513/predictive-analytics-artificial-intelligence-science-fiction-e-discovery-truth 25
Unsupervised learning examples

• A Supermarket may store each buyer’s


basket content details (features)
• There are NO grouping (labels)

• Need to group the buyers based on


their buying patterns in order to best
use the shelf space (recommendation)
26
Unsupervised learning/Clustering
• K-means clustering
• Self organizing maps
• Deep Belief Networks

27
K-means clustering example

28
Reinforcement Learning
• Allows the machine or software agent to learn its behavior
based on feedback from the environment.
• This behavior can be learnt once and for all, or keep on
adapting as time goes by.

Credit: http://us.hudson.com/legal/blog/postid/513/predictive-analytics-artificial-intelligence-science-fiction-e-discovery-truth 29
Reinforcement learning

• Can be used when there’s no data available

• A reward function is used to measure the reward for a given


action
• Based on the reward values, a probability distribution can be
obtained for a given set of functions
• This can continued over time and also can be deployed in
both single/multi-agent systems
• Algorithms – Actor Critic learning, Q learning, Monte-carlo
30
methods, etc.
Reinforcement learning examples
• A group of robots have been deployed in an unknown
territory
• The objective is for them to collaboratively find the
navigation path to reach a particular destination/goal
• Can use reinforcement learning where achieving the
goal/getting closer to the goal gives a positive reward.
Negative reward otherwise
• Can share the information among robots (multi-agent
system) 31
Semi-Supervised Learning
• A Mix of Supervised and Unsupervised learning

Credit: http://us.hudson.com/legal/blog/postid/513/predictive-analytics-artificial-intelligence-science-fiction-e-discovery-truth 32
Semi-supervised learning

• Labeled data is expensive/difficult to get

• Unlabeled data is cheap/easier to get

• The idea is to use smaller amount of labelled


data with larger amount of unlabeled data to
creating the training/testing datasets
• Algorithms - Self Training, Generative models

Semi-Supervised Support Vector Machines,


etc.
33
Semi-supervised learning applications

• Web page classification


• Speech to text conversion
• Video/image generation

34
Bayesian learning

• Naïve basian, Multinomial bayesian, Bayesian


networks, Hidden markov model
• Applications: Sentiment analysis, medical
diagnosis
• Needs some initial knowledge
35
Dimensionality Reduction
• Too many attributes!!!
• Which attributes to choose for the feature
vector?
• 3D picture –> 2D Image
• Dimensionality Reduction
• Principal Component Analysis (PCA) is a
commonly used technique

36
Deep Learning
• ML vs DL

37
Dimensionality Reduction - Challenges

While dimensionality reduction is an important tool in machine


learning/data mining, we must always be aware that it can distort
the data in misleading ways.

Above is a two dimensional projection of an intrinsically three


dimensional world…. 38
Original photographer unknown
See also www.cs.gmu.edu/~jessica/DimReducDanger.htm (c) eamonn keogh 39
Ensemble Learning
• Often, multiple classifiers need to be
combined to solve a real-world problem.

40
Machine learning on Big Data and GPGPU computing

• Use large unstructured data sets for learning


(Call records, Social media data, etc.)
• Two main approaches
• Use a Big Data Platform (e.g. Apache Hadoop,
Apache Spark)
• Use a Cloud based Big Data Analytics platform
(Amazon AWS Services, Microsoft Azure ML)
• GPUs to speed up the learning (particularly in
Deep learning)
41
Things to consider in Selecting a ML Algorithm
• If there’s an algorithmic way instead of ML, use it!!! (ML is
messy)
• Refer the literature!!!
• Try different ML algorithms (no single algorithm is the best)
• Check the dataset against the usage/strength of each algorithm
(e.g. RNNs, ARIMA is good in time-series predictions)
• Be mindful of ‘external factors’ (e.g. seasonal effects, RL if you
don’t have data, Clustering if you have unlabeled data, etc.)
• Test your algorithm(s) with test data and select the best
performing one for production (include the test results in your
thesis/publications)
• No algorithm will be perfect! (There will be an error. The
objective is to keep the error at an acceptable rate)
42
Popular Frameworks/Tools
• Scikit-learn - Python (Anaconda Python Distribution)
• R (R studio)
• Matlab/Octave (can export DLLs)
• Weka (Java based)
• Java OpenNLP/Python NLTK (Natural language processing +
ML)
• Apache Spark (part of the Apache Hadoop platform)
• Google Tensorflow (Python library for Deep neural networks)
• Apache Keras (Python library of neural networks)
• Theano (Python library for Multicore processing of DNNs)
• Amazon AWS Services/Microsoft Azure ML (Cloud based ML)

43
Commonly used python libraries
• NumPy
- Matrix algebra
• Pandas
- Data Frames, Series
• Matpotlib
- Visualization

44
GPT

• https://dida.do/blog/chatgpt-reinforcement-le
arning

• https://arxiv.org/pdf/2203.02155.pdf

45
Resources
• Coursera – Andrew Ng. Machine Learning
• Udacity – Intro to Machine Learning,
Reinforcement Learning
• Python Machine Learning – Sebastian Raschka
• Advance Machine Learning with Python – John
Hearty
• Machine Learning – Tom Mitchell
• Many more!!!

46
Resources
• Python
• https://www.youtube.com/watch?v=LHBE6Q9
XlzI&t=81s
• https://www.youtube.com/watch?v=r-uOLxNr
Nk8

• Mathematics
• https://www.youtube.com/watch?v=0z6AhrO
SrRs
47
Textbooks
• Pattern Recognition and Machine Lea
rning - Bishop
• Machine Learning – A probabilistic perspectiv
e – Murphy
• Deep Learning – Ian Goodfellow
• Elements of Statistical Learning – Hastie
• Reinforcement Learning – An Introduction – S
utton
-
http://incompleteideas.net/book/RLbook2020
.pdf 48
Questions ?

49

You might also like