ML Unit 1 ppt
ML Unit 1 ppt
Course Outcomes:
Understand algorithms for building classifiers applied on datasets of non-linearly separable classes
.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning
Machine learning contains a set of algorithms that work on a huge amount of data. Data is fed to these
algorithms to train them, and on the basis of training, they build the model & perform a specific task.
These ML algorithms help to solve different business problems like Regression, Classification, Forecasting,
Clustering, and Associations, etc.
Based on the methods and way of learning, machine learning is divided into mainly four types, which are:
1. Supervised Machine Learning
2. Unsupervised Machine Learning
3. Semi-Supervised Machine Learning
4. Reinforcement Learning
.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
The main goal of the supervised learning technique is to map the input variable(x)
with the output variable(y). Some real-world applications of supervised learning
are Risk Assessment, Fraud Detection, Spam filtering
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning
Supervised Machine Learning
o Classification
o Regression
a) Classification
Classification algorithms are used to solve the classification problems in which the output variable is
categorical, such as "Yes" or No, Male or Female, Red or Blue, etc. The classification algorithms predict
the categories present in the dataset. Some real-world examples of classification algorithms are Spam
Detection, Email filtering, etc.
Some popular classification algorithms are given below:
o Random Forest Algorithm
o Decision Tree Algorithm
o Logistic Regression Algorithm
o Support Vector Machine Algorithm
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning
Supervised Machine Learning
o Regression
Regression algorithms are used to solve regression problems in which there is a linear relationship
between input and output variables. These are used to predict continuous output variables, such as market
trends, weather prediction, etc.
Some popular Regression algorithms are given below:
Disadvantages:
o These algorithms are not able to solve complex tasks.
o It may predict the wrong output if the test data is different from the training data.
o It requires lots of computational time to train the algorithm.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning
Unsupervised Machine Learning
Unsupervised learning is different from the Supervised
learning technique; as its name suggests, there is no need
for supervision. It means, in unsupervised machine
learning, the machine is trained using the unlabeled
dataset, and the machine predicts the output without any
supervision.
In unsupervised learning, the models are trained with the
data that is neither classified nor labelled, and the model
acts on that data without any supervision.
❖ Association
1) Clustering
The clustering technique is used when we want to find the inherent groups from the data. It is a way to group the objects into
a cluster such that the objects with the most similarities remain in one group and have fewer or no similarities with the objects
of other groups. An example of the clustering algorithm is grouping the customers by their purchasing behaviour.
Some of the popular clustering algorithms are given below:
o K-Means Clustering algorithm, Mean-shift algorithm
o DBSCAN Algorithm
Association rule learning is an unsupervised learning technique, which finds interesting relations
among variables within a large dataset. The main aim of this learning algorithm is to find the
dependency of one data item on another data item and map those variables accordingly so that it
can generate maximum profit. This algorithm is mainly applied in Market Basket analysis, Web
usage mining, continuous production, etc.
Some popular algorithms of Association rule learning are Apriori Algorithm, Eclat, FP-growth
algorithm.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning- Unsupervised Machine Learning
Advantages and Disadvantages of Unsupervised Learning Algorithm
Advantages:
o These algorithms can be used for complicated tasks compared to the supervised ones because
these algorithms work on the unlabeled dataset.
o Unsupervised algorithms are preferable for various tasks as getting the unlabeled dataset is
easier as compared to the labelled dataset.
Disadvantages:
o The output of an unsupervised algorithm can be less accurate as the dataset is not labelled,
and algorithms are not trained with the exact output in prior.
o Working with Unsupervised learning is more difficult as it works with the unlabelled dataset that
does not map with the output.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Learning- Unsupervised Machine Learning
Applications of Unsupervised Learning
To overcome the drawbacks of supervised learning and unsupervised learning algorithms, the
concept of Semi-supervised learning is introduced. The main aim of semi-supervised learning is to
effectively use all the available data, rather than only labelled data like in supervised learning
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Semi-Supervised Learning
Advantages and disadvantages of Semi-supervised Learning
Advantages:
o It is simple and easy to understand the algorithm.
o It is highly efficient.
o It is used to solve drawbacks of Supervised and Unsupervised Learning algorithms.
Disadvantages:
o Iterations results may not be stable.
o We cannot apply these algorithms to network-level data.
o Accuracy is low.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Reinforcement Learning
Reinforcement learning works on a feedback-based process, in which an AI agent (A software
component) automatically explore its surrounding by hitting & trail, taking action, learning from
experiences, and improving its performance
The reinforcement learning process is similar to a human being;
for example, a child learns various things by experiences in his day-to-day life. An example of
reinforcement learning is to play a game, where the Game is the environment, moves of an agent at each
step define states, and the goal of the agent is to get a high score. Agent receives feedback in terms of
punishment and rewards.
Due to its way of working, reinforcement learning is employed in different fields such as Game theory,
Operation Research, Information theory, multi-agent systems.
A reinforcement learning problem can be formalized using Markov Decision Process(MDP). In MDP,
the agent constantly interacts with the environment and performs actions; at each action, the
environment responds and generates a new state.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Reinforcement Learning
A reinforcement learning problem can be formalized using Markov Decision
Process(MDP). In MDP, the agent constantly interacts with the environment and
performs actions; at each action, the environment responds and generates a new
state.
o Resource Management:
The "Resource Management with Deep Reinforcement Learning" paper showed that how to use RL in computer to
automatically learn and schedule resources to wait for different jobs in order to minimize average job slowdown.
o Robotics:
RL is widely being used in Robotics applications. Robots are used in the industrial and manufacturing area, and these robots are
made more powerful with reinforcement learning. There are different industries that have their vision of building intelligent
robots using AI and Machine learning technology.
o Text Mining
Text-mining, one of the great applications of NLP, is now being implemented with the help of Reinforcement Learning by
Salesforce company.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
Types of Machine Reinforcement Learning
Advantages and Disadvantages of Reinforcement Learning
Advantages
o It helps in solving complex real-world problems which are difficult to be solved by general techniques.
o The learning model of RL is similar to the learning of human beings; hence most accurate results can be
found.
o Helps in achieving long term results.
Disadvantage
o RL algorithms are not preferred for simple problems.
o RL algorithms require huge data and computations.
o Too much reinforcement learning can lead to an overload of states which can weaken the results.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
The Brain and the Neuron
The term "Artificial neural network" refers to a biologically
inspired sub-field of artificial intelligence modeled after the
brain. An Artificial neural network is usually a computational
network based on biological neural networks that construct
the structure of the human brain. Similar to a human brain has
neurons interconnected to each other, artificial neural
networks also have neurons that are linked to each other in
various layers of the networks. These neurons are known as
nodes.
MALLA REDDY COLLEGE OF ENGINEERING
UNIT - I
The Brain and the Neuron
Artificial Neural Network" is derived from Biological neural
networks that develop the structure of a human brain. Similar
to the human brain that has neurons interconnected to one
another, artificial neural networks also have neurons that are
interconnected to one another in various layers of the
networks. These neurons are known as nodes.
MALLA REDDY COLLEGE OF ENGINEERING
The first design choice we face is to choose the type of training experience from which our system will learn.
The type of training experience available can have a significant impact on success or failure of the learner.
One key attribute is whether the training experience provides direct or indirect feedback regarding the
choices made by the performance system.
For example,
in learning to play checkers, the system might learn from direct training examples consisting of individual
checkers board states and the correct move for each.
In order to complete the design of the learning system, we must now choose
1. the exact type of knowledge to be learned
2. a representation for this target knowledge
3. a learning mechanism
MALLA REDDY COLLEGE OF ENGINEERING
Design a Learning System
The Generalizer takes as input the training examples and produces an output hypothesis that is its estimate of
the target function. It generalizes from the specific training examples, hypothesizing a general function that
covers these examples and other cases beyond the training examples.
The Experiment Generator takes as input the current hypothesis (currently learned function) and outputs a new
problem (i.e., initial board state) for the Performance System to explore. Its role is to pick new practice overall
system.
MALLA REDDY COLLEGE OF ENGINEERING
Design a Learning System
One useful perspective on machine learning is that it involves searching a very large
space of possible hypotheses to determine one that best fits the observed data and any
prior knowledge held by the learner
For example,
consider the space of hypotheses that could in principle be output by the above checkers learner. This hypothesis
space consists of all evaluation functions that can be represented by some choice of values for the weights W0 through
w6.
The learner's task is thus to search through this vast space to locate the hypothesis that is most consistent with the
available training examples
MALLA REDDY COLLEGE OF ENGINEERING
Perspectives and Issues in Machine Learning
What algorithms exist for learning general target functions from specific training examples? In what settings will
particular algorithms converge to the desired function, given sufficient training data? Which algorithms perform best
for which types of problems and representations?
➢ How much training data is sufficient? What general bounds can be found to relate the confidence in learned
hypotheses to the amount of training experience and the character of the learner's hypothesis space?
➢ When and how can prior knowledge held by the learner guide the process of generalizing from examples?
➢ Can prior knowledge be helpful even when it is only approximately correct?
➢ What is the best strategy for choosing a useful next training experience, and how does the choice of this strategy
alter the complexity of the learning problem?
➢ What is the best way to reduce the learning task to one or more function approximation problems? Put another
way, what specific functions should the system attempt to learn? Can this process itself be automated?
➢ How can the learner automatically alter its representation to improve its ability to represent and learn the target
function?
MALLA REDDY COLLEGE OF ENGINEERING
Concept Learning as Search –
Concept learning:
Inferring a boolean-valued function from training examples of its input and output.
A CONCEPT LEARNING TASK:
What hypothesis representation shall we provide to the learner in this case? Let us begin by considering a simple
representation in which each hypothesis consists of a conjunction of constraints on the instance attributes.
No of possible instances – 2d
It is important to note that by selecting a hypothesis representation, the designer of the learning algorithm
implicitly defines the space of all hypotheses that the program can ever represent and therefore can ever
learn.
General-to-Specific Ordering of Hypotheses Many algorithms for concept learning organize the search
through the hypothesis space by relying on a very useful structure that exists for any concept learning
problem :
a general-to-specific ordering of hypotheses. By taking advantage of this naturally occurring structure over
the hypothesis space, we can design learning algorithms that exhaustively search even infinite hypothesis
spaces without
explicitly enumerating every hypothesis.
MALLA REDDY COLLEGE OF ENGINEERING
Concept Learning as Search –
h1 = (Sunny, ?, ?, Strong, ?, ?)
h2 = (Sunny, ?, ?, ?, ?, ?)
Now consider the sets of instances that are classified positive by hl and by h2. Because h2 imposes fewer
constraints on the instance, it classifies more instances as positive. In fact, any instance classified positive
by h1 will also be classified positive by h2. Therefore, we say that h2 is more general than h1.
MALLA REDDY COLLEGE OF ENGINEERING
Finding a Maximally Specific Hypothesis –
Find S Algorithm
Representation :
Find S Algorithm
Find S Algorithm
ho = <Ø,Ø,Ø,Ø,Ø>
h1 = <Japan, Honda, Blue,1980,Eco>
h2=h1
h3 = < Japan, ?, Blue,?,Eco>
h4 = h3
h5 = < Japan, ?, ?,?, Eco >
h6 = h7
Disadvantages:
- Consider only +ve Values
- h6 may not be sole hypothesis that fits the complete data
MALLA REDDY COLLEGE OF ENGINEERING
Version Spaces and the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron –
Linear Separability – Linear Regression
h1 h2
h3 h4
consistent h(x) = c(x)
MALLA REDDY COLLEGE OF ENGINEERING
Version Spaces and the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron –
Linear Separability – Linear Regression
subset of hypothesis (H) consistent with the training examples consistent h(x) = c(x)
H VS D x1
h1 h2 -> h1 h2
x2
h3 h4 h3 h4
x3
MALLA REDDY COLLEGE OF ENGINEERING
Version Spaces and the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron –
Linear Separability – Linear Regression
MALLA REDDY COLLEGE OF ENGINEERING
the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron – Linear Separability –
Linear Regression
The Candidate Elimination Algorithm:
✓ use the concept of version space
✓ It considers both +ve and –ve values (Samples) – Yes or No
✓ Both specific and General Hypothesis
S = {Ø, Ø , Ø , Ø , Ø } +
G = {? ? ? ? ? } -
MALLA REDDY COLLEGE OF ENGINEERING
the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron – Linear Separability –
Linear Regression
The Candidate Elimination Algorithm:
✓ Algorithm
Step 1: initialise General to Specific
S1 = {Sunny,Warm,Normal,Strong,Warm,Same}
G1 = {?,?,?,?,?,?}
S2 = {Sunny,Warm,?,Strong,Warm,Same}
G2 = {?,?,?,?,?,?}
MALLA REDDY COLLEGE OF ENGINEERING
the Candidate Elimination Algorithm – Linear Discriminants: – Perceptron – Linear Separability –
Linear Regression
The Candidate Elimination Algorithm:
Example:
Enjoysport
S = {Ø, Ø , Ø , Ø , Ø } G = {? ? ? ? ? }
Dataset:
S No Sky Temperature Humidity Wind Water Forecast Enjoysport
3 Rainy Cold High Strong Warm Change No (-)
4 Sunny Warm High Strong Cool Change Yes (+)
S3 = {Sunny,Warm,?,Strong,Warm,Same}
G3 = {<Sunny,?,?,?,?,?>, {<?,Warm,?,?,?,?>, <?,?,?,?,?same, >}
S4 = {Sunny,Warm,?,Strong,?,?}
G4 = {<Sunny,?,?,?,?,?>, {<?,Warm,?,?,?,?>,}
there for S4 and G4 => final Hypothesis
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Perceptron
Perceptron is Machine Learning algorithm for supervised learning of various binary classification tasks.
Further, Perceptron is also understood as an Artificial Neuron or neural network unit that helps to
detect certain input data computations in business intelligence.
Perceptron model is also treated as one of the best and simplest types of Artificial Neural networks.
However, it is a supervised learning algorithm of binary classifiers.
Hence, we can consider it as a single-layer neural network with four main parameters, i.e., input values,
weights and Bias, net sum, and an activation function.
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Perceptron
Linear separability is a concept in machine learning that refers to the ability to separate data points in
binary classification problems using a linear decision boundary. If the data points can be separated
using a line, linear function, or flat hyperplane, they are considered linearly separable. Linear separability
is an important concept in neural networks, and it is introduced in the context of linear algebra and
optimization theory.
In the context of machine learning, linear separability is an important property because it makes
classification problems easier to solve. If the data is linearly separable, we can use a linear classifier, such
as logistic regression or support vector machines (SVMs), to accurately classify new instances of data.
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Linear Separability :
A Decision line is drawn to separate possible and negative responses
𝑦𝑖𝑛 = 𝑏 + σ𝑛𝑖=1 𝑥𝑖𝑤𝑖
𝑏 + σ𝑛𝑖=1 𝑥𝑖𝑤𝑖 = 0
𝑥𝑜
1
𝑥1 x y y O/p
1
𝑥2 x
2
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Linear Separability :
Requirement for +ve responses of the net is
b+x1w1+x2w2 = 0 x2
𝑏
x2= −𝑤1
𝑤2
𝑥1− Decision line + Positive
𝑤2
response region
X1 X2 Y -
example with AND Gate 0 0 0 x1 x1
0 1 0
-
1 0 0
Negative response
1 1 1 region
x2 -
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear
Regression
Linear Regression :
Week Sale in thousands
y = a0+a1x+e
1 1.2
2 1.8
Where a1 = (𝒙𝒚) − (𝒙)(𝒚) ഥ − 𝒂𝟏 + 𝒙
a0 = 𝒚 ഥ
3 2.6
𝑥 2 - 𝑥 −2 4 3.2
Week (x1) Sale in X1 power of 2 X1+yi 5 3.8
thousands (yi)
1 1.2 1 1.2
2 1.8 4 3.6
3 2.6 9 7.8
4 3.2 16 12.8
5 3.8 25 19
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Linear Regression :
𝒙 𝒚
𝑎1 = (𝒙𝒚) − 2 −2
𝑥 −𝑥
Week (x1) Sale in X1 power of 2 X1+yi
= 8.88-3*2.52 = 0.66
thousands (yi)
11 -𝟑𝟐
1 1.2 1 1.2
2 1.8 4 3.6 ഥ − 𝒂𝟏 + 𝒙
a0 = 𝒚 ഥ
3 2.6 9 7.8 ao= 2.52-(0.66+3) = 0.54
4 3.2 16 12.8 If x = 7
5 3.8 25 19 Y = 0.54*0.66+ 7 = 5.16
X=3 12.6 55 44.4
Mean 2.52 11 8.88 If x = 12
Y = 0.54*0.66+ 12 = 8.46
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Linear Regression :
Linear regression is one of the easiest and most popular Machine Learning algorithms.
It is a statistical method that is used for predictive analysis. Linear regression makes predictions for
continuous/real or numeric variables such as sales, salary, age, product price, etc.
Linear regression algorithm shows a linear relationship between a dependent (y) and one or more
independent (y) variables, hence called as linear regression.
Since linear regression shows the linear relationship, which means it finds how the value of the
dependent variable is changing according to the value of the independent variable.
MALLA REDDY COLLEGE OF ENGINEERING
Linear Discriminants: – Perceptron – Linear Separability – Linear Regression
Linear Regression :