Professional Documents
Culture Documents
•
•
•
•
•
Learning
•
Learning
• There are three types of learning:
1. Supervised Learning
2. Unsupervised Learning
3. Reinforcement Learning
Supervised Learning
• In Supervised learning, an AI system is
presented with data which is labelled.
• It means some data is already tagged with the
correct answer.
• It can be compared to learning which takes
place in the presence of a supervisor or a
teacher.
Supervised learning
Types of supervised learning
Regression
• It is a Supervised Learning task where output is
having continuous value.
• It is used for the prediction of continuous variables,
such as Weather forecasting, Market Trends, etc.
Classification
• Classification means to group the output
inside a class.
• If the algorithm tries to label input into two
distinct classes, it is called binary
classification.
• Selecting between more than two classes is
referred to as multiclass classification.
Classification
Unsupervised learning
• Unsupervised learning is a type of machine
learning in which models are trained using
unlabelled dataset and are allowed to act on
that data without any supervision.
Types of Unsupervised learning
Clustering
• Clustering is a method of grouping the objects
into clusters such that objects with most
similarities remains into a group and has less
or no similarities with the objects of another
group.
Association
• An association rule learning problem is where
you want to discover rules that describe large
portions of your data, such as people that buy
X also tend to buy Y.
Reinforcement Learning
• A reinforcement learning algorithm, or agent,
learns by interacting with its environment.
• The agent receives rewards by performing
correctly and penalties for performing incorrectly.
• The agent learns without intervention from a
human by maximizing its reward and minimizing
its penalty.
• It is a type of dynamic programming that trains
algorithms using a system of reward and
punishment.
Models
• There are two forms of data analysis that can
be used for extracting models describing
important classes or to predict future data
trends. These two forms are as follows −
• Classification
• Prediction
Prediction
• Prediction models predict continuous valued
functions.
Sara 16 1 Cricket
• Find in which class of
Zaira 34 1 Cricket
people Angelina will lie
Sachin 55 0 Neither
whose k factor is 3 and
age is 5.
Rahul 40 0 Cricket
Pooja 20 1 Neither
Smith 15 0 Cricket
Laxmi 55 1 Football
Michael 15 0 Football
Finding distance
•
KNN
• To find the distance between 2 points
• d=√((5-32)²+(1-0)²)
• d=√729+1
The distance calculated
• Ajay 27.02
Mark 35.01
Sara 11.00
Zaira 9.00
Sachin 50.01
Rahul 35.01
Pooja 15.00
Smith 10.00
Laxmi 50.00
Michael 10.05
KNN Classification
• As the value of k=3, the 3 closest points are
Zaira 9 cricket
Michael 10 cricket
smith 10.5 football
• Similarly
IG(S, Humidity) = 0.971
IG(S, Windy) = 0.020
• For humidity from the above table,
• play will occur if humidity is normal and
• not occur if it is high.
Underfitting
• A statistical model or a machine learning
algorithm is said to have underfitting when it
cannot capture the underlying trend of the
data.
• Underfitting destroys the accuracy of the
machine learning model.
Overfitting
• A statistical model is said to be overfitted,
when we train it with a lot of data.
• When a model gets trained with so much of
data, it starts learning from the noise and
inaccurate data entries in our data set.
Curve Fitting
Pruning
• Pruning is an algorithm used to reduce the
number of nodes that have to be evaluated to
reach the optimal solution.
• Pruning works by blocking the evaluation of
nodes whose leaf nodes would give worse
results compared to the one that was
previously examined.
Cross-Validation
• Cross-Validation (CV)is a technique used to
test a model’s ability to predict unseen data,
data not used to train the model.
• Holdout cross-validation
• k- fold cross validation
• Leave-one-out cross-validation LOOCV
• Random subsampling
Holdout cross-validation
• The simplest approach is to randomly split the
available data into a training set
• From this the learning algorithm produces h
using train set and a test set on which the
accuracy of h is evaluated.
k- fold cross validation
• Split the data into k equal subsets.
• We then perform k rounds of learning
• On each round 1/k of the data is held out as a test
set and the remaining examples are used as training
data.
Leave-one-out cross-validation LOOCV
• Leave-one-out cross validation is K-fold cross
validation
• Leave-one-out cross-validation (LOOCV) is an
exhaustive cross-validation technique.
• K equal to N, the number of data points in the
set.
Random subsampling
• Random subsampling validation also referred
to as Monte Carlo cross-validation splits the
dataset randomly into training and validation.
• In this technique, multiple sets of data are
randomly chosen from the dataset and
combined to form a test dataset. The
remaining data forms the training dataset.
Random subsampling
• The error rate of the model is the average of
the error rate of each iteration.
Evaluation Metrics
• Evaluation metrics help in determining how
good the model is trained.
1. Confusion matrix
2. Accuracy
3. Precision
4. Recall
5. ROC
Confusion matrix
• The confusion matrix visualizes the accuracy
of a classifier by comparing the actual and
predicted classes.
Evaluation metrics
•Recall or Sensitivity or TPR (True Positive Rate):
TP/(TP+FN)
•Precision:
TP/(TP+FP)
Evaluation metrics
•Accuracy:
(TP+TN)/(N+P)
F1, log loss
• ROC is a probability curve and AUC represents
the degree or measure of separability.
Bayes Theorem
• It is defined as the: Probability of an event A
given B equals the probability of B and A
happening together divided by the probability
of B.”
Naïve Bayes
• Naive Bayes is a probabilistic machine learning
algorithm that can be used in a wide variety of
classification tasks.
• Typical applications include filtering spam,
sentiment prediction etc.
Naïve Bayes
• It is a classification technique based on Bayes’
Theorem with an assumption of
independence among predictors.
• Naive Bayes classifier assumes that the
presence of a particular feature in a class is
unrelated to the presence of any other
feature.
Naïve Bayes
• Multiple Features x1,x2,x3…….xn and y
output.
Direct Method
• Extract rules directly from data
• RIPPER, Holte’s 1R (OneR)
Indirect Method
• Extract rules from other classification models
(e.g.decision trees, etc).
•
Indirect Method
Convert from the decision tree: