MLT UNIT-2 Notes
MLT UNIT-2 Notes
Regression:
Types Of Regression:
Linear Regression:
o Linear regression is a statistical regression method which is
used for predictive analysis.
o It is one of the very simple and easy algorithms which works
on regression and shows the relationship between the
continuous variables.
o It is used for solving the regression problem in machine
learning.
o Linear regression shows the linear relationship between the
independent variable (X-axis) and the dependent variable (Y-
axis), hence called linear regression.
o If there is only one input variable (x), then such linear
regression is called simple linear regression. And if there
is more than one input variable, then such linear regression
is called multiple linear regression.
1. Y= aX+b
Logistic Regression:
o Logistic regression is another supervised learning algorithm
which is used to solve the classification problems.
In classification problems, we have dependent variables
in a binary or discrete format such as 0 or 1.
o Logistic regression algorithm works with the categorical
variable such as 0 or 1, Yes or No, True or False, Spam or not
spam, etc.
o It is a predictive analysis algorithm which works on the
concept of probability.
o Logistic regression is a type of regression, but it is different
from the linear regression algorithm in the term how they are
used.
o Logistic regression uses sigmoid function or logistic
function which is a complex cost function. This sigmoid
function is used to model the data in logistic regression. The
function can be represented as:
Bayesian Learning:
Bayes Classifier :
where,
Working of Naïve Bayes' Classifier can be understood with the help of the
below example:
Problem: If the weather is sunny, then the Player should play or not?
0 Rainy Yes
1 Sunny Yes
2 Overcast Yes
3 Overcast Yes
4 Sunny No
5 Rainy Yes
6 Sunny Yes
7 Overcast Yes
8 Rainy No
9 Sunny No
10 Sunny Yes
11 Rainy No
12 Overcast Yes
13 Overcast Yes
Frequency table for the Weather Conditions:
Weather Yes No
Overcast 5 0
Rainy 2 2
Sunny 3 2
Total 10 5
Weather No Yes
Overcast 0 5 5/14= 0.35
Rainy 2 2 4/14=0.29
Sunny 2 3 5/14=0.35
Applying Bayes'theorem:
P(Sunny)= 0.35
P(Yes)=0.71
P(Sunny|NO) = 2/4=0.5
P(No)= 0.29
P(Sunny)= 0.35
Kernel Function:
Kernel Function is a method used to take data as input and transform it
into the required form of processing data.
“Kernel” is used due to a set of mathematical functions used in Support
Vector Machine providing the window to manipulate the data.
So, Kernel Function generally transforms the training set of data so that
a non-linear decision surface is able to transform to a linear equation in
a higher number of dimension spaces. Basically, It returns the inner
product between two points in a standard feature dimension.
Types Of kernel:
Linear Kernel
A linear kernel is a type of kernel function used in machine
learning, including in SVMs (Support Vector Machines). It is the
simplest and most commonly used kernel function, and it defines
the dot product between the input vectors in the original feature
space.
1. K(x, y) = x .y
Where x and y are the input feature vectors. The dot product of
the input vectors is a measure of their similarity or distance in the
original feature space.
Gaussian (RBF) Kernel
The Gaussian kernel, also known as the radial basis function (RBF)
kernel, is a popular kernel function used in machine learning,
particularly in SVMs (Support Vector Machines). It is a nonlinear
kernel function that maps the input data into a higher-
dimensional feature space using a Gaussian function.
Polynomial Kernel:
It represents the similarity of vectors in the training set of data in a
feature space over polynomials of the original variables used in the
kernel.
K (x, y) = (x.y + c) d
Advantages of SVMs
SVMs are powerful machine learning algorithms that have the following
advantages:
Bayesian Network can be used for building models from data and
experts’ opinions, and it consists of two parts:
EM Algorithm:
The EM algorithm is the combination of various unsupervised ML algorithms,
such as the k-means clustering algorithm. Being an iterative approach, it
consists of two modes. In the first mode, we estimate the missing or latent
variables. Hence it is referred to as the Expectation/estimation step (E-
step). Further, the other mode is used to optimize the parameters of the
models so that it can explain the data more clearly. The second mode is
known as the maximization-step or M-step.
o Expectation step (E - step): It involves the estimation (guess) of all
missing values in the dataset so that after completing this step, there should
not be any missing value.
o Maximization step (M - step): This step involves the use of estimated data
in the E-step and updating the parameters.
o Repeat E-step and M-step until the convergence of the values occurs.
The primary goal of the EM algorithm is to use the available observed data of
the dataset to estimate the missing data of the latent variables and then use
that data to update the values of the parameters in the M-step.
Steps in EM Algorithm:
The EM algorithm is completed mainly in 4 steps, which include
Initialization Step, Expectation Step, Maximization Step, and
convergence Step. These steps are explained as follows:
o 1st Step: The very first step is to initialize the parameter values. Further, the
system is provided with incomplete observed data with the assumption that
data is obtained from a specific model.
Applications of EM algorithm:
The primary aim of the EM algorithm is to estimate the missing data in the
latent variables through observed data in datasets. The EM algorithm or
latent variable model has a broad range of real-life applications in machine
learning. These are as follows:
Advantages of EM algorithm:
Disadvantages of EM algorithm: