0% found this document useful (0 votes)
10 views42 pages

AI Chapter 5

Chapter Five provides an overview of machine learning, explaining its definition, importance, and various techniques such as supervised, unsupervised, and reinforcement learning. It details the machine learning lifecycle, including data gathering, preparation, analysis, model training, testing, and deployment. Additionally, the chapter introduces deep learning as a subfield of machine learning that utilizes neural networks for complex pattern recognition.

Uploaded by

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

AI Chapter 5

Chapter Five provides an overview of machine learning, explaining its definition, importance, and various techniques such as supervised, unsupervised, and reinforcement learning. It details the machine learning lifecycle, including data gathering, preparation, analysis, model training, testing, and deployment. Additionally, the chapter introduces deep learning as a subfield of machine learning that utilizes neural networks for complex pattern recognition.

Uploaded by

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

Chapter Five

Machine Learning Basics

1
Introduction to machine learning

 Machine learning is about extracting knowledge or pattern from data.

 Data is the core backbone of machine learning technique.

 Machine Learning is the most popular technique of predicting the


future or classifying information using machine learning algorithms
to help people in making necessary decisions.
 Machine Learning algorithms are trained over instances or examples
through which they learn from past experiences and also analyze the
historical data.

2
Introduction to machine learning (cont’d)
A machine learning algorithm infers patterns and relationships
between different variables(attributes) values in a dataset then uses
that knowledge to generalize beyond the training dataset.
In General, machine learning is a technology which enables computers
to learn automatically from past data by using various algorithms
for building mathematical models and making predictions.
 Currently, it is being used for various tasks such as image
recognition, speech recognition, email filtering, Facebook auto-
tagging, recommender system, and many more.

3
The need of Machine Learning
 The reason behind the need for machine learning is that it is
capable of doing tasks that are too complex for a person to
implement directly.
 As a human, we have some limitations as we cannot access
and get pattern from huge amount of data manually
 so for this reason we need some computer systems and here comes the
machine learning to make things easy for us.

 We can train machine learning algorithms by providing them


the huge amount of data and let them explore the data,
construct the models, and predict the required output
automatically. 4
The need of Machine Learning(cont’d)
 The importance of machine learning can be easily understood by its uses
cases/functions
 Currently, machine learning is used in self-driving cars, cyber fraud detection, face
recognition, and friend suggestion by Facebook, etc.

 Various top companies such as Netflix and Amazon have build machine learning
models that are using a vast amount of data to analyze the user interest and
recommend product accordingly.
 In general, the following are some key points which show the importance of
Machine Learning:
 Rapid increment in the production of data

 Solving complex problems, which are difficult for a human

 Decision making in various sector including finance, health

 Finding hidden patterns and extracting useful information from data. 5


Types of machine learning techniques

 At a broad level, machine learning can be classified into


three types:
Supervised learning

Unsupervised learning

Reinforcement learning

6
Supervised Learning Algorithms
 Supervised learning is a type of machine learning method in which
we provide sample labeled data (tagged with the correct answer) to
the machine learning algorithms in order to train it.
 The system creates a model using labeled data to understand the
datasets and learn about each data
 Once the training and processing are done then we test the model by
providing a sample/new data to check whether it is predicting the
exact output or not.
Supervised learning can be grouped further in two categories:
 Classification
 Regression
7
Supervised Learning - Classification
 Classification is a process of finding a function which helps in dividing
the dataset into classes based on different parameters/attributes value.
 In Classification, a computer program is trained on the training dataset
and based on that training, it categorizes the data into different classes.
 The goal here is to predict discrete values belonging to a particular
class and evaluate on the basis of accuracy.
 It can be binary classification, model predicts two values either 0 or
1 ; yes or no or multi class classification, model predicts to more than
two class, for example classifying an input/record/test data as low or
medium or high value.

8
Supervised Learning- Regression
 Regression is a process of finding the correlations between dependent
and independent variables.

Output is having continuous value.


The goal here is to predict a value as much closer to actual output
value
It helps in predicting the continuous variables such as prediction
of Market Trends, prediction of House prices, etc.
 The task of the Regression algorithm is to find the mapping function
