Python UNIT-5

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 67

MACHINE LEARNING

UNIT-5

:by Gouri Sankar Mishra


[email protected]
WHAT IS MACHINE LEARNING
 In the real world, we are surrounded by humans who can learn
everything from their experiences with their learning capability,
and we have computers or machines which work on our
instructions. But can a machine also learn from experiences or
past data like a human does? So here comes the role of Machine
Learning.
CONTD…

Machine Learning is said as a subset of artificial intelligence that is


mainly concerned with the development of algorithms which allow
a computer to learn from the data and past experiences on their
own. The term machine learning was first introduced by Arthur
Samuel in 1959.

Machine learning enables a machine to automatically learn from


data, improve performance from experiences, and predict things
without being explicitly programmed.

With the help of sample historical data, which is known as training


data, machine learning algorithms build a mathematical model that
helps in making predictions or decisions without being explicitly
programmed.
CONTD…
 Machine learning brings computer science and statistics together
for creating predictive models. Machine learning constructs or
uses the algorithms that learn from historical data. The more we
will provide the information, the higher will be the performance.

 A machine has the ability to learn if it can improve its


performance by gaining more data.
WHAT KIND OF PROBLEMS CAN BE TACKLED USING MACHINE
LEARNING?

 The importance of machine learning can be easily understood by


its uses cases, 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.
 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

 Finding hidden patterns and extracting useful information from


data.
MACHINE LEARNING PROBLEM FRAMING
 A Machine Learning system learns from historical data, builds
the prediction models, and whenever it receives new data,
predicts the output for it. The accuracy of predicted output
depends upon the amount of data, as the huge amount of data
helps to build a better model which predicts the output more
accurately.

 Suppose we have a complex problem, where we need to perform


some predictions, so instead of writing a code for it, we just need
to feed the data to generic algorithms, and with the help of these
algorithms, machine builds the logic as per the data and predict
the output. Machine learning has changed our way of thinking
about the problem. The below block diagram explains the
working of Machine Learning algorithm:
FEATURES OF MACHINE LEARNING:

Machine learning uses data to detect various patterns in a given


dataset.
It can learn from past data and improve automatically.

It is a data-driven technology.

Machine learning is much similar to data mining as it also deals


with the huge amount of the data.
CLASSIFICATION OF MACHINE LEARNING
 At a broad level, machine learning can be classified into three
types:

 Supervised learning
 Unsupervised learning

 Reinforcement learning

 Supervised learning
 Supervised learning is the types of machine learning in which
machines are trained using well "labelled" training data, and on
basis of that data, machines predict the output. The labelled data
means some input data is already tagged with the correct output.
 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.
 Supervised learning is a process of providing input data as well as
correct output data to the machine learning model. The aim of a
supervised learning algorithm is to find a mapping function to map
the input variable(x) with the output variable(y).
 In the real-world, supervised learning can be used for Risk Assessment,
Image classification, Fraud Detection, spam filtering, etc.

 How Supervised Learning Works?


 In supervised learning, models are trained using labelled dataset, where
the model learns about each type of data. Once the training process is
completed, the model is tested on the basis of test data (a subset of the
training set), and then it predicts the output.
 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.
 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.
TYPES OF SUPERVISED MACHINE LEARNING
ALGORITHMS:
 Supervised learning can be further divided into two types of
problems:

 1. Regression
 Regression algorithms are used if there is a relationship between
the input variable and the output variable. It is used for the
prediction of continuous variables, such as Weather forecasting,
Market Trends, etc. Below are some popular Regression
algorithms which come under supervised learning:
 Linear Regression

 Regression Trees

 Non-Linear Regression

 Bayesian Linear Regression

 Polynomial Regression
 2. 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.

 Spam Filtering,
 Random Forest

 Decision Trees

 Logistic Regression

 Support vector Machines


 Advantages of Supervised learning:
 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.

 Disadvantages of supervised learning:


 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.
UNSUPERVISED LEARNING
 As the name suggests, unsupervised learning is a machine learning
technique in which models are not supervised using training dataset.
Instead, models itself find the hidden patterns and insights from the
given data. It can be compared to learning which takes place in the
human brain while learning new things. It can be defined as:

 Unsupervised learning is a type of machine learning in which models


are trained using unlabeled dataset and are allowed to act on that data
without any supervision.

 Unsupervised learning cannot be directly applied to a regression or


classification problem because unlike supervised learning, we have the
input data but no corresponding output data. The goal of unsupervised
learning is to find the underlying structure of dataset, group that data
according to similarities, and represent that dataset in a compressed
format.
CONTD…
 Example: Suppose the unsupervised learning algorithm is given
an input dataset containing images of different types of cats and
dogs. The algorithm is never trained upon the given dataset,
which means it does not have any idea about the features of the
dataset. The task of the unsupervised learning algorithm is to
identify the image features on their own. Unsupervised learning
algorithm will perform this task by clustering the image dataset
into the groups according to similarities between images.
IMPORTANCE OF UNSUPERVISED LEARNING
 Unsupervised learning is helpful for finding useful insights from
the data.

 Unsupervised learning is much similar as a human learns to think


by their own experiences, which makes it closer to the real AI.

 Unsupervised learning works on unlabeled and uncategorized


data which make unsupervised learning more important.

 In real-world, we do not always have input data with the


corresponding output so to solve such cases, we need
unsupervised learning.
WORKING OF UNSUPERVISED LEARNING
 Here, we have taken an unlabeled input data, which means it is not categorized
and corresponding outputs are also not given. Now, this unlabeled input data is
fed to the machine learning model in order to train it. Firstly, it will interpret
the raw data to find the hidden patterns from the data and then will apply
suitable algorithms such as k-means clustering, Decision tree, etc.
 Once it applies the suitable algorithm, the algorithm divides the data objects
into groups according to the similarities and difference between the objects.
ALGORITHM:
 The unsupervised learning algorithm can be further categorized
into two types of problems:
 Clustering: 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. Cluster analysis finds the commonalities between the data
objects and categorizes them as per the presence and absence of
those commonalities.
 Association: An association rule is an unsupervised learning
method which 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.
UNSUPERVISED LEARNING ALGORITHMS:
 Below is the list of some popular unsupervised learning
algorithms:

 K-means clustering
 KNN (k-nearest neighbors)

 Hierarchal clustering

 Anomaly detection

 Neural Networks

 Principle Component Analysis

 Independent Component Analysis

 Apriori algorithm

 Singular value decomposition


ADVANTAGES OF UNSUPERVISED LEARNING
 Unsupervised learning is used for more complex tasks as
compared to supervised learning because, in unsupervised
learning, we don't have labeled input data.
 Unsupervised learning is preferable as it is easy to get unlabeled
data in comparison to labeled data.

 Disadvantages of Unsupervised Learning


 Unsupervised learning is intrinsically more difficult than
supervised learning as it does not have corresponding output.
 The result of the unsupervised learning algorithm might be less
accurate as input data is not labeled, and algorithms do not know
the exact output in advance.
LEARNING
Supervised Learning Unsupervised Learning
Supervised learning algorithms are Unsupervised learning algorithms are
trained using labeled data. trained using unlabeled data.
Supervised learning model takes Unsupervised learning model does not
direct feedback to check if it is take any feedback.
predicting correct output or not.
Supervised learning model predicts Unsupervised learning model finds
the output. the hidden patterns in data.
In supervised learning, input data is In unsupervised learning, only input
provided to the model along with the data is provided to the model.
output.
The goal of supervised learning is to The goal of unsupervised learning is
train the model so that it can predict to find the hidden patterns and useful
the output when it is given new data. insights from the unknown dataset.

Supervised learning needs supervision Unsupervised learning does not need


to train the model. any supervision to train the model.
Supervised learning can be Unsupervised Learning can be
categorized classified
in Classification and Regression pro in Clustering and Associations probl
blems. ems.
Supervised learning can be used for Unsupervised learning can be used for
those cases where we know the input those cases where we have only input
as well as corresponding outputs. data and no corresponding output
data.
Supervised learning model produces Unsupervised learning model may
an accurate result. give less accurate result as compared
to supervised learning.
Supervised learning is not close to Unsupervised learning is more close
true Artificial intelligence as in this, to the true Artificial Intelligence as it
we first train the model for each data, learns similarly as a child learns daily
and then only it can predict the correct routine things by his experiences.
output.
It includes various algorithms such as It includes various algorithms such as
Linear Regression, Logistic Clustering, KNN, and Apriori
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.
 RL solves a specific type of problem where decision making is
sequential, and the goal is long-term, such as game-playing,
robotics, etc.
 The agent interacts with the environment and explores it by itself.
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.
Hence, we can say that "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." How a Robotic dog learns the movement of his arms is an
example of Reinforcement learning.
 It is a core part of Artificial intelligence, and all AI agent works
on the concept of reinforcement learning. Here we do not need to
pre-program the agent, as it learns from its own experience
without any human intervention.
 Example: Suppose there is an AI agent present within a maze
environment, and his goal is to find the diamond. The agent
interacts with the environment by performing some actions, and
based on those actions, the state of the agent gets changed, and it
also receives a reward or penalty as feedback.
 The agent continues doing these three things (take action, change
state/remain in the same state, and get feedback), and by doing
these actions, he learns and explores the environment.
 The agent learns that what actions lead to positive feedback or
rewards and what actions lead to negative feedback penalty. As a
positive reward, the agent gets a positive point, and as a penalty,
it gets a negative point.
TERMS USED IN REINFORCEMENT LEARNING
 Agent(): An entity that can perceive/explore the environment and act upon
it.
 Environment(): A situation in which an agent is present or surrounded by.
In RL, we assume the stochastic environment, which means it is random
in nature.
 Action(): Actions are the moves taken by an agent within the environment.
 State(): State is a situation returned by the environment after each action
taken by the agent.
 Reward(): A feedback returned to the agent from the environment to
evaluate the action of the agent.
 Policy(): Policy is a strategy applied by the agent for the next action based
on the current state.
 Value(): It is expected long-term retuned with the discount factor and
opposite to the short-term reward.
 Q-value(): It is mostly similar to the value, but it takes one additional
parameter as a current action (a).
KEY FEATURES OF REINFORCEMENT LEARNING
 In RL, the agent is not instructed about the environment and what
actions need to be taken.
 It is based on the hit and trial process.
 The agent takes the next action and changes states according to the
feedback of the previous action.
 The agent may get a delayed reward.
 The environment is stochastic, and the agent needs to explore it to reach
to get the maximum positive rewards.
 Approaches to implement Reinforcement Learning
 There are mainly three ways to implement reinforcement-learning in
ML, which are:
VALUE-BASED
 The value-based approach is about to find the optimal value function, which is
the maximum value at a state under any policy. Therefore, the agent expects
the long-term return at any state(s) under policy π.

 Policy-based:
 Policy-based approach is to find the optimal policy for the maximum future
rewards without using the value function. In this approach, the agent tries to
apply such a policy that the action performed in each step helps to maximize
the future reward.
 The policy-based approach has mainly two types of policy:
 Deterministic: The same action is produced by the policy (π) at any state.
 Stochastic: In this policy, probability determines the produced action.

 Model-based: In the model-based approach, a virtual model is created for the


environment, and the agent explores that environment to learn it. There is no
particular solution or algorithm for this approach because the model
representation is different for each environment.
ELEMENTS OF REINFORCEMENT LEARNING
 There are four main elements of Reinforcement Learning, which
are given below:

 Policy
 Reward Signal

 Value Function

 Model of the environment

 1) Policy: A policy can be defined as a way how an agent behaves


at a given time. It maps the perceived states of the environment to
the actions taken on those states. A policy is the core element of
the RL as it alone can define the behavior of the agent. In some
cases, it may be a simple function or a lookup table, whereas, for
other cases, it may involve general computation as a search
process. It could be deterministic or a stochastic policy:
 For deterministic policy: a = π(s)
 For stochastic policy: π(a | s) = P[At =a | St = s]

 2) Reward Signal: The goal of reinforcement learning is defined


by the reward signal. At each state, the environment sends an
immediate signal to the learning agent, and this signal is known
as a reward signal. These rewards are given according to the good
and bad actions taken by the agent. The agent's main objective is
to maximize the total number of rewards for good actions. The
reward signal can change the policy, such as if an action selected
by the agent leads to low reward, then the policy may change to
select other actions in the future.
 3) Value Function: The value function gives information about
how good the situation and action are and how much reward an
agent can expect. A reward indicates the immediate signal for
each good and bad action, whereas a value function specifies the
good state and action for the future. The value function depends
on the reward as, without reward, there could be no value. The
goal of estimating values is to achieve more rewards.

 4) Model: The last element of reinforcement learning is the


model, which mimics the behavior of the environment. With the
help of the model, one can make inferences about how the
environment will behave. Such as, if a state and an action are
given, then a model can predict the next state and reward.
 The model is used for planning, which means it provides a way to
take a course of action by considering all future situations before
actually experiencing those situations. The approaches for solving
the RL problems with the help of the model are termed as the
model-based approach. Comparatively, an approach without
using a model is called a model-free approach.

 Difference between Reinforcement Learning and Supervised


Learning
 The Reinforcement Learning and Supervised Learning both are
the part of machine learning, but both types of learnings are far
opposite to each other. The RL agents interact with the
environment, explore it, take action, and get rewarded. Whereas
supervised learning algorithms learn from the labeled dataset and,
on the basis of the training, predict the output.
Reinforcement Learning Supervised Learning

RL works by interacting with the Supervised learning works on the


environment. existing dataset.

The RL algorithm works like the Supervised Learning works as


human brain works when making when a human learns things in
some decisions. the supervision of a guide.

There is no labeled dataset is The labeled dataset is present.


present
No previous training is provided Training is provided to the
to the learning agent. algorithm so that it can predict
the output.
RL helps to take decisions In Supervised learning, decisions
sequentially. are made when input is given.
REINFORCEMENT LEARNING APPLICATIONS
 Robotics: RL is used in Robot navigation, Robo-soccer, walking,
juggling, etc.
 Control: RL can be used for adaptive control such as Factory
processes, admission control in telecommunication, and
Helicopter pilot is an example of reinforcement learning.
 Game Playing: RL can be used in Game playing such as tic-tac-
toe, chess, etc.
 Chemistry: RL can be used for optimizing the chemical reactions.

 Business: RL is now used for business strategy planning.

 Manufacturing: In various automobile manufacturing companies,


the robots use deep reinforcement learning to pick goods and put
them in some containers.
 Finance Sector: The RL is currently used in the finance sector for
evaluating trading strategies.
SEMI-SUPERVISED LEARNING
 The basic disadvantage of supervised learning is that it requires
hand-labeling by ML specialists or data scientists, and it also
requires a high cost to process. Further unsupervised learning also
has a limited spectrum for its applications. To overcome these
drawbacks of supervised learning and unsupervised learning
algorithms, the concept of Semi-supervised learning is
introduced. In this algorithm, training data is a combination of
both labeled and unlabeled data. However, labeled data exists
with a very small amount while it consists of a huge amount of
unlabeled data. Initially, similar data is clustered along with an
unsupervised learning algorithm, and further, it helps to label the
unlabeled data into labeled data. It is why label data is a
comparatively, more expensive acquisition than unlabeled data.
 We can imagine these algorithms with an example. Supervised
learning is where a student is under the supervision of an
instructor at home and college. Further, if that student is self-
analyzing the same concept without any help from the instructor,
it comes under unsupervised learning. Under semi-supervised
learning, the student has to revise itself after analyzing the same
concept under the guidance of an instructor at college.

 Assumptions followed by Semi-Supervised Learning


 To work with the unlabeled dataset, there must be a relationship
between the objects. To understand this, semi-supervised learning
uses any of the following assumptions:
CONTINUITY ASSUMPTION:
 As per the continuity assumption, the objects near each other tend
to share the same group or label. This assumption is also used in
supervised learning, and the datasets are separated by the decision
boundaries. But in semi-supervised, the decision boundaries are
added with the smoothness assumption in low-density
boundaries.
 Cluster assumptions- In this assumption, data are divided into
different discrete clusters. Further, the points in the same cluster
share the output label.
 Manifold assumptions- This assumption helps to use distances
and densities, and this data lie on a manifold of fewer dimensions
than input space.
 The dimensional data are created by a process that has less degree
of freedom and may be hard to model directly. (This assumption
becomes practical if high).
WORKING OF SEMI-SUPERVISED LEARNING
 Semi-supervised learning uses pseudo labeling to train the model with less
labeled training data than supervised learning. The process can combine
various neural network models and training ways. The whole working of semi-
supervised learning is explained in the below points:

 Firstly, it trains the model with less amount of training data similar to the
supervised learning models. The training continues until the model gives
accurate results.
 The algorithms use the unlabeled dataset with pseudo labels in the next step,
and now the result may not be accurate.
 Now, the labels from labeled training data and pseudo labels data are linked
together.
 The input data in labeled training data and unlabeled training data are also
linked.
 In the end, again train the model with the new combined input as did in the
first step. It will reduce errors and improve the accuracy of the model.
DIFFERENCE BETWEEN SEMI-SUPERVISED AND
REINFORCEMENT LEARNING.

 Reinforcement learning is different from semi-supervised


learning, as it works with rewards and feedback. Reinforcement
learning aims to maximize the rewards by their hit and trial
actions, whereas in semi-supervised learning, we train the model
with a less labeled dataset.

 Real-world applications of Semi-supervised Learning-


 Semi-supervised learning models are becoming more popular in
the industries. Some of the main applications are as follows.

 Speech Analysis- It is the most classic example of semi-


supervised learning applications. Since, labeling the audio data is
the most impassable task that requires many human resources,
this problem can be naturally overcome with the help of applying
SSL in a Semi-supervised learning model.
 Web content classification- However, this is very critical and
impossible to label each page on the internet because it needs
mode human intervention. Still, this problem can be reduced
through Semi-Supervised learning algorithms.
 Further, Google also uses semi-supervised learning algorithms to
rank a webpage for a given query.
 Protein sequence classification- DNA strands are larger, they
require active human intervention. So, the rise of the Semi-
supervised model has been proximate in this field.
 Text document classifier- As we know, it would be very
unfeasible to find a large amount of labeled text data, so semi-
supervised learning is an ideal model to overcome this.
FOLLOWING ARE FUNDAMENTAL STEPS OF IMAGE
PROCESSING
CONTD…
 1. Image Acquisition: Image acquisition is the first step of the
fundamental steps of DIP. In this stage, an image is given in the
digital form. Generally, in this stage, pre-processing such as
scaling is done.

 2. Image Enhancement: Image enhancement is the simplest and


most attractive area of DIP. In this stage details which are not
known, or we can say that interesting features of an image is
highlighted. Such as brightness, contrast, etc...

 3. Image Restoration: Image restoration is the stage in which the


appearance of an image is improved.
CONTD…
 4. Color Image Processing: Color image processing is a famous
area because it has increased the use of digital images on the
internet. This includes color modeling, processing in a digital
domain, etc....

 5. Wavelets and Multi-Resolution Processing: In this stage, an


image is represented in various degrees of resolution. Image is
divided into smaller regions for data compression and for the
pyramidal representation.

 6. Compression: Compression is a technique which is used for


reducing the requirement of storing an image. It is a very
important stage because it is very necessary to compress data for
internet use.
 7. Morphological Processing: This stage deals with tools which
are used for extracting the components of the image, which is
useful in the representation and description of shape.

 8. Segmentation: In this stage, an image is a partitioned into its


objects. Segmentation is the most difficult tasks in DIP. It is a
process which takes a lot of time for the successful solution of
imaging problems which requires objects to identify individually.

 9. Representation and Description: Representation and


description follow the output of the segmentation stage. The
output is a raw pixel data which has all points of the region itself.
To transform the raw data, representation is the only solution.
Whereas description is used for extracting information's to
differentiate one class of objects from another.
 10. Object recognition: In this stage, the label is assigned to the
object, which is based on descriptors.

 11. Knowledge Base: Knowledge is the last stage in DIP. In this


stage, important information of the image is located, which limits
the searching processes. The knowledge base is very complex
when the image database has a high-resolution satellite.
SPEECH RECOGNITION
 Speech is the most basic means of adult human communication.
The basic goal of speech processing is to provide an interaction
between a human and a machine.

 Speech processing system has mainly three tasks −

 First, speech recognition that allows the machine to catch the


words, phrases and sentences we speak

 Second, natural language processing to allow the machine to


understand what we speak, and

 Third, speech synthesis to allow the machine to speak.


DIFFICULTIES IN DEVELOPING A SPEECH RECOGNITION
SYSTEM
 You will have to follow the steps given below to build a speech
recognizer −
 Visualizing Audio Signals - Reading from a File and Working on it:
This is the first step in building speech recognition system as it
gives an understanding of how an audio signal is structured. Some
common steps that can be followed to work with audio signals are
as follows −
 Recording: When you have to read the audio signal from a file, then
record it using a microphone, at first.
 Sampling: When recording with microphone, the signals are stored
in a digitized form. But to work upon it, the machine needs them in
the discrete numeric form. Hence, we should perform sampling at a
certain frequency and convert the signal into the discrete numerical
form. Choosing the high frequency for sampling implies that when
humans listen to the signal, they feel it as a continuous audio signal.
 Characterizing the Audio Signal: Transforming to Frequency
Domain
 Characterizing an audio signal involves converting the time
domain signal into frequency domain, and understanding its
frequency components, by. This is an important step because it
gives a lot of information about the signal. You can use a
mathematical tool like Fourier Transform to perform this
transformation.
 Generating Monotone Audio Signal

 The two steps that you have seen till now are important to learn
about signals. Now, this step will be useful if you want to
generate the audio signal with some predefined parameters. Note
that this step will save the audio signal in an output file.
 Feature Extraction from Speech: This is the most important step
in building a speech recognizer because after converting the
speech signal into the frequency domain, we must convert it into
the usable form of feature vector. We can use different feature
extraction techniques like MFCC, PLP, PLP-RASTA etc. for this
purpose.
 Recognition of Spoken Words: Speech recognition means that
when humans are speaking, a machine understands it. Here we
are using Google Speech API in Python to make it happen. We
need to install the following packages for this −
 Pyaudio − It can be installed by using pip install Pyaudio
command.
 SpeechRecognition − This package can be installed by using pip
install SpeechRecognition.
 Google-Speech-API − It can be installed by using the command
pip install google-api-python-client.
APPLICATION OF MACHINE LEARNING IN MEDICAL
DIAGNOSIS
 In medicine, the broad spectrum of algorithms, statistics, and
machine learning AI is constantly increasing. We want to
concentrate on machine learning for medical diagnosis. Yet, in
other areas of healthcare science, this great technology can also be
used. Amongst others, the list of medical machine learning
applications includes:

 Virus outbreak prediction.


 AI can simulate different viruses and illnesses behaviors. It can
prove helpful to nip all new outbreaks in the bud.

 Drug development.
 Learning the symptoms, solutions, and recovery methods, AI can
be vital in designing and manufacturing drugs. It may also help
shorten the time needed to present a new drug on the market.
 Organizing health records: Well-sorted info on health issues, drugs,
treatment, and other records is vital in any organized institution.
Keeping up-to-date facts and figures shortens the processing time
when quick and on-point medical decisions are needed.

 Improved radiotherapy: Cancer treatment is still one of the most


important issues in the modern medical world. Machine learning in
radiotherapy is considered one of the main factors that will help
treat cancer more efficiently.

 Clinical trials: Applying medical ML in clinical trials reduces the


costs of completing any thorough research. For example, it can be
useful in the case of developing a vaccine. By constant monitoring
of the trial patients, machine learning cuts the time of clinical trials.
WHAT ARE THE SYMPTOMS AND DISEASES MACHINE LEARNING
CAN DETECT

 In many cases around the world, the use of machine learning is still
limited. Physicians do not always completely rely on AI, rather
considering it as an addition to their diagnosis. Yet, the truth is that
machine learning needs to be used more often. Why? Well, to keep
on learning. Through gathering information of symptoms and
diseases it can constantly develop new efficient solutions.

 Human disease detection using machine learning


 Right now machine learning can prove useful in determining a lot
of indicators and illnesses. AI is commonly used in cardiology,
neurology, physical medicine and rehabilitation, surgery, and many
more branches of medicine. During the pandemic, medical
diagnosis using machine learning is helpful with predicting
COVID-19. AI detects and analyzes symptoms to determine
whether or not they are signs of the coronavirus.
CLASSIFICATION
 The Classification algorithm is a Supervised Learning technique
that is used to identify the category of new observations on the
basis of training data. In Classification, a program learns from the
given dataset or observations and then classifies new observation
into a number of classes or groups. Such as, Yes or No, 0 or 1,
Spam or Not Spam, cat or dog, etc. Classes can be called as
targets/labels or categories.

 Unlike regression, the output variable of Classification is a


category, not a value, such as "Green or Blue", "fruit or animal",
etc. Since the Classification algorithm is a Supervised learning
technique, hence it takes labeled input data, which means it
contains input with the corresponding output.
 In classification algorithm, a discrete output function(y) is
mapped to input variable(x).

 y=f(x), where y = categorical output


 The best example of an ML classification algorithm is Email
Spam Detector.A

 The main goal of the Classification algorithm is to identify the


category of a given dataset, and these algorithms are mainly used
to predict the output for the categorical data.

 Classification algorithms can be better understood using the


below diagram. In the below diagram, there are two classes, class
A and Class B. These classes have features that are similar to
each other and dissimilar to other classes.
 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.
TYPES OF ML CLASSIFICATION ALGORITHMS:
 Classification Algorithms can be further divided into the Mainly
two category:

 Linear Models
 LogisticRegression
 Support Vector Machines

 Non-linear Models
 K-Nearest Neighbours
 Kernel SVM
 Naïve Bayes
 Decision Tree Classification
 Random Forest Classification
 Clustering or cluster analysis is a machine learning technique,
which groups the unlabelled dataset. It can be defined as "A way
of grouping the data points into different clusters, consisting of
similar data points. The objects with the possible similarities
remain in a group that has less or no similarities with another
group."

 It does it by finding some similar patterns in the unlabelled


dataset such as shape, size, color, behavior, etc., and divides them
as per the presence and absence of those similar patterns.

 It is an unsupervised learning method, hence no supervision is


provided to the algorithm, and it deals with the unlabeled dataset.
 After applying this clustering technique, each cluster or group is
provided with a cluster-ID. ML system can use this id to
simplify the processing of large and complex datasets.
 The clustering technique is commonly used for statistical data
analysis.
 Example: Let's understand the clustering technique with the
real-world example of Mall: When we visit any shopping mall,
we can observe that the things with similar usage are grouped
together. Such as the t-shirts are grouped in one section, and
trousers are at other sections, similarly, at vegetable sections,
apples, bananas, Mangoes, etc., are grouped in separate sections,
so that we can easily find out the things. The clustering
technique also works in the same way. Other examples of
clustering are grouping documents according to the topic.
CONTD…
 The clustering technique can be widely used in various tasks. Some
most common uses of this technique are:
 Market Segmentation

 Statistical data analysis

 Social network analysis

 Image segmentation

 Anomaly detection, etc.

 Apart from these general usages, it is used by the Amazon in its


recommendation system to provide the recommendations as per the
past search of products. Netflix also uses this technique to recommend
the movies and web-series to its users as per the watch history.

 The below diagram explains the working of the clustering algorithm.


We can see the different fruits are divided into several groups with
similar properties.
APPLICATIONS OF CLUSTERING
 Below are some commonly known applications of clustering
technique in Machine Learning:

 In Identification of Cancer Cells: The clustering algorithms are


widely used for the identification of cancerous cells. It divides the
cancerous and non-cancerous data sets into different groups.

 In Search Engines: Search engines also work on the clustering


technique. The search result appears based on the closest object to
the search query. It does it by grouping similar data objects in one
group that is far from the other dissimilar objects. The accurate
result of a query depends on the quality of the clustering
algorithm used.
 Customer Segmentation: It is used in market research to segment
the customers based on their choice and preferences.

 In Biology: It is used in the biology stream to classify different


species of plants and animals using the image recognition
technique.

 In Land Use: The clustering technique is used in identifying the


area of similar lands use in the GIS database. This can be very
useful to find that for what purpose the particular land should be
used, that means for which purpose it is more suitable.
Thank You

Best Wishes for your Examination Ahead

You might also like