FML CSOE-007 FML B Tech 6th Sem OE Till 9th Feb 2024
FML CSOE-007 FML B Tech 6th Sem OE Till 9th Feb 2024
FML CSOE-007 FML B Tech 6th Sem OE Till 9th Feb 2024
Machine Learning
By
Renu Dhir
Department of Computer Science & Engineering
NIT Jalandhar
What is Learning?
Herbert Simon: “Learning is any process by
which a system improves performance from
experience.”
What is the task?
» Classification
» Problem solving / planning / control
Webster's ddefinition of “to learn”
“To gain knowledge or understanding of, or skill in
by study, instruction or experience''
• Learning a set of new facts
• Learning HOW to do something
• Improving ability of something already
learned
What is Machine Learning
Machine Intelligence
Computer Intelligence
Artificial Intelligence
It is the outward characteristics of a system that qualify
it to be classified as being intelligent-
for example,
expertise,
ability to satisfactorily deal with unexpected and
unfamiliar situations
and ability to reason, deduce, and infer from
incomplete information
Simon's definition of “machine learning”
``Learning denotes changes in the system that are
adaptive in the sense that they enable the system to
do the same task or tasks drawn from the same
population more effectively the next time''
What is Machine Learning?
Optimize a performance criterion using
example data or past experience.
Role of Statistics: Inference from a sample
Role of Computer science: Efficient
algorithms to
» Solve the optimization problem
» Representing and evaluating the model for
inference
Why “Learn” ?
1950s
» Samuel’s checker player
» Selfridge’s Pandemonium
1960s:
» Neural networks: Perceptron
» Pattern recognition
» Learning in the limit theory
» Minsky and Papert prove limitations of Perceptron
1970s:
» Symbolic concept induction
» Winston’s arch learner
» Expert systems and the knowledge acquisition bottleneck
» Quinlan’s ID3
» Michalski’s AQ and soybean diagnosis
» Scientific discovery with BACON
» Mathematical discovery with AM
History of Machine Learning (cont.)
1980s:
» Advanced decision tree and rule learning
» Explanation-based Learning (EBL)
» Learning and planning and problem solving
» Utility problem
» Analogy
» Cognitive architectures
» Resurgence of neural networks (connectionism, backpropagation)
» Valiant’s PAC Learning Theory
» Focus on experimental methodology
1990s
» Data mining
» Adaptive software agents and web applications
» Text learning
» Reinforcement learning (RL)
» Inductive Logic Programming (ILP)
» Ensembles: Bagging, Boosting, and Stacking
» Bayes Net learning
History of Machine Learning (cont.)
2000s
» Support vector machines
» Kernel methods
» Graphical models
» Statistical relational learning
» Transfer learning
» Sequence labeling
» Collective classification and structured outputs
» Computer Systems Applications
• Compilers
• Debugging
• Graphics
• Security (intrusion, virus, and worm detection)
» E mail management
» Personalized assistants that learn
» Learning in robotics and vision
Foundations of AI & ML
Computer
Science &
Engineering
Mathematics Philosophy
Philosophy
» At that time, the study of human
intelligence began with no
formal expression
» Initiate the idea of mind as a
machine and its internal
operations
24
The Foundation of AI
Mathematics formalizes the three main
area of AI: computation, logic, and
probability
Computation leads to analysis of the
problems that can be computed
Complexity theory
Probability contributes the “degree of
belief” to handle uncertainty in AI
Decision theory combines probability
theory and utility theory (bias)
25
The Foundation of AI
Psychology
» How do humans think and act?
» The study of human reasoning and
acting
» Provides reasoning models for AI
» Strengthen the ideas
• humans and other animals can be
considered as information
processing machines
26
The Foundation of AI
Computer Engineering
» How to build an efficient computer?
» Provides the artifact that makes AI
application possible
» The power of computer makes
computation of large and difficult
problems more easily
» AI has also contributed its own work
to computer science, including:
time-sharing, the linked list data type,
OOP, etc. 27
The Foundation of AI
Control theory and Cybernetics
» How can artifacts operate under their own
control?
» The artifacts adjust their actions
• To do better for the environment over
time
• Based on an objective function and
feedback from the environment
» Not limited only to linear systems but also
other problems
• as language, vision, and planning, etc.
28
The Foundation of AI
Linguistics
» For understanding natural
languages
• different approaches has been
adopted from the linguistic work
» Formal languages
» Syntactic and semantic analysis
» Knowledge representation
29
Areas of Influence for Machine
Learning
Statistics: How best to use samples drawn from
unknown probability distributions to help decide
from which distribution some new sample is
drawn?
Brain Models: Non-linear elements with weighted
inputs (ANNs) have been suggested as simple
models of biological neurons.
Adaptive Control Theory: How to deal with
controlling a process having unknown
parameters that must be estimated during
operation?
Areas of Influence for Machine
Learning
• Psychology: How to model human performance on
various learning tasks?
• Artificial Intelligence: How to write algorithms to
acquire the knowledge humans are able to acquire,
at least, as well as humans?
• Evolutionary Models: How to model certain aspects
of biological evolution to improve the performance
of computer programs?
How to Achieve AI & ML?
Acting
humanly
Acting
rationally
32
Acting humanly: Turing Test
Turing (1950) "Computing machinery and
intelligence":
“Can machines think?” “Can machines behave
intelligently?”
Predicted that by 2000, a machine might have a 30%
chance of fooling a lay person for 5 minutes
Anticipated all major arguments against AI in
following 50 years
Suggested major components of AI: knowledge,
reasoning, language understanding, learning
Capabilities
» Natural language processing
» Knowledge representation
» Automated reasoning
» Machine learning
» Computer vision
» robotics 33
Turing Test
Alan Turing
1912-1954
36
The Turing Test - Example
37
The Turing Test - Example
38
The Turing Test - Example
39
The Turing Test - Example
40
Acting Humanly
To pass the Turing test, the computer/robot
needs:
» Natural language processing to communicate
successfully.
» Knowledge representation to store what it knows or
hears.
» Automated reasoning to answer questions and draw
conclusions using stored information.
» Machine learning to adapt to new circumstances
and to detect and extrapolate patterns.
41
Thinking Humanly
Real intelligence requires thinking think
like a human !
First, we should know how a human think
» Introspect ones thoughts
» Physiological experiment to understand how
someone thinks
» Brain imaging – MRI…
Then, we can build programs and models
that think like humans
» Resulted in the field of cognitive
science: a merger between AI and
Psychology. 42
Thinking humanly: cognitive modeling
1960s "cognitive revolution":
information-processing psychology
Requires scientific theories of internal
activities of the brain
How to validate? Requires
» Predicting and testing behavior of
human subjects (top-down)
» Direct identification from
neurological data (bottom-up)
Both approaches (roughly, Cognitive
Science and Cognitive Neuroscience)
are now distinct from AI
43
Problems with Imitating Humans
47
Acting Rationally
Rational agent: acts as to achieve the best
outcome
Logical thinking is only one aspect of
appropriate behavior: reactions like getting
your hand out of a hot place is not the result of a
careful deliberation, yet it is clearly rational.
Sometimes there is no correct way to do, yet
something must be done.
Instead of insisting on how the program should
think, we insist on how the program should act:
we care only about the final result.
Advantages:
» more general than “thinking rationally” and more
» Mathematically principled; proven to achieve
rationality unlike human behavior or thought
48
Acting Rationally: Rational agent
Rational behavior: doing the right thing
The right thing: which is expected to maximize goal
achievement, given the available information
The rational-agent approach has two advantages
» It’s more general than the “laws of thought”
because correct inference is just one of several
possible mechanisms for achieving rationality
» Second , it’s more amendable to scientific
development than approaches based on human
behavior or human thought.
One point to keep in mind: we will see before too long
that achieving perfect rationality is not feasible in
complicated environments
49
What is AI & ML?
“Acting Rationally"
50
What is Artificial Intelligence & ML ?
HUMAN RATIONAL
51
Disciplines which form the core of AI-inner circle
Fields which draw from these disciplines-outer circle.
Computer vision
Computer is a field of
vision is a computer science
field of that focuses on
AI that enabling
trains computers to
computers identify and
to capture understand
and objects and people
interpret in images and
informatio videos. Like other
n from types of AI,
image and computer vision
video data. seeks to perform
and automate
tasks that replicate
human
capabilities.
52
With each passing day and gradually as we move into future,
Basket analysis:
P (Y | X ) probability that somebody who buys X also buys
Y where X and Y are products/services.
Example: P ( chips | beer ) = 0.7
Is it good recommendation by AI & ML or not?
KBS ( Knowledge based systems)
Not suited for real world Suitable for real world problems.
problems for which ideal model is
not present.
It requires full truth Can work with partial truth
E bB
B
Classification
Example: Credit
scoring
Differentiating
between low-risk
and high-risk
customers from
their income and
savings
Test images
Classification
Classification: Different Step Process
1. Model construction (Learning):Each record (instance) is
assumed to belong to a predefined class, as determined
by one of the attributes, called the class label
2. The set of all records used for construction of the
model is called training set. The model is usually
represented in the form of classification rules,
3. (IF-THEN statements) or decision trees.
4. Model Evaluation (Accuracy):
5. Estimate accuracy rate of the model based on a test set.
The known label of test sample is compared with the
classified result from model.
Accuracy rate: percentage of test set samples correctly
classified by the model.
Test set is independent of training set otherwise over-
fitting will occur. Model Use (Classification):
The model is used to classify unseen instances (assigning
class labels)Predict the value of an actual attribute
How to Classify? How do humans classify items?
wi wi c fi error (b)
LMS Discussion
Intuitively, LMS executes the following rules:
» If the output for an example is correct, make no
change.
» If the output is too high, lower the weights
proportional to the values of their corresponding
features, so the overall output decreases
» If the output is too low, increase the weights
proportional to the values of their corresponding
features, so the overall output increases.
Under the proper weak assumptions, LMS can be
proven to eventetually converge to a set of weights
that minimizes the mean squared error.
The Formula for Sigmoid Function
Cost function of linear regression is root mean squared error or also known as
mean squared error (MSE).
MSE measures the average squared difference between an observation’s actual
and predicted values.
The cost will be outputted as a single number which is associated with our current
set of weights.
The reason we use Cost Function is to improve the accuracy of the model;
minimising MSE does this.
Logistic Regression
The Cost Function of a Logistic Regression cannot use MSE because our prediction
function is non-linear (due to sigmoid transform).
Therefore we use a cost function called Cross-Entropy, also known as Log Loss.
Cross-entropy measures the difference between two probability distributions for a
given random variable or set of events.
Type of Logistic Regression
On the basis of the categories, Logistic Regression
can be classified into three types:
Binomial:
In binomial Logistic regression, there can be only
two possible types of the dependent variables,
such as 0 or 1, Pass or Fail, etc.
Multinomial:
In multinomial Logistic regression, there can be 3
or more possible unordered types of the
dependent variable, such as "cat", "dogs", or
"sheep"
Ordinal: In ordinal Logistic regression, there can
be 3 or more possible ordered types of dependent
variables, such as "low", "Medium", or "High".
Linear and Non linear Regression
Linear Regression Logistic Regression
Used to predict the continuous dependent Used to predict the categorical dependent
variable using a given set of independent variable using a given set of independent
variables. variables.
The outputs produced must be a continuous The outputs produced must be Categorical
value, such as price and age. values such as 0 or 1, Yes or No.
The relationship between the dependent The relationship DOES NOT need to be
variable and independent variable must be linear between the dependent and
linear. independent variables.
Used for solving Regression problems. Used for solving Classification problems.
We are finding and using the line of best fit We are using the S-curve (Sigmoid) to help
to help us easily predict outputs. us classify predicted outputs.
Least square estimation method is used for Maximum likelihood estimation method is
the estimation of accuracy. used for the estimation of accuracy.