0% found this document useful (0 votes)
6 views

Classification Algorithm in Machine Learning

Uploaded by

karmatseten30
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Classification Algorithm in Machine Learning

Uploaded by

karmatseten30
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Classification Algorithm in

Machine Learning
• The Classification algorithm is a Supervised Learning technique that is
used to identify the category of new observations on the basis of
training data. In Classification, a program learns from the given
dataset or observations and then classifies new observation into a
number of classes or groups. Such as, Yes or No, 0 or 1, Spam or Not
Spam, cat or dog, etc. Classes can be called as targets/labels or
categories.
• In classification algorithm, a discrete output function(y) is mapped to
input variable(x).
• y=f(x), where y = categorical output
• The best example of an ML classification algorithm
is Email Spam Detector.
• The main goal of the Classification algorithm is to identify
the category of a given dataset, and these algorithms are
mainly used to predict the output for the categorical data.
• Classification algorithms can be better understood using
the below diagram. In the below diagram, there are two
classes, class A and Class B. These classes have features
that are similar to each other and dissimilar to other
classes.
• The algorithm which implements the classification on a dataset is
known as a classifier. There are two types of Classifications:
• Binary Classifier: If the classification problem has only two possible
outcomes, then it is called as Binary Classifier.
Examples: YES or NO, MALE or FEMALE, SPAM or NOT SPAM, CAT or
DOG, etc.
• Multi-class Classifier: If a classification problem has more than two
outcomes, then it is called as Multi-class Classifier.
Example: Classifications of types of crops, Classification of types of
music.
Learners in Classification Problems:

• In the classification problems, there are two types of learners:


• Lazy Learners: Lazy Learner firstly stores the training dataset and wait
until it receives the test dataset. In Lazy learner case, classification is
done on the basis of the most related data stored in the training
dataset. It takes less time in training but more time for predictions.
Example: K-NN algorithm, Case-based reasoning
• Eager Learners:Eager Learners develop a classification model based
on a training dataset before receiving a test dataset. Opposite to Lazy
learners, Eager Learner takes more time in learning, and less time in
prediction. Example: Decision Trees, Naïve Bayes, ANN.
Types of ML Classification
Algorithms:
• Classification Algorithms can be further divided into the Mainly two
category:
• Linear Models
• Logistic Regression
• Support Vector Machines
• Non-linear Models
• K-Nearest Neighbours
• Kernel SVM
• Naïve Bayes
• Decision Tree Classification
Evaluating a Classification model:
• 1. Log Loss or Cross-Entropy Loss: It is used for evaluating the
performance of a classifier, whose output is a probability value
between the 0 and 1.
• For a good binary Classification model, the value of log loss should be
near to 0.
• The value of log loss increases if the predicted value deviates from the
actual value.
• The lower log loss represents the higher accuracy of the model.
Confusion Matrix:
• The confusion matrix provides us a matrix/table as output
and describes the performance of the model.
• It is also known as the error matrix.
• The matrix consists of predictions result in a summarized
form, which has a total number of correct predictions and
incorrect predictions. The matrix looks like as below table:

Actual Negative
Actual Positive
Predicted Positive True Positive False Positive

Predicted Negative False Negative True Negative


• True Positives (TP): when the actual value is Positive and predicted is
also Positive.
• True negatives (TN): when the actual value is Negative and prediction
is also Negative.
• False positives (FP): When the actual is negative but prediction is
Positive. Also known as the Type 1 error
• False negatives (FN): When the actual is Positive but the prediction is
Negative. Also known as the Type 2 error
Classification Measure
Basically, it is an extended version of the confusion matrix. There are
measures other than the confusion matrix which can help achieve
better understanding and analysis of our model and its performance.
• a. Accuracy
• b. Precision
• c. Recall (TPR, Sensitivity)
• d. F1-Score
Precision:

It is a measure of correctness that is achieved in true prediction. In simple words,


it tells us how many predictions are actually positive out of all the total positive
predicted.
Recall:
• It is a measure of actual observations which are predicted
correctly, i.e. how many observations of positive class are
actually predicted as positive. It is also known as
Sensitivity. Recall is a valid choice of evaluation metric
when we want to capture as many positives as possible.
F1 score
• The F1 score is a number between 0 and 1 and is the
harmonic mean of precision and recall. We use harmonic
mean because it is not sensitive to extremely large values,
unlike simple averages.

• F1 score sort of maintains a balance between the


precision and recall for your classifier. If your precision is
low, the F1 is low and if the recall is low again your F1
score is low.

You might also like