Unit-1 ML Material
Unit-1 ML Material
UNIT – I
SYLLABUS
INTRODUCTION
• ARTIFICAL INTELLIGENCE
• MACHINE LEARNING
• DEEP LEARNNG
STATISTCAL LEARNING
➔ Introduction to AI: -
Artificial + Intelligence
• AI can create a machine with programmed algorithm. Which can work with own
intelligence.
• AI cannot need to use preprogram machine to do some work.
(or)
Definition of AI: -
Human beings
Convert
Algorithms
Implement
Machine
AI is not related to computer science. It is also related with maths, biology, Psychology, etc.,
Human takes more time but computer can perform very fast.
Needs of AI: -
• AI can create software / devices which can solve real world problems vary easily&
accuracy.
• AI can create your personal virtual assistant such as “siri”, “cortana”, “Google
Assistant”, “Gemini” etc.,
2. Solve Knowledge
4. Building a machine
Application of AI: -
Every branch of Science, Engineering and Technology shares the tools and techniques
available in the domains of AI.
1. Game Playing: -
• Game playing is one of the leading domains where AI has been applied with
great successful.
2. Expert Systems: -
• NLP is a technique that builds ability in machines to ready & understand the
languages that humans speak.
4. Image Understanding: -
• 2D array contains grey levels can be used to received digital images that
recognized by video camera.
5. Robotics: -
6. Finance: -
✓ Invest in stocks
7. Music: -
9. Hospitals: -
• A medical clinic use AI system to organize bed schedule, make a staff rotation,
heart sound analysis identify tumors.
• It is able to extract information from its vision computer vision plays its role
here to recognize the object as an image & identify the task.
• The image data can be in the form of picture, videos, multidimensional data
from a medical scanner or multiple cameras.
Advantages of AI: -
• High speed
• High reliability
• Digital Assistant
• High Cost
• No feelings / emotions
• No original creations
(Or)
• Machine learning is an sub field of AI that provides system that ability tool
automatically improve from experience without being explicitly programmed.
• It is a data driven technology. ML is similar to data mining and it can work large
amount of data.
Types of ML:
1. Supervised Learning
2. Unsupervised Learning
3. Reinforcement learning
1) Supervised Learning: -
• The labeled data means some input data is already tagged with current output.
• If any wrong data is given then send feed back given to machine.
2) Unsupervised Learning:
Unsupervised Learning is a learning method with any supervision.
• The training is provided to the machine with the set of data that not been
classified and the algorithms needs to act on that data without any supervision.
ii. Association
i. Clustering: Grouping the objects into clusters.
3) Reinforcement Learning:
Machine learning is a buzzword for today's technology, and it is growing very rapidly
day by day.
We are using machine learning in our daily life even without knowing it such as Google
Maps, Google assistant, Alexa, etc.
Below are some most trending real-world applications of Machine Learning:
1. Image Recognition:
2. Speech Recognition:
While using Google, we get an option of "Search by voice," it comes under speech
recognition, and it's a popular application of machine learning.
Example: Google Assistant, Siri, Cortana, and Alexa
3. Traffic prediction:
If we want to visit a new place, we take help of Google Maps, which shows us the
correct path with the shortest route and predicts the traffic conditions.
It predicts the traffic conditions such as whether traffic is cleared, slow-moving, or
heavily congested with the help of two ways:
Real Time location of the vehicle form Google Map app and sensors
Average time has taken on past days at the same time.
4. Product recommendations:
7. Medical Diagnosis:
Input Layer: -
Input nodes receives inputs/ information from
the outside world.
Hidden Layer: -
Hidden layer is set of neurons where all the computations are performed on the
input data.
Any number of hidden layers are used in neural network. But the simple network
consists only one hidden layer.
Output Layer: -
The output layer is the output / Conclusion derived from all the computations
performed.
There can be single or multiple nodes in the output layer.
If we give binary classification problem the output node is 1.
If we are give input as multi class classification, the output nodes are more than
one.
2) Convolutional Neural Network: -
Convolutional Neural Network (CNN) is similar to a multilayer perceptron
network.
The difference is network learns structures & purpose they are mostly used.
CNN can be applied in domain of computer vision problems / image processing
etc.,
If the given image is color then use three (3) as size or gray image use 1.
The CNN used to reduce the number of parameters & speed up the training of the
model.
3) Recurrent Neural Network:- (RNN)
The RNN is used to solve the problem occurs in CNN.
Problems with CNN. We have input & It produce one output. In CNN it doesn’t
maintain internal memory.
Every input is independent from other input.
CNN cannot solve problems like sentences, stock price & Time Series.
In RNN, each neuron or unit of RNN uses its internal memory to maintain
information about the previous output.
When it is required to predict the next word of sentence. The previous word are
required.
The RNN is used to member the previous output.
The most & main important features of RNN is Hidden layers.
The Hidden layers have a memory which remembers all the information what has
be calculated.
It can also reduce the complexity of parameters.
Applications of Deep Learning:-
Automatic colouring of black & white images.
Automatically adding sounds to silent movies.
Automatic machine translation.
Object classification & detection in photographs.
Automatic text generations.
Automatic handwriting generation.
Recommendation engine.
Chat bots & Speech recognization.
Image recognization, IOT, Computer Vision.
MAIN CHALLENGES OF MACHINE LEARNING
There are a lot of challenges that machine learning professionals face to inculcate ML skills
and create an application from scratch.
The aim is to basically The aim is to increase It attains the highest rank in terms
increase chances of accuracy not caring much of accuracy when it is trained
success and not accuracy. about the success ratio. with large amount of data.
Examples of AI:
Examples of ML: Virtual
Google’s AI-Powered Examples of DL: Sentiment
Personal Assistants: Siri,
Predictions, Ridesharing based news aggregation, Image
Alexa, Google, etc., Email
Apps Like Uber and Lyft, analysis and caption generation,
Spam and Malware
Commercial Flights Use etc.
Filtering.
an AI Autopilot, etc.
To achieve these goals one must rely on knowledge from three (3) important pillars of the
mathematical science:
1. Function Approximation
2. Optimization
3. Probability & Statistics
1) Functional Approximation: -
• A mathematical function is used to represent the relationship between the
variables.
Example: f (x) = x → y
y determines x
• As a data scientist, you need to understand how data to be represented using least
mount of computer processing time & memory.
Understanding data
Estimation: - Estimation means find a values that is nearest to the original values but not
exact value.
• Risk management plays a crucial role in machine learning of building effective and
reliable.
• At a high level the statistical risk measures the quality of the learning algorithm.
• In ML risks occurs when training data is more & testing data is less otherwise
training data is less & testing data is more.
3. Cross Validation
4. Loss Functions
1) Empirical Risk Minimization: [ERM]
• As we don’t know parameter “p” we can’t compute the true risk but we can
compute the empirical risk based on given input data (or) training data (xi, yi.
where i = 1, 2, 3, ……….., n).
• ERM compute only Temporarily risk not True risk.
• It is a statistical learning algorithm used to find the optional solution out of a
set of possible solution based on sample data.
75% 25%
Cross validation is the mechanism to identify how much data is used for
training & how much data is used for testing to get an accurate results.
Block is used for Testing
1 2 3 4
4) LOSS Function:
• Loss function quantifies the difference between the predefined values and
actual values.
• It is also known as Error function (or) Lost function.
• There are two (2) types of LOSS functions
i. Classification Model
ii. Regression Model
Key Concepts
Hypothesis Set: A set of possible functions (models) from which we aim to choose the best
one.
Loss Function: Measures the error between the predicted and actual values. Common
examples include mean squared error for regression and cross-entropy for classification.
Empirical Risk: The average loss over the training sample. If the training set consists of
𝑁 samples and the loss function is 𝐿, the empirical risk is given by:
𝑅𝑒𝑚𝑝(ℎ)=(1/𝑁) ∑ 𝐿(ℎ(𝑥𝑖),𝑦𝑖)
where ℎ(𝑥𝑖) is the prediction of the model ℎ for the input 𝑥𝑖, and 𝑦𝑖 is the actual output.
Example
Let's consider a simple example with linear regression.
{(1,2),(2,2.5),(3,3.5)}
𝐿(ℎ(𝑥𝑖),𝑦𝑖)=(ℎ(𝑥𝑖)−𝑦𝑖)2
4.Empirical Risk Calculation:
Why ERM?
Practical: Provides a concrete criterion to select the best model based on observed data.
Theoretical Foundation: Forms the basis for many machine learning algorithms, ensuring
they generalize well to unseen data.
Flexibility: Can be applied to various types of loss functions and hypothesis sets.
ERM is a core concept in machine learning and helps in building models that perform well on
training data, hoping they will also perform well on new, unseen data.
Advantages of Empirical Risk Minimization
Flexibility: ERM can be applied to various types of models and loss functions, making it
versatile across different problem domains.
Adaptability: Can be adapted to different learning algorithms, from linear regression to deep
neural networks, by choosing appropriate loss functions and hypothesis sets.
Overfitting: Focusing solely on minimizing empirical risk may lead to overfitting, where the
model performs well on training data but poorly on new data.
Dependence on Training Data Quality: ERM relies heavily on the quality and
representativeness of the training data. If the data is biased or noisy, the model's performance
will suffer.
Choice of Loss Function: The effectiveness of ERM depends on the choice of loss function,
which can be challenging to select and may not always capture the true cost of prediction
errors.
Local Minima: In non-convex optimization problems, ERM can get stuck in local minima,
leading to suboptimal models.