0% found this document useful (0 votes)
22 views36 pages

Upload Unit 1

The document outlines the vision and mission statements of a university and an institute, emphasizing their commitment to providing world-class education and fostering innovation and entrepreneurship. It details program educational objectives and specific outcomes related to machine learning, along with course objectives and learning outcomes. Additionally, it covers course contents, including various machine learning concepts, techniques, and applications, supported by recommended textbooks and reference materials.

Uploaded by

punia4901
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)
22 views36 pages

Upload Unit 1

The document outlines the vision and mission statements of a university and an institute, emphasizing their commitment to providing world-class education and fostering innovation and entrepreneurship. It details program educational objectives and specific outcomes related to machine learning, along with course objectives and learning outcomes. Additionally, it covers course contents, including various machine learning concepts, techniques, and applications, supported by recommended textbooks and reference materials.

Uploaded by

punia4901
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/ 36

Lecture : Introduction to Subject

Vision and Mission Statements of the University

To be a University capable of offering world class futuristic


Vision of the education, research, and outreach services for producing socially
responsible competent professionals capable of working in a
University multidisciplinary environment with abilities of innovation and
entrepreneurship.
 To provide and upgrade education, training and research in
technical education and to create entrepreneurship and conducive
environment for pursuit of technical education in close cooperation
with industries.
Mission of the  To offer world class futuristic education through effective
University teaching-learning-evaluation processes that meet high standards for
excellence in knowledge dissemination.
 To benchmark education processes and inculcate contemporary
skills with moral values in all concerned for sustainable society.
 To enable outreach activities for socio-economic development of
the region.
 To contribute its expertise, experience and leadership for
innovations, competitiveness and better quality of life.

Vision and Mission Statements of the Institute

Vision of the To impart education in Engineering with training, skill up gradation


Institute and research in futuristic technologies and niche areas.

 To develop the professionals having basic and advanced


competencies so that they can serve the Society & Industry, and
face the global challenges.
Mission of the  To impart education based on latest knowledge, analytical skills,
Institute management competence through advanced methods of Training,
Research and Strong Institute-Industry interface.
 To help create innovative and entrepreneurial professional.
 To inculcate strong moral values for a disciplined professional
growth.

Program Educational Objectives (PEOs)


PEO 1 To equip the students with skills so that they can work and contribute to
the continuously changing landscape of IT Industry.

PEO 2 To provide research oriented education with knowledge of state-of-art


analytical and experimental tools to enable students to pursue higher
studies in institutions of repute in India and abroad.

PEO 3 To inculcate culture of professionalism, ethical conduct, team work with


good communication skills to enable the students to be successful in their
career and enable them to launch start-ups in their chosen field.

Program Specific Outcomes (PSOs)

PSO 1 Students will have the ability to apply software engineering principles to
design, build, test, and deliver solutions for Software Industry.
PSO 2 The students will be able to use programming, database, and networking and
web development concepts for developing solutions for real-life problems.

Course Objectives:
In this course we will study the basic component of an intelligence system i.e. machine learning, their
functions, mechanisms, policies and techniques used in their implementation and examples.

Course Learning Outcomes:


1. List various approaches of Machine Learning.
2. Describe machine learning algorithms to solve the real world problems
3. Develop Hypothesis and machine learning models
4. Identify appropriate models for solving machine learning problems.
5. Apply learning techniques to solve real world machine learning problems.
6. Evaluate and interpret the results of the algorithms.

COURSE CONTENTS:
Unit –I
Introduction to machine learning, scope and limitations, regression, probability, statistics and
linear algebra for machine learning, convex optimization, data visualization, hypothesis function
and testing, data distributions, data preprocessing, data augmentation, normalizing data sets,
machine learning models, supervised and unsupervised learning.