to map the input variable(x) to the continuous output variable(y).

9
Supervised Learning Algorithms
 An example of classification and regression on two different
datasets is shown below:

10
Supervised Learning Algorithms

Some of Supervised algorithms:


 Linear Regression

 K-Nearest Neighbor(KNN)

 Naive Bayes

 Decision Trees

 Support Vector Machine (SVM)

 Random Forest

11
Unsupervised Learning Algorithms
 Unsupervised learning is a learning method in which a machine
learns without any supervision.
 Unsupervised learning is a class of machine learning techniques
used to find patterns in data.
 The data given to unsupervised algorithms is not labelled, which
means only the input variables (x) are given with no
corresponding output variables.
 The training is provided to the machine with the set of data that
has not been labeled, classified, or categorized, and the
algorithm needs to act on that data without any supervision.
12
Unsupervised Learning (cont’d)
 It groups unsorted information according to similarities, patterns, and

differences without any prior training or supervision.

 The goal of unsupervised learning is to restructure the input data into

new features or a group of objects with similar patterns.

 In unsupervised learning, we don't have a predetermined result.

 The machine tries to find useful insights from the huge amount of
data.

It can be further classifieds into two categories:


 Clustering

 Association 13
Unsupervised Learning - Clustering

 Clustering is the task of grouping together a set of objects in a way


that objects in the same cluster are more similar to each other than to
objects in other clusters.
 These methods are completely unsupervised because they try to
cluster data by looking at the data features without any prior training,
supervision, or knowledge about data attributes, associations, and
relationships.
 The goal of clustering is to find a natural grouping in data so that
items in the same cluster are more similar to each other than to those
from different clusters.
14
Unsupervised Learning – Clustering (cont’d)
 Clustering is a method of grouping the objects into clusters such that
objects with most similarities remains into a group and has less or no
similarities with the objects of another group.

Example:
 Using clustering, businesses are able to capture/identify potential
customer segments for selling their products.
 Sales companies are able to identify customer segments that are
most likely to use their services.
 Companies can evaluate the customer segments and then decide to
sell their product to maximize the profits.
15
Unsupervised Learning - Association
 Association: Association rule is used for finding the
relationships between variables in the large database.
 It determines the set of items that occurs together in the dataset.

 Association rule makes marketing strategy more effective.


Such as people who buy X item (suppose a bread) are also tend
to purchase Y (Butter/Jam) item.
 A typical example of Association rule is Market Basket
Analysis.

16
Unsupervised Learning Algorithms
 K-Means Clustering

 DBSCAN – Density-Based Spatial Clustering of


Applications with Noise
 Hierarchical Clustering

 Principal Component Analysis (PCA)

17
Reinforcement learning
 Reinforcement Learning is a feedback-based machine learning
technique in which an agent learns to behave in an environment by
performing the actions and seeing the results of actions.
 For each good action, the agent gets positive feedback, and for
each bad action, the agent gets negative feedback or penalty.
 In Reinforcement Learning, the agent learns automatically using
feedbacks without any labeled data, unlike supervised learning.
 Since there is no labeled data, so the agent is bound to learn by its
experience only.

18
Reinforcement learning (cont’d)
 The primary goal of an agent in reinforcement learning is to
improve the performance by getting the maximum positive rewards.
 The agent learns with the process of hit and trial, and based on the
experience, it learns to perform the task in a better way.
 Reinforcement learning is a type of machine learning method where
an intelligent agent (computer program) interacts with the
environment and learns to act within that.
 Example: Chess game, Google’s Active Query Answering
(AQA) system makes use of reinforcement learning.

19
Applications of Reinforcement learning

Here are a few applications that use reinforcement systems:


 Self driving cars

 Gaming

 Robotics

 Recommendation systems

 Advertising and marketing

20
Terminologies of Machine Learning
 Feature: A feature is an individual measurable property of data. A set
of numeric features can be conveniently described by a feature vector.
 Feature vectors are fed as input to the model. For example, in order
to predict a fruit, there may be features like color, smell, taste, etc.
 It is independent variable
 Target (Label):A target variable or label is the value to be predicted by
our model.
 For the fruit example discussed in the features section, the label with
each set of input would be the name of the fruit like apple, orange,
banana, etc.
 It is dependent value.

21
Terminologies of Machine Learning(cont’d)
 Training Data: The data used by a machine learning algorithm to
train a model, most of the time use 80% of the dataset.
 Test Data: The data used for evaluating the predictive performance of
a model, most of the time use 20% of the dataset
 Model: A model is a specific representation learned from data by
applying some machine learning algorithm.
 Prediction: Once our model is ready, it can be fed a set of inputs to
which it will provide a predicted output(label).
 Accuracy: is how close is a measured value is to the actual(true) value
• Accuracy is how close a measured value is to the
actual (true) 22
Machine Learning Life cycle
 Machine learning life cycle involves seven major steps, which are
given below:
1. Gathering Data
2. Data preparation
3. Data Wrangling
4. Analyze Data
5. Train the model
6. Test the model
7. Deployment

 Before starting the life cycle, we need to understand the problem

because the good result depends on the better understanding of the


23
problem.
Machine Learning Life cycle(cont’d)

1. Gathering Data:
 The goal of this step is to identify and obtain all data-related to the
problems.
 Data can be collected from various sources such
as files, database, internet etc

2. Data Preparation:
 Data preparation is a step where we put our data into a suitable
place and prepare it to use in our machine learning training.
 We need to understand the characteristics, format, and quality of
data.
24
Machine Learning Life cycle(cont’d)
3. Data Wrangling:
 Data wrangling is the process of cleaning and converting raw
data into a useable format.
 It is the process of cleaning the data, selecting the variable to
use, and transforming the data in a proper format to make it more
suitable for analysis.
 Cleaning of data is required to address the quality issues.

 It is not necessary that data we have collected is always of our


use as some of the data may not be useful.

25
Data Wrangling…
In real-world applications, collected data may have various
issues, including:
Missing Values

Duplicate data

Invalid data

Noise

 So, we use various filtering techniques to clean the data.

 It is mandatory to detect and remove the above issues because it


can negatively affect the quality of the outcome.
26
Machine Learning Life cycle(cont’d)
4. Data Analysis:
 Now the cleaned and prepared data is passed on to the analysis step. This step
involves:
 Selection of analytical techniques
 Building models
 Review the result
 The aim of this step is to build a machine learning model to analyze the data
using various analytical techniques and review the outcome.
 It starts with the determination of the type of the problems, where we select the
machine learning techniques such as Classification, Regression, Cluster
analysis, Association, etc. then build the model using prepared data, and
evaluate the model.
 Hence, in this step, we take the data and use machine learning algorithms to
build the model. 27
Machine Learning Life cycle(cont’d)
5. Train Model:
 In this step we train our model to improve its performance for better
outcome of the problem.
 We use datasets to train the model using various machine learning
algorithms.
 Training a model is required so that it can understand the various
patterns, rules, and, features.

6. Test Model:
 In this step, we check for the accuracy of our model by providing a test
dataset to it.
 Testing the model determines the percentage accuracy of the model as
per the requirement of project or problem.
28
Machine Learning Life cycle(cont’d)
7. Deployment:
 The last step of machine learning life cycle is deployment, where
we deploy the model in the real-world system.
 If the above-prepared model is producing an accurate result as per
our requirement with acceptable speed, then we deploy the model
in the real system.
 But before deploying the project, we will check whether it is
improving its performance using available data or not.
 The deployment phase is similar to making the final report for a
project.
29
Applications of Machine Learning

30
Deep Learning(DL)
 Deep Learning(DL): is a subfield of machine learning(ML) that deals with
algorithms inspired from the biological structure and functioning of a brain
to aid machines with intelligence.
 Deep learning uses several layers of nonlinear processing units for feature
extraction and transformation.
 Each successive layer uses the output from the previous layer as input.

 The word "deep" in "deep learning" refers to the number of layers through
which the data is transformed.
i.e. it evolved from the use of many more hidden layers, making it a “deep” network to
learn more complex patterns.

 A deep learning system is self-teaching, learning as it goes by filtering


