Artificial Intelligence and Machine Learning
Artificial Intelligence and Machine Learning
Artificial Intelligence and Machine Learning
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.
Classification Algorithms can be further divided into the Mainly two category:
● Linear Models
○ Logistic Regression
○ Support Vector Machines
● Non-linear Models
○ K-Nearest Neighbors
○ Kernel SVM
○ Naïve Bayes
○ Decision Tree Classification
○ Random Forest Classification
K-nearest Neighbors
Suppose we have a new data point and we need to put it in the required category. Consider the
below image:
● Firstly, we will choose the number of neighbors, so we will choose the k=5.
● Next, we will calculate the Euclidean distance between the data points. The Euclidean
distance is the distance between two points, which we have already studied in
geometry. It can be calculated as:
● By calculating the Euclidean distance we got the nearest neighbors, as three nearest
neighbors in category A and two nearest neighbors in category B. Consider the below
image:
● As we can see the 3 nearest neighbors are from category A, hence this new data point
must belong to category A.
● Sentiment Analysis
● Email Spam Classification
● Document Classification
● Image Classification
● Bank customers loan pay willingness prediction.
● Cancer tumor cells identification.
● Drugs classification
● Facial key points detection
● Pedestrians detection in an automotive car driving.
Overview of Regression
● Regression is a supervised learning technique which helps in finding the correlation
between variables and enables us to predict the continuous output variable based on
the one or more predictor variables.
● It is mainly used for prediction, forecasting, time series modeling, and determining the
causal-effect relationship between variables.
● In Regression, we plot a graph between the variables which best fits the given
datapoints, using this plot, the machine learning model can make predictions about the
data.
● In simple words, "Regression shows a line or curve that passes through all the
datapoints on target-predictor graph in such a way that the vertical distance between
the datapoints and the regression line is minimum." The distance between datapoints
and line tells whether a model has captured a strong relationship or not.
● Some examples of regression can be as:
● Prediction of rain using temperature and other factors
● Determining Market trends
● Prediction of road accidents due to rash driving.
● Example:
Suppose there is a marketing company A, who does various advertisement every year
and get sales on that. The below list shows the advertisement made by the company in
the last 5 years and the corresponding sales:
Now, the company wants to do the advertisement of $200 in the year 2019 and wants
to know the prediction about the sales for this year. So to solve such type of prediction
problems in machine learning, we need regression analysis.
● Dependent Variable: The main factor in Regression analysis which we want to predict or
understand is called the dependent variable. It is also called target variable.
● Independent Variable: The factors which affect the dependent variables or which are
used to predict the values of the dependent variables are called independent variable,
also called as a predictor.
Types of Regression
● Linear Regression
● Logistic Regression
● Polynomial Regression
● Support Vector Regression
● Decision Tree Regression
● Random Forest Regression
● Ridge Regression
● Lasso Regression
Linear Regression:
● Linear regression is a statistical regression method which is used for predictive analysis.
● It is one of the very simple and easy algorithms which works on regression and shows
the relationship between the continuous variables.
● It is used for solving the regression problem in machine learning.
● Linear regression shows the linear relationship between the independent variable (X-
axis) and the dependent variable (Y-axis), hence called linear regression.
● 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.
● The relationship between variables in the linear regression model can be explained
using the below image. Here we are predicting the salary of an employee on the basis of
the year of experience.
Y= aX+b
Here, Y = dependent variables (target variables),
X= Independent variables (predictor variables),
a and b are the linear coefficients
● With the help of supervised learning, the model can predict the output on the basis of
prior experiences.
● In supervised learning, we can have an exact idea about the classes of objects.
● Supervised learning model helps us to solve various real-world problems such as fraud
detection, spam filtering, etc.
● Supervised learning models are not suitable for handling the complex tasks.
● Supervised learning cannot predict the correct output if the test data is different from
the training dataset.
● Training required lots of computation times.
● In supervised learning, we need enough knowledge about the classes of object.