Unit –II
Linearity vs non linearity, activation functions like sigmoid, ReLU, etc., weights and bias,
loss function, gradient descent, multilayer network, backpropagation, weight initialization,
training, testing, unstable gradient problem, auto encoders, batch normalization, dropout, L1 and
L2 regularization, momentum, tuning hyper parameters.
Unit –III
Convolutional neural network, flattening, subsampling, padding, stride, convolution layer,
pooling layer, loss layer, dance layer 1x1 convolution, inception network, input channels,
transfer learning, one shot learning, dimension reductions, implementation of CNN like
tensor flow, keras etc.
Unit –IV
Recurrent neural network, Long short-term memory, gated recurrent unit, translation, beam
search and width, Bleu score, attention model, Reinforcement Learning, RL-framework,
MDP, Bellman equations, Value Iteration and Policy Iteration, , Actor-critic model, Q
learning, SARSA
Unit –V
Support Vector Machines, Bayesian learning, application of machine learning in computer
vision, speech processing, natural language processing etc, Case Study: ImageNet Competition.

TEXT BOOKS RECOMMENDED:


1. Christopher M. Bishop, “Pattern Recognition and Machine Learning”, Springer-Verlag
2. New York Inc., 2nd Edition, 2011.
3. Tom M. Mitchell, “Machine Learning”, McGraw Hill Education, First edition, 2017.
4. Ian Goodfellow and YoshuaBengio and Aaron Courville, “Deep Learning”, MIT
Press,2016

REFERENCE BOOKS:

1. Aurelien Geon, “Hands-On Machine Learning with Scikit-Learn and Tensorflow:Concepts,


Tools, and Techniques to Build Intelligent Systems”,Shroff/O'Reilly; Firstedition (2017).
2. Francois Chollet, "Deep Learning with Python", Manning Publications, 1st Ed. 2018.
3. Andreas Muller, "Introduction to Machine Learning with Python: A Guide for DataScientists",
Shroff/O'Reilly; First edition (2016).
4. Russell, S. and Norvig, N. “Artificial Intelligence: A Modern Approach”, Prentice
HallSeries in Artificial Intelligence. 2003.
NOTES

UNIT –I

Introduction to machine learning, scope and limitations, regression, probability,


statistics and linear algebra for machine learning, convex optimization, data
visualization, hypothesis function and testing, data distributions, data preprocessing,
data augmentation, normalizing data sets, machine learning models, supervised and
unsupervised learning.

Course Outcome Bloom’s Weightage


Level
BOCS -605(B).1 Understand complexity of Machine BL2 20 %
Learning algorithms and their limitations;

Lecture No. 1
Today's Agenda:
 Introduction to Machine Learning: Understanding the origin and historical background
of machine learning.

 Real world examples of Machine Learning: Exploring the Real world examples of
Machine Learning.

 Types of Machine Learning: Briefly overviewing the three types of Machine Learning.

Introduction to ML

Arthur Samuel, an early American leader in the field of computer gaming and artificial
intelligence, coined the term “Machine Learning” in 1959 while at IBM. He defined machine
learning as “the field of study that gives computers the ability to learn without being explicitly
programmed “. However, there is no universally accepted definition for machine learning.
Different authors define the term differently. We give below two more definitions.

 Machine learning is programming computers to optimize a performance criterion using


example data or past experience. We have a model defined up to some parameters, and
learning is the execution of a computer program to optimize the parameters of the model
using the training data or past experience. The model may be predictive to make
predictions in the future, or descriptive to gain knowledge from data.

A computer program is said to learn from experience E with respect to some class of tasks T
and performance measure P, if its performance at tasks T, as measured by P, improves with
experience E.

Examples

Handwriting recognition learning problem

Task T : Recognizing and classifying handwritten words within images


Performance P : Percent of words correctly classified
Training experience E: A dataset of handwritten words with given classifications .

A robot driving learning problem

Task T : Driving on highways using vision sensors


Performance P : Average distance traveled before an error
Training experience E : A sequence of images and steering commands recorded
while observing a human driver.

Day to Day Applications of Machine Learning (Discussion ,in details)

Machine Learning model

Model is a mathematical formula which is a result of Machine Learning algorithm


implementation It has measurable parameters that can be used for prediction. Models can be
trained by modifying their parameters in order to achieve better results. It is possible to say
that models are representations of what a Machine Learning system has learned from the
training data.

Diagram visualizing difference between Machine Learning Algorithm and Machine Learning Model.
Types of Machine learning

There are three most regularly listed categories of Machine Learning:

 Supervised Learning
 Unsupervised Learning
 Reinforcement Learning

A. Supervised learning:

The group of algorithms that require dataset which consists of example input-output pairs. Each
pair consists of data sample used to make prediction and expected outcome called label. Word
“supervised” comes from a fact that labels need to be assigned to data by the human supervisor.
In training process, samples are being iteratively fed to the model. For every sample, the model
uses the current state of parameters and returns a prediction. Prediction is compared to label, and
the difference is called an error. The error is a feedback for the model of what went wrong and
how to update itself in order to decrease the error in future predictions. This means that model
will change the values of its parameters according to the algorithm based on which it was created.

Diagram demonstrating how Supervised Learning works.

Supervised Learning models are trying to find parameter values that will allow them to
perform well on historical data. Then they are used for making predictions on unknown data,
that was not a part of training dataset.

There are two main problems that can be solved with Supervised Learning:

Classification — process of assigning category to input data sample. Example usages:


predicting whether a person is ill or not, detecting fraudulent transactions, face classifier.

Regression – process of predicting a continuous, numerical value for input data sample.
Example usages: assessing the house price, forecasting grocery store food demand,
temperature forecasting.
Example of Classification and Regression models

Summary
Machine learning (ML) has become incredibly important in today's world, permeating nearly
every aspect of our lives. Its ability to learn from data and improve its performance over time
makes it a powerful tool for a variety of tasks, from recommending products on Amazon to
predicting fraud in financial transactions.
Lecture No. 2
Today's Agenda:
 Detail discussion on linear algebra for Machine Learning: Discussion on
Mathematics concepts behind the Linear Regression model

 Case study of Linear Regression: Exploring the Real world examples of each of its
types of Machine Learning.

Linear Algebra for Machine Learning

Linear Regression

Linear regression is a simple and versatile statistical technique used to model the
relationship between a dependent variable (target) and one or more independent
variables (features). The primary objective of linear regression is to find the best-
fitting straight line through the data points, which allows us to predict the dependent
variable based on the values of the independent variables.

Mathematically, a linear regression model can be represented as:


y = β0 + β1x1 + β2x2 + ... + βnxn + ε
Where:
y is the dependent variable (target).
β0 is the y-intercept.
β1, β2, ..., βn are the coefficients representing the impact of each independent
variable.
x1, x2, ..., xn are the independent variables (features).
ε represents the error term, capturing the deviations between the actual and
predicted values.
Understanding the Linear Regression Line:
The "best-fitting" straight line is determined by minimizing the sum of squared
differences between the predicted and actual values. This method is known as the
Ordinary Least Squares (OLS) technique. The line's equation is derived by
calculating the coefficients (β0, β1, β2, ..., βn) that minimize this sum, allowing the
model to accurately represent the data.
Applications of Linear Regression:
 Prediction: Linear regression is widely used for making predictions in
various fields such as finance, marketing, and economics. For instance,
predicting stock prices, sales forecasts, or housing prices based on historical
data.
 Trend Analysis: Linear regression helps identify trends and patterns in data,
enabling businesses to make informed decisions and understand how certain
variables impact their outcomes.
 Impact Assessment: By analyzing the coefficients of the independent
variables, linear regression helps understand the strength and direction of
their impact on the dependent variable.
 Outlier Detection: Linear regression can identify outliers that deviate
significantly from the trend, potentially indicating data quality issues or
important anomalies.
 Forecasting: Linear regression can be used to create time series forecasts,
predicting future values based on past trends.
Challenges and Limitations:
While linear regression is a powerful tool, it does have some limitations. Notable
challenges include:
 Assumption of Linearity: Linear regression assumes a linear relationship
between the dependent and independent variables. If the relationship is more
complex, other algorithms like polynomial regression or nonlinear regression
might be more appropriate.
 Sensitivity to Outliers: Linear regression is sensitive to outliers, which can
significantly affect the model's performance. Preprocessing and outlier
handling techniques are essential to mitigate this issue.
 Multicollinearity: When independent variables are highly correlated,
multicollinearity can impact the model's interpretability and accuracy.
Feature selection or regularization methods can address this problem.
LINEAR REGRESSION FOR ADMISSION PREDICTION- A
COMPETITIVE STRATEGY CASE STUDY
Summary
 Linear regression is a fundamental statistical technique used to model the relationship
between a dependent variable and one or more independent variables. Imagine it as a
detective uncovering the hidden connection between two things, like the price of a
house and its square footage.
 The case study model will improve the school’s ability to predict the chance of
admission for each applicant more accurately, which should help reduce the risk of
admitting students who are likely to perform poorly or drop out early.

Lecture No. 3
Today's Agenda:
 Detail discussion on Probability & statistics: Discussion on Probability & statistics

 Practising numerical problems on Probability & statistics: Exploring the Real world
examples of each of its types of Machine Learning.

Probability and Statistics for Machine Learning

Probability quantifies the likelihood of an event occurring. For example, if you roll a fair,
unbiased die, then the probability of 1 turning up is 1/6.

Independence

Two events A and B are said to be independent if the occurrence of A does not affect event B.
For example, if you toss a coin and roll a die, the outcome of the die has no effect on whether the
coin shows heads or tails. Also, for two independent events A and B, the probability that A and
B can occur together. So for example, if you want the probability that coin shows heads and die
shows 3

P(A and B) = P(A)*P(B)

Therefore, P = ½ (probability of heads turning up) * ⅙ (probability of 3 turning up) = 1/12

Now let’s talk about events that are not independent. Consider the following table:

Obese Not Obese

Heart Problems 45 15

No heart
10 30
problems

# A survey of 100 people was taken. 60 had heart problems and 40 didn’t. Of the 60 having a
heart problem,
45 were obese. Of the 40 having no heart problem, 10 were obese.

Conditional Probabilities:
If the probability of event A occurring is conditioned on event B, we represent it as

P(A|B)

Now, there is a theorem that helps us calculate this conditional probability. It is called the Bayes
Rule. P(A|B) =P(A and B)/P(B)

Statistics:

Statistics are used to summarize and make inferences about a large number of data points:

Centrality measures
Distributions (especially normal)
Centrality measures and measures of spreads
Mean:

Mean is just an average of numbers. To find out mean, you have to sum the numbers and divide

with the number of numbers. For example, the mean of [1,2,3,4,5] is 15/5 = 3.

Median:

Median is the middle element of a set of numbers when they are arranged in ascending
order. For example, numbers [1,2,4,3,5] are arranged in an ascending order [1,2,3,4,5]. The
middle one of these is 3. Therefore the median is 3. But what if the number of numbers is even
and therefore has no middle number? In that case, you take the average of the two middle-most
numbers. For a sequence of 2n numbers in ascending order, average the nth and (n+1)th number
to get the median. Example – [1,2,3,4,5,6] has the median (3+4)/2 = 3.5

Mode:

Mode is simply the most frequent number in a set of numbers. For example, mode of

[1,2,3,3,4,5,5,5] is 5.

Variance: Variance is not a centrality measure. It measures how your data is spread around the

mean. It is quantified as
Summary

Probability and statistics are the pillars upon which machine learning stands. They provide the
tools and concepts needed to understand data, train models, and make accurate predictions.

Lecture No. 4
Today's Agenda:
 Detail discussion on Convex Optimization: Discussion on Convex Optimization with
example.

 Detail discussion on Data Visualization: Exploring the Data Visualization techniques


of Machine Learning.

Convex Optimization

Convex optimization is a powerful tool used to solve optimization problems in various fields
such as finance, engineering, and machine learning. In a convex optimization problem, the goal is to
find a point that maximizes or minimizes the objective function. This is achieved through iterative
computations involving convex functions, which are functions that always lie above their chords.

The objective function is subject to both equality and inequality constraints. An equality
constraint requires the solution to be exactly at a given point, while an inequality constraint restricts
the solution to a certain range. These constraints are critical in defining the feasible region, which is
the set of all solutions that satisfy the constraints.

Convex optimization in machine learning

Data Visualization
Data Visualization techniques involve the generation of graphical or pictorial

representation of DATA, form which leads you to understand the insight of a given data set.

This visualisation technique aims to identify the Patterns, Trends, Correlations, and Outliers

of data sets.

