Ai Unit-4-1
Ai Unit-4-1
Learning
"Learning" refers to the process by which a system improves its performance
on a task over time through experience, data, or interaction with the
environment.
Machine Learning:
A. Supervised learning:
B. Unsupervised learning:
C. Reinforcement learning:
D. Semi-supervised learning:
Supervised learning:
Supervised learning, as the name indicates, has the presence of a supervisor as a
teacher. Basically supervised learning is when we teach or train the machine using
data that is well labelled. Which means some data is already tagged with the
correct answer. After that, the machine is provided with a new set of examples
(data) so that the supervised learning algorithm analyses the training data (set of
training examples) and produces a correct outcome from labelled data.
For instance, suppose you are given a basket filled with different kinds of fruits.
Now the first step is to train the machine with all the different fruits one by one like
this:
If the shape of the object is rounded and has a depression at the top, is red in color,
then it will be labeled as –Apple.
If the shape of the object is a long curving cylinder having Green-Yellow color, then
it will be labeled as –Banana
Since the machine has already learned the things from previous data and this time
has to use it wisely. It will first classify the fruit with its shape and colour and would
confirm the fruit name as BANANA and put it in the Banana category. Thus the
machine learns the things from training data (basket containing fruits) and then
applies the knowledge to test data (new fruit).
In supervised learning, the training data provided to the machines work as the
supervisor that teaches the machines to predict the output correctly. It applies the
same concept as a student learns in the supervision of the teacher.
In the real-world, supervised learning can be used for Risk Assessment, Image
classification, Fraud Detection, spam filtering, etc.
If the given shape has four sides, and all the sides are equal, then it will be
labelled as a Square.
If the given shape has three sides, then it will be labelled as a triangle.
If the given shape has six equal sides then it will be labelled as hexagon.
Now, after training, we test our model using the test set, and the task of the model is
to identify the shape.
The machine is already trained on all types of shapes, and when it finds a new
shape, it classifies the shape on the bases of a number of sides, and predicts the
output.
Steps Involved in Supervised Learning:
First Determine the type of training dataset
Collect/Gather the labelled training data.
Split the training dataset into training dataset, test dataset, and validation
dataset.
Determine the input features of the training dataset, which should have
enough knowledge so that the model can accurately predict the output.
Determine the suitable algorithm for the model, such as support vector
machine, decision tree, etc.
Execute the algorithm on the training dataset. Sometimes we need
validation sets as the control parameters,which are the subset of training
datasets.
Evaluate the accuracy of the model by providing the test set. If the model
predicts the correct output, which means our model is accurate.
Linear Regression
Regression Trees
Non-Linear Regression
Bayesian Linear Regression
Polynomial Regression
Classification
Classification algorithms are used when the output variable is categorical, which
means there are two classes such as Yes-No, Male-Female, True-false, etc.
Random Forest
Decision Trees
Logistic Regression
Support vector Machines
3. Polynomial Regression:
Assume that there is only one independent variable x. If the
relationship between x (independent variable) or y (dependent variable)
is modelled by the relation,
Y=a0+a1*x1+a2*x2+.......+an*xn
For some positive integer n>1, then we have a Polynomial Regression.
4. Logistic Regression:
Logistic Regression is used when the dependent variable is
Binary (0/1, True/False, Yes/No) in nature.
Classification Regression
Decision Trees:
A decision tree is a category of supervised learning and it is a graphical
representation of different options for solving a problem and show how
different factors are related. It has a hierarchical tree structure starts with
one main question at the top called a node which further branches out into
different possible outcomes where:
Root Node is the starting point that represents the entire dataset.
Branches: These are the lines that connect nodes. It shows the flow
from one decision to another.
Internal Nodes are Points where decisions are made based on the
input features.
Leaf Nodes: These are the terminal nodes at the end of branches that
represent final outcomes or predictions.
Let’s take an example to understand the decision tree. Imagine you want
to decide whether to drink coffee based on the time of day and how tired
you feel. First the tree checks the time of day—if it’s morning it asks
whether you are tired. If you’re tired the tree suggests drinking coffee if
not it says there’s no need. Similarly in the afternoon the tree again asks if
you are tired. If you recommends drinking coffee if not it concludes no
coffee is needed.