0% found this document useful (0 votes)
60 views4 pages

Ai Unit-4 ML

AI unit 4

Uploaded by

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

Ai Unit-4 ML

AI unit 4

Uploaded by

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

UNIT-IV

Machine Learning

Machine learning is a branch of artificial intelligence that enables algorithms to uncover hidden patterns within
datasets, allowing them to make predictions on new, similar data without explicit programming for each task. ML
enables the machine to automatically learn from data, improve performance from past experiences, and
make predictions. Machine learning contains a set of algorithms that work on a huge amount of data. Data is fed to
these algorithms to train them, and on the basis of training, they build the model & perform a specific task.

How machine learning algorithms work


Machine Learning works in the following manner.
A machine learning algorithm works by learning patterns and relationships from data to make predictions or
decisions without being explicitly programmed for each task. Here’s a simplified overview of how a typical machine
learning algorithm works:
1. Data Collection:
First, relevant data is collected or curated. This data could include examples, features, or attributes that are important
for the task at hand, such as images, text, numerical data, etc.
2. Data Preprocessing:
Before feeding the data into the algorithm, it often needs to be preprocessed. This step may involve cleaning the data
(handling missing values, outliers), transforming the data (normalization, scaling), and splitting it into training and
test sets.
3. Choosing a Model:
Depending on the task (e.g., classification, regression, clustering), a suitable machine learning model is chosen.
Examples include decision trees, neural networks, support vector machines, and more advanced models like deep
learning architectures.
4. Training the Model:
The selected model is trained using the training data. During training, the algorithm learns patterns and relationships
in the data. This involves adjusting model parameters iteratively to minimize the difference between predicted
outputs and actual outputs (labels or targets) in the training data.
5. Evaluating the Model:
Once trained, the model is evaluated using the test data to assess its performance. Metrics such as accuracy,
precision, recall, or mean squared error are used to evaluate how well the model generalizes to new, unseen data.
6. Fine-tuning:
Models may be fine-tuned by adjusting hyperparameters (parameters that are not directly learned during training,
like learning rate or number of hidden layers in a neural network) to improve performance.
7. Prediction or Inference:
Finally, the trained model is used to make predictions or decisions on new data. This process involves applying the
learned patterns to new inputs to generate outputs, such as class labels in classification tasks or numerical values in
regression tasks.
1. Supervised Machine Learning
As its name suggests, Supervised machine learning is based on supervision. It means in the supervised learning
technique, we train the machines using the "labelled" dataset, and based on the training, the machine predicts the
output. Here, the labelled data specifies that some of the inputs are already mapped to the output. More preciously,
we can say; first, we train the machine with the input and corresponding output, and then we ask the machine to
predict the output using the test dataset.

o Suppose we have a dataset of different types of shapes which includes square, rectangle, triangle, and
Polygon. Now the first step is that we need to train the model for each shape. If the given shape has four
sides, and all the sides are equal, then it will be labelled as a Square.

o If the given shape has three sides, then it will be labelled as a triangle.

o 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:


o First Determine the type of training dataset

o Collect/Gather the labelled training data.

o Split the training dataset into training dataset, test dataset, and validation dataset.

o Determine the input features of the training dataset, which should have enough knowledge so that the
model can accurately predict the output.

o Determine the suitable algorithm for the model, such as support vector machine, decision tree, etc.

o Execute the algorithm on the training dataset. Sometimes we need validation sets as the control parameters,
which are the subset of training datasets.

o Evaluate the accuracy of the model by providing the test set. If the model predicts the correct output, which
means our model is accurate.

Categories of Supervised Machine Learning


There are two main categories of supervised learning that are mentioned below:
o Classification

o Regression
A. Classification : Classification is a type of supervised learning where the algorithm learns to
assign input data to a specific category or class based on input features. The output labels in
classification are discrete values. Classification algorithms can be binary, where the output is one
of two possible classes, or multiclass, where the output can be one of several classes. Here are
some classification algorithms:
Logistic Regression

o Support Vector Machine

o Random Forest

o Decision Tree

o K-Nearest Neighbors (KNN)

o Naive Bayes

B. Regression : on the other hand, deals with predicting continuous target variables, which represent numerical
values. For example, predicting the price of a house based on its size, location, and amenities, or forecasting the
sales of a product. Regression algorithms learn to map the input features to a continuous numerical value.
Here are some regression algorithms:

o Linear Regression

o Polynomial Regression

o Ridge Regression

o Lasso Regression

o Decision tree

o Random Forest

2. Unsupervised Machine Learning


Unsupervised Learning Unsupervised learning is a type of machine learning technique in which an algorithm
discovers patterns and relationships using unlabeled data. Unlike supervised learning, unsupervised learning doesn’t
involve providing the algorithm with labeled target outputs. The primary goal of Unsupervised learning is often to
discover hidden patterns, similarities, or clusters within the data, which can then be used for various purposes, such
as data exploration, visualization, dimensionality reduction, and more.

Here are two main categories of unsupervised learning that are mentioned below:
 Clustering
 Association

Clustering
Clustering is the process of grouping data points into clusters based on their similarity. This technique is useful for
identifying patterns and relationships in data without the need for labeled examples.
Here are some clustering algorithms:
 K-Means Clustering algorithm
 Mean-shift algorithm
 DBSCAN Algorithm
 Principal Component Analysis
 Independent Component Analysis

Association
Association rule learning is a technique for discovering relationships between items in a dataset. It identifies rules
that indicate the presence of one item implies the presence of another item with a specific probability.
Here are some association rule learning algorithms:
 Apriori Algorithm
 Eclat
 FP-growth Algorithm

3. Semi-Supervised Learning
Semi-Supervised learning is a machine learning algorithm that works between the supervised and
unsupervised learning so it uses both labelled and unlabelled data. It’s particularly useful when obtaining labeled
data is costly, time-consuming, or resource-intensive. This approach is useful when the dataset is expensive and
time-consuming. Semi-supervised learning is chosen when labeled data requires skills and relevant resources in
order to train or learn from it.

4. Reinforcement Machine Learning


Reinforcement machine learning algorithm is a learning method that interacts with the environment by producing
actions and discovering errors. Trial, error, and delay are the most relevant characteristics of reinforcement
learning. In this technique, the model keeps on increasing its performance using Reward Feedback to learn the
behavior or pattern. These algorithms are specific to a particular problem e.g. Google Self Driving car, AlphaGo
where a bot competes with humans and even itself to get better and better performers in Go Game. Each time we
feed in data, they learn and add the data to their knowledge which is training data. So, the more it learns the better it
gets trained and hence experienced.

You might also like