Day 2 Part 1
Day 2 Part 1
Jan, 2024
Machine Learning Fundamentals
Jan, 2024
MACHINE
LEARNING
FUNDAMENTALS
B1M2L1T1
Jan, 2024 3
Overview of
Machine Learning
Machine Learning Introduction
01
Supervised Learning
02
Unsupervised Learning
03
Jan, 2024 4
Machine
Learning (ML)
• ML is a branch of artificial intelligence:
• Uses computing based systems to
make sense out of data
• Extracting patterns, fitting data to
functions, classifying data, etc
• ML systems can learn and improve
• With historical data, time and
experience
• Bridges theoretical computer science
and real noise data.
Jan, 2024 5
PREAMBLE
• We are in the midst of what is popularly
called the information revolution—a
revolution which was born shortly after
the end of World War II.
• The new world was the world of
machine intelligence and automated
reasoning
• It was widely believed that there were
no limits to what machines could do
• The era of thinking machines has
arrived
Jan, 2024 6
INTERNET SMART CAMERAS
WORLD WIDE WEB SMART APPLIANCES
WIRELESS TELEPHONY SMART CARS
FAX SMART ELEVATORS
DIGITAL LIBRARIES SMART ROBOTS
DATA MINING INTELLIGENT
MANUFACTURING INFORMATION
INFORMATION RETRIEVAL EXPERT SYSTEMS
REVOLUTION
SMART SEARCH ENGINES SMART QUALITY CONTROL
Jan, 2024 7
Machine
Learning: A
Definition
• 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.
Jan, 2024 8
Machine
Learning: A
Definition
• 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.
• Idea: Synthesize computer programs by
learning from representative examples of input
(and output) data
• Rationale:
1. For many problems, there is no known
method for computing the desired output
from a set of inputs.
2. For other problems, computation according
to the known correct method may be too
expensive.
Jan, 2024 9
What Is Machine Learning?
“Logic is not the end of wisdom, it is just the beginning” --- Spock
same time
Environment Environment
System System
Action Action
1 2
Knowledge Knowledge
changed
Jan, 2024 10
What is Machine Learning?
1. It is very hard to write programs that solve problems like
recognizing a face.
• We don’t know what program to write because we don’t
know how our brain does it.
• Even if we had a good idea about how to do it, the program
might be horrendously complicated.
2. Instead of writing a program by hand, we collect lots of
examples that specify the correct output for a given input.
3. A machine learning algorithm then takes these examples and
produces a program that does the job.
• The program produced by the learning algorithm may look
very different from a typical hand-written program. It may
contain millions of numbers.
• If we do it right, the program works for new cases as well as
the ones we trained it on.
Jan, 2024 11
Some more examples of tasks that are best
solved by using a learning algorithm
1. Recognizing patterns:
• Facial identities or facial expressions
• Handwritten or spoken words
• Medical images
2. Generating patterns:
• Generating images or motion sequences
3. Recognizing anomalies:
• Unusual sequences of credit card transactions
• Unusual patterns of sensor readings in a nuclear power plant or
unusual sound in your car engine.
4. Prediction:
• Future stock prices or currency exchange rates
Jan, 2024 12
Some web-based examples of machine
learning
1. The web contains a lot of data. Tasks with very big
datasets often use machine learning
• especially if the data is noisy or non-stationary.
2. Spam filtering, fraud detection:
• The enemy adapts so we must adapt too.
3. Recommendation systems:
• Lots of noisy data. Million dollar prize!
4. Information retrieval:
• Find documents or images with similar content.
5. Data Visualization:
• Display a huge database in a revealing way
Jan, 2024 13
Why is Machine Learning
Important?
Some tasks cannot be defined well, except by examples (e.g., recognizing people).
Relationships and correlations can be hidden within large amounts of data. Machine Learning/Data
Mining may be able to find these relationships.
Human designers often produce machines that do not work as well as desired in the environments in
which they are used.
The amount of knowledge available about certain tasks might be too large for explicit encoding by
humans (e.g., medical diagnostic).
New knowledge about tasks is constantly being discovered by humans. It may be difficult to continuously
re-design systems “by hand”.
Jan, 2024 14
Areas of Influence for
Machine Learning
1. Statistics: How best to use samples drawn from unknown
probability distributions to help decide from which distribution
some new sample is drawn?
2. Brain Models: Non-linear elements with weighted inputs
(Artificial Neural Networks) have been suggested as simple
models of biological neurons.
3. Adaptive Control Theory: How to control a process with
unknown parameters that must be estimated during operation?
4. Psychology: How to model human performance on various
learning tasks?
5. Artificial Intelligence: How to write algorithms to acquire the
knowledge humans can acquire, at least, as well as humans?
6. Evolutionary Models: How to model certain aspects of biological
evolution to improve the performance of computer programs?
Jan, 2024 15
Designing a Learning System
• In designing a learning system, we have to deal with
(at least) the following issues:
1. Training experience
2. Target function
3. Learned function
4. Learning algorithm
Training Experience
Issues concerning the training experience:
1. Direct or indirect evidence (supervised or unsupervised).
2. Controlled or uncontrolled sequence of training examples.
3. Representatively of training data in relation to test data.
Jan, 2024 16
Target Function and Learned Function
• The problem of improving performance can often be
reduced to the problem of learning some particular target
function.
• In many cases we can only hope to acquire some
approximation to the ideal target function.
Learning Algorithm
In order to learn the (approximated) target function we require:
1. A set of training examples (input arguments)
2. A rule for estimating the value corresponding to each
training example (if this is not directly available)
3. An algorithm for choosing the function that best fits the
training data
Jan, 2024 17
Types of Machine Learning
Jan, 2024 18
In other words the Types of Machine
Learning may be as follows:
• Supervised Learning
– Classification(pattern recognition)
– Regression
• Unsupervised Learning
• Reinforcement Learning
Jan, 2024 19
Learning Types
Jan, 2024 20
Supervised Learning
Jan, 2024 21
Supervised Learning
Jan, 2024 22
Jan, 2024 23
Nominal scale is a naming scale, where variables are simply “named” or labeled, with no specific order.
Jan, 2024 24
Ordinal scale has all its variables in a specific order, beyond just naming them.
Jan, 2024 25
Jan, 2024 26
Jan, 2024 27
Jan, 2024 28
Jan, 2024 29
Jan, 2024 30
Jan, 2024 31
Jan, 2024 32
Jan, 2024 33
Jan, 2024 34
Jan, 2024 35
Jan, 2024 36
Jan, 2024 37
Jan, 2024 38
Jan, 2024 39
Day 2 - Ungraded Quiz
https://forms.office.com/pages/responsepage.aspx?id=BfhDwM4AVk-
HcLw0aPE62rzdPSuGcfdFii_74E63SrpUMlFSODQyWjZYSzBWVzVRRkVVR0o
wV0ZCTiQlQCN0PWcu
Jan, 2024 40
Introduction to simple linear regression
Jan, 2024 41
EXAMPLES
Jan, 2024 42
Bivariate or simple regression model
(Education) x y y (Income)
(Income)
(Education) x1
(Gender) x2
y (Income)
(Experience) x3
(Age) x4
Model with simultaneous relationship
Price of wheat Quantity of wheat produced
Jan, 2024 43
Bivariate or simple regression model
The model has two variables, the independent or explanatory variable, x, and the dependent variable y, the variable whose
variation is to be explained.
The relationship between x and y is a linear or straight line relationship.
Two parameters to estimate – the slope of the line β1 and the y-intercept β0 (where the line crosses the vertical axis).
ε is the unexplained, random, or error component. Much more on this later.
Jan, 2024 44
REGRESSION LINE
Jan, 2024 45
USES OF REGRESSION
Jan, 2024 46
REGRESSION EXAMPLE - DATASET
R2 = 0.311
Significance = 0.0031
Jan, 2024 48
Jan, 2024
Dataset and Code
https://colab.research.google.com/drive/1OtmxBWhCg7FRbdEvGTOLmKEI26A5R19O#scrollTo=YkaPT7YDquMj
Jan, 2024 50
Day 2 - Quiz and Discussion:
https://docs.google.com/presentation/d/1EMFNtric6c64CxXSx2DoS3TtTShxRdLj/edit?usp=sha
re_link&ouid=113983923138295569548&rtpof=true&sd=true
Homework:
https://drive.google.com/file/d/1w6RHTn5fMMA6QFdkxXIAlmQPd8_xal1J/view?usp=sharing
Jan, 2024 51
THANK YOU
Jan, 2024