Benefits of Data Visualization

Patterns in business operations: Data visualization techniques help us to determine the patterns
of business operations. By understanding the problem statement and identifying the solutions in
terms of pattering and applied to eliminate one or more of the inherent problems.

Identify business trends and relate to data: These techniques help us identify market trends by
collecting the data on Day-To-Day business activities and preparing trend reports, which helps
track the business how influences the market. So that we could understand the competitors and
customers. Certainly, this helps to long-term perspective.

Storytelling and Decision making: Knowledge of storytelling from available data is one of the
niche skills for business communication, specifically for the Data Science domain which is
playing a vital role. Using best visualization this role can be enhanced much better way and
reaching the objectives of business problems.
Understand the current business insights and setting the goals: Businesses can understand
the insight of the business KPIs, finding tangible goals and business strategy plannings, therefore
they could optimize the data for business strategy plans for ongoing activities.

Operational and Performance analysis: Increase the productivity of the manufacturing unit:
With the help of visualization techniques the clarity of KPIs depicting the trends of the
productivity of the manufacturing unit, and guiding were to improve the productivity of the
plant.

Example:

Line Chart

Line Chart is a simple data visualization in Python, which is available under Matplotlib.

plt.show()

import numpy as np
import matplotlib.pyplot as plt
# Data
x1 = np.linspace(0, 10, 25)
y1 = np.sin(x) + x/2
x2 = np.linspace(0, 10, 25)
y2 = np.cos(x) + x/2
# Line chart
fig, ax = plt.subplots()
ax.plot(x1, y1, marker = "o",
label = "Sin(x) + x/2")
ax.plot(x2, y2, marker = "o",
label = "Cos(x) + x/2")
ax.legend()
Line charts are used to represent the relation between two data X and Y on the
respective
axis.
Summary
 Convex Optimization stands as a powerful foundation for many machine
learning techniques. It's the art of finding the best possible solution within a
set of constraints, ensuring efficiency and reliability in model training.
 data visualization is an indispensable tool in the machine learning
workflow. It empowers us to understand data, build better models,
communicate effectively, and ultimately, unlock the full potential of
machine learning.

Lecture No. 5

Today's Agenda:
 Detail discussion on Hypothesis Function: Discussion on Hypothesis
Function and space with example.

 Detail discussion on various applications of hypothesis in algorithms

Hypothesis Function and Testing

In most supervised machine learning algorithm, our main goal is to find out a
possible hypothesis Convex optimization can be used to optimize algorithms by
improving the speed at which they converge to a solution. Additionally, it can be used
to solve linear systems of equations by finding the best approximation to the system,
rather than computing an exact answer. Convex optimization plays a critical role in
training machine learning models, which involves finding the optimal parameters that
minimize a given loss function. In machine learning, convex optimization is used to
solve a wide range of problems such as linear regression, logistic regression, support
vector machines, and neural networks. The following are some applications of convex
optimization in training machine learning models:

 Training linear regression models is a classic example of a convex optimization


problem in which the goal is to find the best-fit line that minimizes the sum of
squared errors between the predicted and actual values. The optimization problem
can be formulated as a convex quadratic programming problem, which can be solved
efficiently using convex optimization techniques.
 Training logistic regression models is another example of machine learning
technique that involves finding the optimal parameters that maximize the likelihood
of the observed data. This optimization problem can be formulated as a convex
optimization problem with a log-concave objective function. The use of convex
optimization techniques ensures that the optimization problem has a unique global
minimum, making it more efficient to find the optimal solution.

from the hypothesis space that could possibly map out the inputs to the proper outputs.

The following figure shows the common method to find out the possible hypothesis from the
Hypothesis space:

Hypothesis Space (H):

Hypothesis space is the set of all the possible legal hypothesis. This is the set from which the
machine learning algorithm would determine the best possible (only one) which would best
describe the target function or the outputs.
Hypothesis (h):

A hypothesis is a function that best describes the target in supervised machine learning. The
hypothesis that an algorithm would come up depends upon the data and also depends upon
the restrictions and bias that we have imposed on the data.

Summary
In conclusion, the hypothesis (h) is the core concept in machine learning. It's the bridge
between data and models, guiding the learning process and shaping the predictions made.
Understanding its importance is crucial for effectively building and applying machine
learning models to real-world problems.

Lecture No. 6

Today's Agenda:
 Detail discussion on Data Distributions, Data Pre-processing : Discussion
on Data Distributions, Data Preprocessing, with example.

 Detail discussion on various Data Augmentation, Normalizing Data Sets


techniques

Data Distributions, Data Preprocessing, Data Augmentation, Normalizing Data Sets

Data Distributions, Data Preprocessing:Feature scaling is a data

preprocessing technique used to transform the values of features or variables in

a dataset to a similar scale. The purpose is to ensure that all features contribute

equally to the model and to avoid the domination of features with larger values.
Feature scaling becomes necessary when dealing with datasets containing

features that have different ranges, units of measurement, or orders of

magnitude. In such cases, the variation in feature values can lead to biased

model performance or difficulties during the learning process. There are several

common techniques for feature scaling, including standardization,

normalization, and min-max scaling. These methods adjust the feature values

while preserving their relative relationships and distributions.

Normalizing Data Sets in Machine Learning

Normalizing data is a common preprocessing step in machine learning. It

involves transforming the data so that it has a zero mean and a unit variance.

This can be helpful for several reasons, including:

1. Improved performance of algorithms: Many machine learning

algorithms, such as linear regression and logistic regression, assume that the

data is normally distributed. Normalizing the data can help to improve the

performance of these algorithms.

2. Reduced sensitivity to outliers: Normalizing the data can help to reduce

the sensitivity of machine learning algorithms to outliers. Outliers are data

points that are far away from the rest of the data. They can have a large impact

on the training of a model, and normalizing the data can help to mitigate this

effect.

3. Prevents numerical instability: Normalizing the data can help to prevent

numerical instability in machine learning algorithms. Numerical instability

can occur when the data has a large range of values, and it can lead to

inaccurate results.

Some common methods for Normalizing Data:

1. Mean normalization: This method subtracts the mean of the data from

each data point.

2. Min-max normalization: This method scales the data to a fixed range,


such as [0, 1] or [-1, 1].

3. Z-score normalization: This method subtracts the mean of the data from

each data

point and then divides by the standard deviation.

Normalization is a data preprocessing technique used to transform

features in a dataset to a common scale, improving the performance and

accuracy of machine learning algorithms. The main goal of normalization is

to eliminate the potential biases and distortions caused by the different

scales of features. Some common normalization methods include min-max

scaling, z-score standardization, and log transformation.

Example:

In this example, we’ll demonstrate how to normalize a dataset using the min-

max scaling method from the scikit-learn library.

import numpy as np

from sklearn.preprocessing import MinMaxScaler

data = np.array([[1, 200, 3000],

[2, 300, 4000],

[3, 400, 5000]])

scaler = MinMaxScaler()

normalized_data = scaler.fit_transform(data)

print("Original data:")

print(data)

print("Normalized data:")

print(normalized_data)

Output:

Original data:

[[ 1 200 3000]
[ 2 300 4000]

[ 3 400 5000]]

Normalized data:

[[0. 0. 0. ]

[0.5 0.5 0.5]

[1. 1. 1. ]]

Summary
In summary, normalizing datasets is essential for:

 Fair feature contribution


 Faster model convergence
 Improved model stability
 Reduced outlier influence
 Enhanced model interpretability
 Effective regularization

Lecture No. 7
Today's Agenda:
 Detail discussion on Supervised Machine Learning Discussion on
Supervised Machine learning with real world applications.

 Detail discussion on Unsupervised Machine Learning Discussion on


Unsupervised Machine learning with real world applications.

Supervised learning and Unsupervised Learning

A. Supervised learning:
Supervised learning is the machine learning task of learning a function that
maps an input to an output based on example input-output pairs. The
given data is labeled. Both classification and regression problems are
supervised learning problems.

 Example — Consider the following data regarding patients entering a


clinic . The data consists of the gender and age of the patients and
each patient is labeled as “healthy” or “sick”.
Gender Age Label
M 48 sick
M 67 sick
F 53 healthy
M 49 sick
F 32 healthy
M 34 healthy
M 21 healthy

In supervised machine learning requires the data scientist to train the


algorithm with both labeled inputs and desired outputs. Supervised
learning algorithms are good for the following tasks:

 Binary classification: Dividing data into two categories.

 Multi-class classification: Choosing between more than two types of answers.

 Regression modeling: Predicting continuous values.

 Ensembling: Combining the predictions of multiple machine


learning models to produce an accurate prediction.

B. Unsupervised learning:

Unsupervised learning is a type of machine learning algorithm used to


draw inferences from datasets consisting of input data without labeled
responses. In unsupervised learning algorithms, classification or
categorization is not included in the observations. Example: Consider the
following data regarding patients entering a clinic. The data consists of
the gender and age of the patients.

Gender Age
M 48
M 67
F 53
M 49
F 34
M 21

As a kind of learning, it resembles the methods humans use to figure out


that certain objects or events are from the same class, such as by
observing the degree of similarity between

Group of algorithms that try to draw inferences from non-labeled data (without
reference to known or labeled outcomes). In Unsupervised Learning, there are no
correct answers. Models based on this type of algorithms can be used for discovering
unknown data patterns and data structure itself.
The most common applications of Unsupervised Learning are:
Pattern recognition and data clustering – Process of dividing and grouping similar
data samples together. Groups are usually called clusters. Example usages:
segmentation of supermarkets, user base segmentation, signal denoising.
Reducing data dimensionality – Data dimension is the number of features needed to
describe data sample. Dimensionality reduction is a process of compressing features
into so-called principal values which conveys similar information concisely. By
selecting only a few components, the amount of features is reduced and a small part of
the data is lost in the process. Example usages: speeding up other Machine Learning
algorithms by reducing numbers of calculations, finding a group of most reliable
features in data.
Example of Unsupervised Learning concept. All data is fed to the model and it produces an output on
it’s own based on similarity between samples and algorithm used to create the model.

C. Reinforcement learning:

Branch of Machine Learning algorithms which produces so-called agents. The


agent role is slightly different than classic model. It’s to receive information from
the environment and react to it by performing an action. The information is fed to
an agent in form of numerical data, called state, which is stored and then used for
choosing right action. As a result, an agent receives a reward that can be either
positive or negative. The reward is a feedback that can be used by an agent to
update its parameters.

Training of an agent is a process of trial and error. It needs to find itself in various
situations and get punished every time it takes the wrong action in order to learn.
The goal of optimization can be set in many ways depending on Reinforcement
Learning approach e.g. based on Value Function, Gradient Policy or Environment
Model.
There is a broad group of Reinforcement Learning applications. Majority of them
are the inventions, that are regularly mentioned as most innovative
accomplishments of AI.

Example of solutions where Reinforcement Learning is used. From self-driving cars through various
games such as Go, Chess, Poker or computer ones — Dota or Starcraft, to manufacturing.

Simulating the movement of 3D models is a complicated task. Such models need to


interact with different models in a given environment. Reinforcement Learning is
becoming more actively used as a tool for solving this problem, as the results it
produces seem very trustworthy for human eye and algorithms are capable of
automatically adjusting to rules describing the environment.

Summary
There are three main types of machine learning, each with its unique characteristics and
applications:
1. Classification: When inputs are divided into two or more classes, the learner must
produce a model that assigns unseen inputs to one or more (multi-label classification) of these
classes. This is typically tackled in a supervised way. Spam filtering is an example of
classification, where the inputs are email (or other) messages and the classes are “spam” and
“not spam”.
2. Regression: Which is also a supervised problem, A case when the outputs are
continuous rather than discrete.
3. Clustering: When a set of inputs is to be divided into groups. Unlike in classification,
the groups are not known beforehand, making this typically an unsupervised task.
# Labeled data is data that has some predefined tags such as name, type, or number. For example, an
image has an apple or banana. At the same time, unlabeled data contains no tags or no specified
name.
NOTES

UNIT –II

Linearity vs non linearity, activation functions like sigmoid, ReLU, etc.,


weights and bias, loss function, gradient descent, multilayer network,
backpropagation, weight initialization, training, testing, unstable gradient
problem, auto encoders, batch normalization, dropout, L1 and L2
regularization, momentum, tuning hyper parameters.

Course Outcome Bloom’s Weightage


Level
BOCS -605(B).2 Understand modern notions in data BL2 20 %
analysis oriented computing;
Lecture No. 9

Today's Agenda:
 Detail discussion on Linearity vs non linearity in Machine learning with
real world applications.

 Detail discussion on activation functions like sigmoid, ReLU, etc

Linearity vs non linearity


In the case of the classification problem, the simplest way to find out whether the
data is linear or non-linear (linearly separable or not) is to draw 2-dimensional
scatter plots representing different classes. Here is a picture that represents the linearly
and non-linearly separable dataset and how one can use scatter plots to visualize them.

Here is an example of a linear data set or linearly separable data set. The data set used
is the IRIS data set from sklearn.datasets package. The data represents two different
classes such as Setosa and Versicolor. Note that one can easily separate the data
represented using black and green marks with a linear hyperplane/line.
The code which is used to print the above scatter plot is the following:

import pandas as pd

import numpy as np

from sklearn import datasets

import matplotlib.pyplot as plt

# Load the IRIS Dataset

iris = datasets.load_iris()

X = iris.data

y = iris.target

# Create a scatter plot

plt.scatter(X[:50, 0], X[:50, 1], color='green', marker='o', label='setosa')

plt.scatter(X[50:100, 0], X[50:100, 1], color='black', marker='x', label='versicolor')

plt.xlabel('sepal length [cm]')

plt.ylabel('petal length [cm]')

plt.legend(loc='upper left')

plt.show()

Here is an example of a non-linear data set or linearly non-separable data set. The data set
used is the IRIS data set from sklearn.datasets package. The data represents two different
classes such as Virginica and Versicolor. Note that one can’t separate the data
represented using black and red marks with a linear hyperplane. Thus, this data can be
called as non-linear data.

Fig 2. Non-Linear Data – Linearly Non-Separable Data (IRIS Dataset)

The code which is used to print the above scatter plot to identify non-linear dataset is the
following:

import pandas as pd

import numpy as np

from sklearn import datasets

import matplotlib.pyplot as plt

# Load the IRIS Dataset

iris = datasets.load_iris()

X = iris.data

y = iris.target

# Create a scatter plot

plt.scatter(X[50:100, 0], X[50:100, 1], color='black', marker='x', label='versicolor')

plt.scatter(X[100:150, 0], X[100:150, 1], color='red', marker='+', label='verginica')

plt.xlabel('sepal length [cm]')

plt.ylabel('petal length [cm]')

plt.legend(loc='upper left')

plt.show()
Use Simple Regression Method for Regression Problem
Linear data is data that can be represented on a line graph. This means that there is a
clear relationship between the variables and that the graph will be a straight line. Non-
linear data, on the other hand, cannot be represented on a line graph. This is because
there is no clear relationship between the variables and the graph will be curved.

In case you are dealing with predicting numerical value, the technique is to use
scatter plots and also apply simple linear regression to the dataset, and then check
the least square error. If the least square error shows high accuracy, it can be implied
that the dataset is linear in nature, else the dataset is non-linear. Here is how the scatter
plot would look for a linear data set when dealing with a regression problem.

Fig 3. Linear data set when dealing with a regression problem

In addition to the above, you could also fit a regression model and examine the statistics
such as R-squared, adjusted R-squared, F-statistics, etc to validate the linear relationship
between response and the predictor variables. For instance, if the value of F-statistics is
more than the critical value, we reject the null hypothesis that all the coefficients = 0. This
means that there exists some linear relationship between the response and one or more
predictor variables. You may want to check out this post to learn greater details.
While linear data is relatively easy to predict and model, non-linear data can be more
difficult to work with. However, non-linear data can also provide more insight into
complex systems.

Summary

 Real-world data often exhibits both linear and non-linear characteristics.


 Feature engineering and domain knowledge can help model non-linear relationships more effectively.
 By understanding the distinctions between linear and non-linear data, you'll make informed choices
about algorithms and modeling strategies, leading to more accurate and reliable machine learning
solutions.

You might also like