0% found this document useful (0 votes)
15 views24 pages

Artificial Intelligence

The document discusses various machine learning models, focusing on classification methods, types of learners (eager and lazy), and specific algorithms like Decision Trees, Random Forest, Support Vector Machines, and K-Nearest Neighbors. It also covers unsupervised learning, particularly the K-means algorithm, and emphasizes the importance of model evaluation metrics such as confusion matrix, accuracy, precision, recall, and F-measure. Practical applications in healthcare and transportation are highlighted to illustrate the effectiveness of these models.

Uploaded by

alisufyankwl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views24 pages

Artificial Intelligence

The document discusses various machine learning models, focusing on classification methods, types of learners (eager and lazy), and specific algorithms like Decision Trees, Random Forest, Support Vector Machines, and K-Nearest Neighbors. It also covers unsupervised learning, particularly the K-means algorithm, and emphasizes the importance of model evaluation metrics such as confusion matrix, accuracy, precision, recall, and F-measure. Practical applications in healthcare and transportation are highlighted to illustrate the effectiveness of these models.

Uploaded by

alisufyankwl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Artificial Intelligence

Lecture 15
Machine Learning Models

1
Classification

• Classification is a supervised machine learning method where the


model tries to predict the correct label of a given input data.
• In classification, the model is fully trained using the training data, and
then it is evaluated on test data before being used to perform
prediction on new unseen data
Contd.
Types of Learner in ML
• Eager Learners
• Eager learners are machine learning algorithms that first build a model from the training
dataset before making any prediction on future datasets.
• They spend more time during the training process because of their eagerness to have a
better generalization
• They require less time to make predictions. Most machine learning algorithms are eager
learners, and below are some examples:
• Support Vector Machine.
• Decision Trees.
• Artificial Neural Networks.
• Lazy learners or instance-based learners
• Do not create any model immediately from the training data.
• They memorize the training data, and each time there is a need to make a prediction, they
search for the nearest neighbor from the whole training data.
• K-Nearest Neighbor.
Example
Healthcare
• Training a machine learning model on historical patient data can help
healthcare specialists accurately analyze their diagnoses:
• During the COVID-19 pandemic, machine learning models were
implemented to efficiently predict whether a person had COVID-19 or
not.
• Researchers can use machine learning models to predict new diseases
that are more likely to emerge in the future.
Example
• Transportation
• Transportation is the key component of many countries' economic
development. As a result, industries are using machine and deep
learning models:
• To predict which geographical location will have a rise in traffic
volume.
• Predict potential issues that may occur in specific locations due to
weather conditions.
Types of classification Task
• Binary Classification
• In a binary classification task, the goal is to classify the input data into
two mutually exclusive categories.
• The training data in such a situation is labeled in a binary format: true
and false; positive and negative; O and 1; spam and not spam, etc.
• Multi-Class Classification
• The multi-class classification, on the other hand, has at least two
mutually exclusive class labels, where the goal is to predict to which
class a given input example belongs to.
Decision Tree
• Decision trees start with a basic question, such as, “Should I surf?” From
there, you can ask a series of questions to determine an answer, such as,
“Is it a long period swell?” or “Is the wind blowing offshore?”.
• These questions make up the decision nodes in the tree, acting as a
means to split the data.
• Each question helps an individual to arrive at a final decision, which
would be denoted by the leaf node.
• Observations that fit the criteria will follow the “Yes” branch and those
that don’t will follow the alternate path. This decision tree is an example
of a classification problem, where the class labels are "surf" and "don't
surf."
Contd.
Random Forest
• The Random Forest algorithm is a powerful tree-learning technique in
Machine Learning.
• It works by creating several Decision Trees during the training phase.
• Each tree is constructed using a random subset of the data set to
measure a random subset of features in each partition.
• In prediction, the algorithm aggregates the results of all trees, either by
voting (for classification tasks) or by averaging (for regression tasks).
• This collaborative decision-making process, supported by multiple trees
with their insights, provides an exampleof stable and precise results.
Contd.
Support Vector Machine
• A Support Vector Machine (SVM) is a supervised machine
learning algorithm used for both classification and regression tasks.
• While it can be applied to regression problems, SVM is best suited
for classification tasks.
• The primary objective of the SVM algorithm is to identify the optimal
hyperplane in an N-dimensional space that can effectively separate data points
into different classes in the feature space.
• The algorithm ensures that the margin between the closest points of different
classes, known as support vectors, is maximized.
• The dimension of the hyperplane depends on the number of features. For
instance, if there are two input features, the hyperplane is simply a line, and if
there are three input features, the hyperplane becomes a 2-D plane.
• As the number of features increases beyond three, the complexity of visualizing
the hyperplane also increases.
Contd.
Linear regression

• Linear regression is a supervised machine learning algorithm that


computes the linear relationship between the dependent variable and
one or more independent features by fitting a linear equation to
observed data.
• When there is only one independent feature, it is known as Simple
Linear Regression, and when there is more than one feature, it is
known as Multiple Linear Regression.
Contd.
K-Nearest Neighbor
• K-NN algorithm assumes the similarity between the new case/data and
available cases and puts the new case into the category that is most similar to
the available categories.
• The k-NN algorithm stores all the available data and classifies a new data
point based on the similarity.
• K-NN is a non-parametric algorithm, which means it does not make any
assumption on underlying data.
• It is also called a lazy learner algorithm because it does not learn from the
training set immediately instead it stores the dataset and at the time of
classification, it performs an action on the dataset.
• KNN algorithm at the training phase just stores the dataset and when it gets
new data, then it classifies that data into a category that is much similar to
the new data.
Contd.
Unsupervised Learning
• Unsupervised machine learning is inferring underlying hidden
patterns from historical data. Within such an approach, a machine
learning model tries to find any similarities, differences, patterns, and
structure in data by itself. No prior human intervention is needed.
K-Mean
• K-means is an algorithm for exclusive clustering, also known as
partitioning or segmentation.
• It puts the data points into the predefined number of clusters known
as K. Basically, K in the K-means algorithm is the input since you tell
the algorithm the number of clusters you want to identify in your
data.
• Each data item then gets assigned to the nearest cluster center,
called centroids. The latter act as data accumulation areas.
Contd.
Model Evaluation:
• Confusion Matrix:
• The confusion matrix is a matrix used to determine the performance
of the classification models for a given set of test data. It can only be
determined if the true values for test data are known.
• Since it shows the errors in the model performance in the form of a
matrix, hence also known as an error matrix. Some features of
Confusion matrix are given below:
• The matrix is divided into two dimensions, that are predicted
values and actual values along with the total number of predictions.
• Predicted values are those values, that are predicted by the model,
and actual values are the true values for the given observations.
Contd.
Contd.
• Classification Accuracy: It defines how often the model predicts the
correct output. It can be calculated as the ratio of the number of
correct predictions made by the classifier to all number of predictions
made by the classifiers.

• Precision: It can be defined as the number of correct outputs


provided by the model, how many of them were true.
Contd.
• Recall: It is defined as the out of total positive classes, how our model
predicted correctly. The recall must be as high as possible.

• F-measure: If two models have low precision and high recall or vice
versa, it is difficult to compare these models. So, for this purpose, we
can use F-score. This score helps us to evaluate the recall and
precision at the same time. The F-score is maximum if the recall is
equal to the precision.

You might also like