information through multiple hidden layers, in a similar way to humans.31
Layers in Deep Learning
 In its most basic form, DL models are designed using neural network
architecture.
 A neural network(Artificial neural network) is a hierarchical organization of
neurons (similar to the neurons in the brain) with connections to other
neurons.
 These neurons pass a message or signal to other neurons based on the
received input and form a complex network that learns with some feedback
mechanism and it contains the following layers.
 The input layer:
It receives all the inputs(features)
 Hidden Layers:
All the layers in between the input and output layers are called
hidden layers. There can be n number of hidden layers.
The number of hidden layers and neurons in each layer will depend
on the use-case(task) you are trying to solve.
 Output Layers:
It provides the desired output. 32
Layers in Deep Learning(cont’d)
 The following figure shows the layers in Deep Learning
implementation.

33
Layers in Deep Learning(cont’d)
 As you can see in the preceding figure, the input data is consumed
by the neurons in the first hidden layer produces output, which then
provides this output as an input to the next layer and so on,
eventually resulting in the final output.
 Each layer can have one or many neurons, and each of them will
compute a small function (e.g., activation function).
 The connection between two neurons of successive layers would
have an associated weight.

34
Layers in Deep Learning(cont’d)
 The weight defines the influence of the input to the output for the
next neuron and eventually for the overall final output.
 The initial weights would all be random during the model training,
but these weights are updated iteratively to learn to predict a correct
output.
 Decomposing the network, we can define few logical building blocks
like input, neuron, layer, weight, output, an activation function inside
the neuron to compute a learning process.

35
Deep Learning Applications
 Deep learning is the next big leap after machine learning with a more
advanced implementation.
 Currently, it is heading towards becoming an industry standard bringing
a strong promise of being a game changer when dealing with raw
unstructured data.

Deep learning has produced good results for a few applications such as
 Image recognition

 Molecular biology, Bioinformatics, Brain tumor detection, medical image analysis

 Self-driving cars

 Automatic speech recognition and Natural Language Processing (NLP).

 Drug discovery and toxicology.

 Mobile advertising, Recommendation systems and Financial fraud detection , and so on.
36
Deep Learning Models/Algorithms
 The most commonly used deep neural networks or deep learning
models are as follows:
 Convolutional neural networks(CNNs)

 Recurrent neural networks(RNNs)

 Long short-term memory(LSTM)

 Back propagation

 Activation Functions

 Deep Neural Networks (DNNs)

37
Convolutional Neural Networks(CNNs)
 Convolutional Neural Networks are a type of Deep Learning
Algorithm that take most of the time the image as an input and learn
the various features of the image through filters.

CNNs used for:


 Image detection, image recognition(classification) and Medical image analysis

 CNNs are powering major advances in machine vision, which has obvious
applications for self-driving cars, robotics, drones.
 CNNs used in other tasks such as natural language translation/generation and
sentiment analysis.
 CNNs are also being used in drug discovery where they prove to be an efficient
tool for identifying the interaction between the molecules and the biological
proteins for the identification of potential treatments 38
Recurrent Neural Networks(RNNs)
 RNN is designed to recognize a data set's sequential attribute and use

patterns to predict the next likely scenario.

 For example, a traditional neural network cannot predict the next

word in the sequence based on the previous sequences.

However, RNN most definitely can.

 Recurrent Neural networks, as the name suggests are recurring.

 Therefore, they execute in loops allowing the information to persist in

memory, and inform the final output.

 It is a powerful approach to processing sequential data like sound,

time series data, and written natural language 39


Here are some applications of RNNs
 Natural language translation/Machine Translation-translate the text from one

language to the other

 Image captioning: detect the images and provide their description in the form of

tags

 Speech recognition/synthesis-classifying speeches and converting them into text

without loss of context

 Time-series prediction: time-series data involving prices of stock prices that

change with time, sensor readings, medical records,

 Sentiment analysis: used to find sentiments/opinion of the sentence. That is to

mine positivity, negativity or the neutrality of the sentence.

40
Reading Assignment
Long short-term memory(LSTM)

Back propagation

Activation Functions

Deep Neural Networks (DNNs)

2013 41
! ! !
d !
E n
h e
T
42

You might also like