Machine Learning
CONTENTS
• Introduction to Machine learning
• Types of Machine Learning
• Models selection and generalization
• Machine Learning concept work flow
• Applications
Introduction to Machine learning
What is Learning?
• Herbert Simon: “Learning is any process by
which a system improves performance from
experience.”
• What is the task?
oClassification
oCategorization/clustering
oProblem solving / planning / control
oPrediction
oothers
4
Why Study Machine Learning?
Developing Better Computing Systems
• Develop systems that are too difficult/expensive to
construct manually because they require specific
detailed skills or knowledge tuned to a specific task
(knowledge engineering bottleneck).
• Develop systems that can automatically adapt
and customize themselves to individual users.
oPersonalized news or mail
filter oPersonalized tutoring
• Discover new knowledge from large
databases (data mining).
oMarket basket analysis (e.g. diapers and beer)
oMedical text mining (e.g. migraines to calcium
channel blockers to magnesium)
5
Related Disciplines
• Artificial Intelligence
• Data Mining
• Probability and Statistics
• Information theory
• Numerical optimization
• Computational complexity theory
• Control theory (adaptive)
• Psychology (developmental, cognitive)
• Neurobiology and many more
6
Traditional Programming
Data
Computer Output
Program
Machine Learning
Data
Computer Program
Output
Human Learning
• It is a process of gaining information
through observation, to solve/deal with real
world scenarios.
• Human learning happens in one of the
three ways:
oAn expert in the subject directly teaches us
oWe build our own notion indirectly based
on what we have learnt in the past
oWe learn ourselves, may be after
multiple attempts.
Types of Human Learning
• Learning under expert guidance
• Learning guided by knowledge gained
from experts
• Learning by self
MACHINE LEARNING
A computer program is said to learn
from experience ‘E’ with respect to
some class of tasks ‘T’ and
performance measure ‘P’, if its
performance at tasks in ‘T’, as
measured by ‘P’, improves with
experience ‘E’.
- Tom M. Mitchell
History of Machine Learning
• 1950s
oSamuel’s checker player
oSelfridge’s Pandemonium
• 1960s:
oNeural networks: Perceptron
oPattern recognition
oLearning in the limit theory
oMinsky and Papert prove limitations of Perceptron
• 1970s:
oSymbolic concept induction
oWinston’s arch learner
oExpert systems and the knowledge acquisition bottleneck
oQuinlan’s ID3
oMichalski’s AQ and soybean diagnosis
History of Machine Learning (cont.)
• 1980s:
oAdvanced decision tree and rule learning
oExplanation-based Learning (EBL)
oLearning and planning and problem solving
oUtility problem, Analogy
oCognitive architectures
oResurgence of neural networks (connectionism, backpropagation)
• 1990s
oData mining
oAdaptive software agents and web applications
oText learning
oReinforcement learning (RL)
oInductive Logic Programming (ILP)
oEnsembles: Bagging, Boosting, and Stacking
oBayes Net learning
TYPES of MACHINE LEARNING
Types of Machine Learning
• Supervised learning: A machine predicts the class
of unknown objects based on prior class-related
information of similar objects. Also called predictive
learning.
• Unsupervised/clustering learning: A machine finds
patterns in unknown objects by grouping similar
objects together. Also called descriptive learning.
• Reinforcement learning: A machine learns to act on its
own to achieve the given goals.
SUPERVISED LEARNING
• The major motivation of supervised learning is to
learn from past information.
• But how do machine learns?
o By TRAINING DATA using labels.
What’s this?
Apple
Banana
It’s an Apple
Examples of Supervised Learning
• Predicting the results of a game.
• Predicting a tumour is malignant or benign.
• Predicting the piece of domains like real estate, stocks,
etc.
• Classify texts such as classifying a set of emails as
spam or non-spam.
Classification & Regression
• When we are trying to predict a categorical
or nominal variable, the problem is known as
a classification problem.
oEx: Identify Cat or Dog
• When we are trying to predict a real-valued variable,
the problem falls under the category of regression.
oEx: Predict the value of a property.
Unsupervised Learning
• Unsupervised learning(USL) is a type of self-organized
learning that helps find previously unknown patterns
in data set without pre-existing labels.
• The objective is to take a dataset as input and try
to find natural grouping or patterns within the data
elements or records.
• Hence, USL is termed as Descriptive Model and the
process of USL is called Pattern or Knowledge
Discovery.
• In unsupervised learning, the system is presented with
unlabeled, uncategorized data and the system’s
algorithms act on the data without prior training. The
output is dependent upon the coded algorithms.
Unsupervised Learning
• Clustering is the main type of Unsupervised Learning.
• Clustering groups similar objects together.
Input Data Cluster by type Cluster by color
Sample Clustering
Unsupervised Learning
Unsupervised Learning Example: Categorize Cats and Dogs
Reinforcement Learning
• It is about taking suitable action to
maximize reward in a particular situation.
• It is employed by various software and machines
to find the best possible behavior or path it
should take in a specific situation.
• Close to human learning.
Cont’d
• Algorithm learns a policy of how to act in a
given environment.
• Every action has some impact in the environment,
and the environment provides rewards that
guides the learning algorithm.
Reinforcement Learning
Different Varieties of Machine Learning
• Concept Learning
• Clustering Algorithms
• Connectionist Algorithms
• Genetic Algorithms
• Explanation-based and Transformation-based Learning
• Reinforcement and Case-based Learning
• Macro Learning
• Evaluation Functions
• Cognitive Learning Architectures
• Constructive Induction
• Discovery Systems
Languages or Tools for Machine Learning
• Python – Open source programming language adopted for
machine learning.
• R – Open source software. Used for statistical computing and data analysis
• Matlab - Developed by MathWorks. Licensed version. Used for variety
of applications.
• SAS – Statistical Analysis System, was developed and licensed by
SAS Institute provides strong support for ML.
• Others-
oSPSS(Statistical Package for the Social Sciences) – IBM
oJulia – MIT(Massachusetts Institute of Technology)
History of Machine Learning (cont.)
• 2000s
oSupport vector machines
oKernel & Graphical models
oStatistical relational and Transfer
learning oSequence labeling
oCollective classification and structured
outputs oComputer Systems Applications
➢
Compilers
➢
Debugging
➢
Graphics
➢
Security (intrusion, virus, and worm detection)
oE-mail management
oPersonalized assistants that learn
oLearning in robotics and vision
MODEL SELECTION and GENERALIZATION
How do Machines Learn?
Data Abstraction Generalization Input
1. Data Input: Past data or information is utilized as
a basis for future decision-making
2. Abstraction: The input data is represented in a
broader way through the underlying algorithm.
3. Generalization: The abstracted representation is
generalized to form a framework for making
decisions.
Abstraction
• The data, given as input, cannot be used in the
original shape and form.
• Abstraction helps in deriving a conceptual map
based on the input data.
• The model may be in any one of forms:
oComputational blocks like if/else
rules oMathematical equations
oSpecific data structures like trees or graphs
oLogical groupings of similar observations
Abstraction Cont’d
• The choice of the model is human specific.
• Selection of model is based on:
oThe type of problem to be solved.
oNature of the input data.
oDomain of the problem.
Generalization
• Generalization is used for taking the decisions
after training the model.
• The model is trained for a limited set of data. If we want to
apply the model to take decision on a set of unknown
data, we may encounter following problems:
oThe trained model is aligned with training data too
much, hence may not represent the actual trend.
oThe test data possess certain characteristics apparently
unknown to the training data.
Well-posed learning problem
• A framework can be designed for deciding whether
a problem can be solved using ML. The framework
should answer:
oWhat is the problem?
oWhy does the problem need to be solved?
oHow to solve the problem?
Designing a Learning System
• Choose the training experience
• Choose exactly what is too be learned, i.e.
the target function.
• Choose how to represent the target function.
• Choose a learning algorithm to infer the
target function from the experience.
Learner
Environment/
Knowledge
Experience
Performance
Element
The Machine Learning Workflow
ML WorkFlow
ML WorkFlow
We can define the machine learning workflow in 3 stages.
1. Gathering data
2. Data pre-processing
3. Researching the model that will be best for the type of data
4. Training and testing the model
5. Evaluation
Gathering Data
• The process of gathering data depends on the type of project we desire to
make, if we want to make an ML project that uses real-time data, then we
can build an IoT system that using different sensors data. The data set can
be collected from various sources such as a file, database, sensor and
many other such sources but the collected data cannot be used directly for
performing the analysis process as there might be a lot of missing data,
extremely large values, unorganized text data or noisy data. Therefore, to
solve this problem Data Preparation is done.
• We can also use some free data sets which are present on the internet.
Kaggle and UCI Machine learning Repository are the repositories that
are used the most for making Machine learning models. Kaggle is one of
the most visited websites that is used for practicing machine learning
algorithms, they also host competitions in which people can participate
and get to test their knowledge of machine learning.
Data pre-processing
• Data pre-processing is one of the most important steps in machine
learning. It is the most important step that helps in building machine
learning models more accurately. In machine learning, there is an 80/20
rule. Every data scientist should spend 80% time for data pre-processing
and 20% time to actually perform the analysis.
• What is data pre-processing?
• Data pre-processing is a process of cleaning the raw data i.e. the data is
collected in the real world and is converted to a clean data set. In other
words, whenever the data is gathered from different sources it is
collected in a raw format and this data isn’t feasible for the analysis.
Therefore, certain steps are executed to convert the data into a small
clean data set, this part of the process is called as data pre-processing.
• Why do we need it?
• As we know that data pre-processing is a process of cleaning the raw data
into clean data, so that can be used to train the model. So, we definitely
need data pre-processing to achieve good results from the applied model
in machine learning and deep learning projects.
Data pre-processing
• Most of the real-world data is messy, some of these types of data are:
• 1. Missing data: Missing data can be found when it is not continuously
created or due to technical issues in the application (IOT system).
• 2. Noisy data: This type of data is also called outliners, this can occur due
to human errors (human manually gathering the data) or some technical
problem of the device at the time of collection of data.
• 3. Inconsistent data: This type of data might be collected due to human
errors (mistakes with the name or values) or duplication of data.
Three Types of Data
• 1. Numeric e.g. income, age
• 2. Categorical e.g. gender, nationality
• 3. Ordinal e.g. low/medium/high
Data pre-processing
• How can data pre-processing be performed?
These are some of the basic pre — processing techniques that can be used
to convert raw data.
1. Conversion of data: As we know that Machine Learning models can
only handle numeric features, hence categorical and ordinal data must be
somehow converted into numeric features.
2. Ignoring the missing values: Whenever we encounter missing data in
the data set then we can remove the row or column of data depending on
our need. This method is known to be efficient but it shouldn’t be performed
if there are a lot of missing values in the dataset.
3. Filling the missing values: Whenever we encounter missing data in the
data set then we can fill the missing data manually, most commonly the
mean, median or highest frequency value is used.
4. Machine learning: If we have some missing data then we can predict
what data shall be present at the empty position by using the existing data.
5. Outliers detection: There are some error data that might be present in
our data set that deviates drastically from other observations in a data set.
[Example: human weight = 800 Kg; due to mistyping of extra 0]
Researching the model that will be best for the type of data
• Our main goal is to train the best performing model possible, using the pre-
processed data.
Researching the model that will be best for the type of data
APPLICATIONS
Training and testing the model
• For training a model we initially split the model into 3 three sections
which are ‘Training data’ ,‘Validation data’ and ‘Testing data’.
• You train the classifier using ‘training data set’, tune the parameters using
‘validation set’ and then test the performance of your classifier on unseen
‘test data set’. An important point to note is that during training the
classifier only the training and/or validation set is available. The test data
set must not be used during training the classifier. The test set will only be
available during testing the classifier
Training and testing the model
• Training set: The training set is the material through which the computer
learns how to process information. Machine learning uses algorithms to
perform the training part. A set of data used for learning, that is to fit the
parameters of the classifier.
• Validation set: Cross-validation is primarily used in applied machine
learning to estimate the skill of a machine learning model on unseen data.
A set of unseen data is used from the training data to tune the
parameters of a classifier.
• Test set: A set of unseen data used only to assess the performance of
a fully-specified classifier
Once the data is divided into the 3 given segments we can start the training
process.
In a data set, a training set is implemented to build up a model, while a test
(or validation) set is to validate the model built. Data points in the training set
are excluded from the test (validation) set. Usually, a data set is divided into
a training set, a validation set (some people use ‘test set’ instead) in each
iteration, or divided into a training set, a validation set and a test set in each
iteration.
Training and testing the model
SampleApplications
• Web search
• Computational biology
• Finance
• E-commerce
• Space exploration
• Robotics
• Information extraction
• Social networks
• Debugging software
• [Your favorite area]
Supervised Learning Classification
• Example: Cancer diagnosis
Patient ID # of Tumors Avg Area Avg Density Diagnosis
1 5 20 118 Malignant
2 3 15 130 Benign Training
3 7 10 52 Benign Set
4 2 30 100 Malignant
• Use this training set to learn how to classify
patients where diagnosis is not known:
Patient ID # of Tumors Avg Area Avg Density Diagnosis
101 4 16 95 ?
102 9 22 125 ? Test Set
103 1 14 80 ?
Input Data Classification
• The input data is often easily obtained, whereas the
classification is not.
Classification Problem
• Goal: Use training set + some learning method to
produce a predictive model.
• Use this predictive model to classify new data.
• Sample applications:
Application Input Data Classification
Medical Diagnosis Noninvasive tests Results from invasive
measurements
Optical Character Scanned bitmaps Letter A-Z
Recognition
Protein Folding Amino acid construction Protein shape (helices,
loops, sheets)
Research Paper Words in paper title Paper accepted or rejected
Acceptance
Application: Cancer Diagnosis
Cancer Diagnosis Separation
Robotics and ML
Areas that robots are used:
Industrial robots
Military, government and space robots
Service robots for home, healthcare, laboratory
Why are robots used?
Dangerous tasks or in hazardous environments
Repetitive tasks
High precision tasks or those requiring high quality
Labor savings
Control technologies:
Autonomous (self-controlled), tele-operated (remote control)
Industrial Robots
• Uses for robots in manufacturing:
oWelding
oPainting
oCutting
oDispensing
oAssembly
oPolishing/Finishing
oMaterial Handling
➢
Packaging, Palletizing
➢
Machine loading
Space Robots
• Mars Rovers – Spirit and Opportunity
oAutonomous navigation features with
human remote control and oversight
Service Robots
• Many uses…
oCleaning & Housekeeping
oHumanitarian Demining
oRehabilitation
oInspection
oAgriculture & Harvesting
oLawn Mowers
oSurveillance
oMining Applications
oConstruction
oAutomatic Refilling
oFire Fighters
oSearch & Rescue
iRobot Roomba vacuum
cleaner robot
Issues in Machine Learning
• What algorithms can approximate functions well
and when?
oHow does the number of training examples influence accuracy
• Problem representation / feature extraction
• Intention/independent learning
• Integrating learning with systems
• What are the theoretical limits of learnability
• Transfer learning
• Continuous learning
Scaling issues in ML
• Number of
oInputs oOutputs
oBatch vs realtime
oTraining vs testing
Machine Learning VS Human Learning
o Some ML behavior can challenge the performance
of human experts (e.g., playing chess)
o Although ML sometimes matches human learning
capabilities, it is not able to learn as well as
humans or in the same way that humans do
o There is no claim that machine learning can
be applied in a truly creative way
o Formal theories of ML systems exist but are often
lacking (why a method succeeds or fails is not clear)
o ML success is often attributed to manipulation of
symbols (rather than mere numeric information)
END