Deep Learning Algorithms Overview
Deep Learning Algorithms Overview
DL unit 1 - DL unit 1
UNIT - I
Machine learning algorithms are the core of artificial intelligence, allowing computers
to learn from data, make predictions, and adapt without being explicitly programmed.
These algorithms fall into different categories, each with its own strengths and
weaknesses depending on the type of problem and data available.
1. Supervised learning
Deep Learning 1
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Linear Regression:
A foundational algorithm that models the relationship between a dependent
variable and one or more independent variables by fitting a linear equation to the
observed data.
• Polynomial Regression:
Extends linear regression by allowing for a non-linear relationship between
variables, fitting a polynomial equation.
• Ridge, Lasso, and Elastic Net Regression:
Regularized versions of linear regression that help prevent overfitting by adding
penalty terms to the cost function.
• Support Vector Regression (SVR):
An extension of Support Vector Machines for regression tasks, aiming to find a
hyperplane that best fits the data within a specified margin.
• Decision Tree Regression:
Uses a tree-like model of decisions and their possible consequences to predict
continuous outcomes.
• Random Forest Regression:
An ensemble method that combines multiple decision trees to improve predictive
accuracy and reduce overfitting.
• Gradient Boosting Regression (e.g., XGBoost, LightGBM, CatBoost):
Powerful ensemble methods that build a strong predictive model by sequentially
adding weak learners.
Deep Learning 2
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Logistic Regression:
A widely used algorithm for binary classification, modeling the probability of a
binary outcome.
• Support Vector Machines (SVM):
Creates a hyperplane in a high-dimensional space to separate data points into
different classes.
• Decision Tree Classification:
Similar to decision tree regression, but used for classification tasks, where leaf
nodes represent class labels.
• Random Forest Classification:
An ensemble method for classification, combining multiple decision trees.
• K-Nearest Neighbors (KNN):
A non-parametric algorithm that classifies a data point based on the majority class
among its 'k' nearest neighbors in the feature space.
• Naive Bayes:
A probabilistic classifier based on Bayes' theorem with the assumption of
independence between features.
• Neural Networks (e.g., Multilayer Perceptron):
Inspired by the human brain, these algorithms learn complex patterns through
interconnected layers of nodes.
• Gradient Boosting Machines (GBM):
Ensemble methods like AdaBoost, XGBoost, LightGBM, and CatBoost are also
highly effective for classification.
2. Unsupervised learning:
Clustering :
• K-Means Clustering: Groups data into 'k' clusters based on how close the points
are to each other. The algorithm iteratively assigns data points to the closest
cluster centroid and recalculates the centroid's position until the clusters are
stable.
Deep Learning 3
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
3. Reinforcement learning :
Reinforcement learning trains agents to make decisions by using rewards and penalties.
The goal is to maximize long-term rewards through trial and error. Examples include
robotics and game AI. Algorithms like Q-Learning, R-Learning and Policy Gradient
Methods are used.
4. Semi-supervised learning:
This approach combines supervised and unsupervised learning, using both labeled and
unlabeled data, which is useful when labeled data is limited. Applications include
improving text and image classification models.
Deep Learning 4
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Capacity: A model's capacity refers to its ability to fit a wide range of functions.
High-capacity models can fit more complex relationships, while low-capacity
models are limited to simpler ones.
• Student A (Low Capacity): This student can only understand and solve very
simple, linear equations like y=2x+1. Their brain is like a model with very low
capacity. They can only handle basic patterns, and they would fail if the test
included more complex problems. This is similar to an underfitting model.
The ideal student is one with enough capacity to learn the right amount—not so
little that they underfit, and not so much that they overfit by memorizing every
single practice problem.
• A simple straight line (y=ax+b) has very low capacity. It can only learn linear
relationships in the data. If the data is curved, this model will underfit.
• A complex, curvy line (e.g., y=ax5+bx4+...) has very high capacity. It can learn
very complex, "curved" patterns, even if those patterns are just noise in the data.
This model is more likely to overfit.
So, a model with higher capacity can fit more complex functions, while a model
with lower capacity can only fit simpler functions. The key is to choose a model
with the right capacity for your specific problem to achieve the best fitting.
Deep Learning 5
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Underfitting occurs when a model is too simple (low capacity) to capture the
underlying patterns in the training data, resulting in poor performance on both
training and test sets.
• Characteristics: High bias, low variance. The model makes strong, incorrect
assumptions about the data.
• Overfitting Definition: This happens when a model has too much capacity and
learns the training data too well, including noise and specific details that are not
representative of the true data distribution. While performing well on the training
data, it generalizes poorly to new, unseen data, resulting in a large gap between
training and test error.
• Balancing Capacity: The goal is to find a model with appropriate capacity – one
that is complex enough to learn the significant patterns in the data (avoiding
underfitting) but not so complex that it memorizes noise and fails to generalize
(avoiding overfitting).
Deep Learning 6
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Finding the Right Balance: The aim is to achieve a "good fit" where the model
captures the essential patterns in the data without memorizing noise, striking a
balance between bias and variance. This results in good performance on both
training and test [Link]: For the curved data points example, a well-fitted
model would be a smooth curve that accurately represents the general trend of
the data, ignoring minor fluctuations caused by noise.
Example : Assume that Student study is Training and Exam is a Testing. That
means Bias is Training Error and Variance is a Testing Error.
Deep Learning 7
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
well on both the training data and new data, meaning it generalizes
effectively.
Most machine learning algorithms have several settings that we can use to control the
behavior of the learning algorithm. These settings are called hyperparameters. The
values of hyperparameters are not adapted by the learning algorithm itself (though we
can design a nested learning procedure where one learning algorithm learns the best
hyperparameters for another learning algorithm).
Hyperparameters
• Definition: These are settings that control the learning algorithm's behavior.
Unlike model parameters, they are not learned during training.
• Examples: The degree of a polynomial in polynomial regression or the λ value
in weight decay are examples of hyperparameters.
• Purpose: They influence the model's capacity and ability to generalize.
Example:
Think of it like this: If a model is a baker, the hyperparameters are the recipe's
instructions (e.g., "bake at 350 degrees for 30 minutes"). The model's parameters (the
weights and biases) are the baker's adjustments and techniques they learn while baking
to make the cake perfect (e.g., how to mix the ingredients to get a smooth batter). The
baker doesn't learn what temperature to use during baking; that's set beforehand.
Validation Sets
• Definition: A separate dataset used to evaluate a model's performance during
hyperparameter tuning.
• Purpose: To select the best hyperparameters for a model by finding the
combination that yields the lowest generalization error.
• Process:
1. The model is trained on the training data.
2. The model is evaluated on the validation set for a given set of
hyperparameters.
3. This process is repeated with different hyperparameter values.
4. The hyperparameter values that result in the best performance on the
validation set are chosen.
5. Training data is split into two disjoint parts. First to learn the parameters
and other is the validation set to estimate generalization error during or
after training.
6. Allowing for the hyperparameters to be updated – Typically 80% of
training data for training and 20% for validation
Deep Learning 8
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Cross-Validation:
• Purpose: The main goal is to get a more reliable and less biased estimate of a
model's performance on unseen data. It does this by repeatedly training and
testing the model on different subsets of the data.
• Process: The dataset is partitioned into multiple subsets (or "folds"). The model
is trained on a combination of these folds and then tested on the remaining fold.
This process is repeated until every fold has been used as the test set.
• Result: The performance scores from each iteration are averaged to produce a
final, more robust performance estimate. This score is a better indicator of how
the model will perform in a real-world scenario.
1. K-Fold Cross-Validation
Deep Learning 9
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Imagine you have a new recipe for a cake and you want to know if it's really good.
A simple way to test it would be to bake one cake and have one person taste it. But
what if that person doesn't like cake? Or what if you made a mistake on that one
cake? Your single test might not give you a good idea of how the recipe really is.
Cross-validation is like taking that recipe and making it multiple times, but with a slight
twist each time, and having a group of people try them all.
Here's how it works in simple terms:
1. Split the Data: You take all your ingredients (your data) and divide them into
several smaller, equal groups. Let's say you divide them into five groups. These
are your "folds."
2. Iterate and Test:
o First test: You use four of the groups of ingredients to bake the cake.
Then, you use the fifth group of ingredients to bake a test cake. You have
a judge taste that test cake and give it a score.
o Second test: Now you swap! You use a different four groups of
ingredients to bake the cake, and you use another one of the groups as
your test cake. The same judge tastes it and gives a score.
o Repeat: You keep doing this until every single group of ingredients has
had a chance to be the test cake.
3. Average the Scores: In the end, you have a score from each of your test cakes.
You add up all these scores and find the average. This average score is a much
more reliable and fair measure of how good your recipe (your model) really is.
Deep Learning 10
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
In machine learning, an estimator is an object that learns a model from data, typically
using a "fit" method, and then can predict properties of new data using a "predict"
method. Essentially, it's the algorithm or function that attempts to find the best
representation of the underlying patterns in the data.
• Types of Estimators:
Estimators can be used for various machine learning tasks, including classification
(predicting categories) and regression (predicting continuous values).
Example:
Imagine you're building a model to predict house prices. You might use a linear
regression estimator. The estimator would:
1. Fit:
Analyze a dataset of house prices and their features (size, location, etc.) to learn the
relationship between these features and the price.
2. Predict:
Once fitted, you could input the features of a new house into the trained estimator, and
it would predict the corresponding price.
Bias:
Bias is one type of error that occurs due to wrong assumptions about data such as
assuming data is linear when in reality, data follows a complex function. On the other
hand, variance gets introduced with high sensitivity to variations in training data. This
also is one type of error since we want to make our model robust against noise. There
are two types of error in machine learning. Reducible error and Irreducible error. Bias
and Variance come under reducible error.
Bias is simply defined as the inability of the model because of that there is some
difference or error occurring between the model's predicted value and the actual value.
These differences between actual or expected values and the predicted values are
known as error or bias error or error due to bias. Bias is a systematic error that occurs
due to wrong assumptions in the machine learning process.
Let Y be the true value of a parameter, and let hat Y be an estimator of Y based on a
sample of data. Then, the bias of the estimator hatY is given by:
where E(Y^) is the expected value of the estimator Y^. It is the measurement of the
model that how well it fits the data.
Deep Learning 11
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Low Bias: Low bias value means fewer assumptions are taken to build the target
function. In this case, the model will closely match the training dataset.
• High Bias: High bias value means more assumptions are taken to build the target
function. In this case, the model will not match the training dataset closely.
The high-bias model will not be able to capture the dataset trend. It is considered as
the underfitting model which has a high error rate. It is due to a very simplified
algorithm.
For example, a linear regression model may have a high bias if the data has a non-linear
relationship.
• Use a more complex model: One of the main reasons for high bias is the very
simplified model. it will not be able to capture the complexity of the data. In
such cases, we can make our mode more complex by increasing the number of
hidden layers in the case of a deep neural network. Or we can use a more
complex model like Polynomial regression for non-linear
datasets, CNN for image processing, and RNN for sequence learning.
• Increase the number of features: By adding more features to train the dataset
will increase the complexity of the model. And improve its ability to capture the
underlying patterns in the data.
• Increase the size of the training data: Increasing the size of the training data
can help to reduce bias by providing the model with more examples to learn
from the dataset.
Variance :
Variance is the measure of spread in data from its mean position. In machine learning
variance is the amount by which the performance of a predictive model changes when it
is trained on different subsets of the training data. More specifically, variance is the
variability of the model that how much it is sensitive to another subset of the training
dataset. i.e. how much it can adjust on the new subset of the training dataset.
Let Y be the actual values of the target variable, and Y^ be the predicted values of
the target variable. Then the variance of a model can be measured as the expected value
of the square of the difference between predicted values and the expected value of the
predicted values.
Deep Learning 12
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
where E[Yˉ] is the expected value of the predicted values. Here expected value is
averaged over all the training data.
• Low variance: Low variance means that the model is less sensitive to changes in
the training data and can produce consistent estimates of the target function with
different subsets of data from the same distribution. However, low variance can
also indicate underfitting if the model is too simple and fails to capture the
underlying patterns in the data. This is when the model performs poorly on both
the training data and testing data.
• High variance: High variance means that the model is very sensitive to changes
in the training data and can result in significant changes in the estimate of the
target function when trained on different subsets of data from the same
distribution. This is the case of overfitting when the model performs well on the
training data but poorly on new, unseen test data. It fits the training data too
closely that it fails on the new training dataset.
• Feature selection: By choosing the only relevant feature will decrease the
model's complexity. and it can reduce the variance error.
• Regularization: We can use L1 (Lasso) or L2 (Ridge) regularization to reduce
variance in machine learning models
• Ensemble methods: It will combine multiple models to improve generalization
performance. Bagging, boosting, and stacking are common ensemble methods
that can help reduce variance and improve generalization performance.
• Simplifying the model: Reducing the complexity of the model, such as
decreasing the number of parameters or layers in a neural network, can also help
reduce variance and improve generalization performance.
• Early stopping: Early stopping is a technique used to prevent overfitting by
stopping the training of the deep learning model when the performance on the
validation set stops improving.
• High Bias, Low Variance: A model with high bias and low variance is said to
be underfitting.
• High Variance, Low Bias: A model with high variance and low bias is said to
be overfitting.
Deep Learning 13
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• High-Bias, High-Variance: A model has both high bias and high variance,
which means that the model is not able to capture the underlying patterns in the
data (high bias) and is also too sensitive to changes in the training data (high
variance). As a result, the model will produce inconsistent and inaccurate
predictions on average.
• Low Bias, Low Variance: A model that has low bias and low variance means
that the model is able to capture the underlying patterns in the data (low bias)
and is not too sensitive to changes in the training data (low variance). This is the
ideal scenario for a machine learning model, as it is able to generalize well to
new, unseen data and produce consistent and accurate predictions. But in
practice, it's not possible.
Top-Left (Low Bias, High Variance): The data points (green dots) are spread out but
centered around the bullseye (black dot). This indicates that the model is, on average,
correct (low bias), but its predictions are inconsistent and widely distributed (high
variance). This often happens when a model is overly complex and has learned the
training data too well, including the noise. This is known as overfitting.
Top-Right (High Bias, High Variance): The data points are both spread out and off-
center. This is the worst-case scenario. The model's predictions are inaccurate on
average (high bias) and also inconsistent (high variance). This indicates a poorly
performing model that is neither accurate nor reliable.
Bottom-Left (Low Bias, Low Variance): The data points are tightly clustered and
centered around the bullseye. This is the ideal scenario. The model is consistently
accurate (low variance) and its predictions are correct on average (low bias). This
Deep Learning 14
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
represents a well-performing model that has successfully generalized from the training
data.
Bottom-Right (High Bias, Low Variance): The data points are tightly clustered but
off-center. This indicates that the model is consistently wrong. Its predictions are
reproducible (low variance), but they are systematically incorrect (high bias). This is
often a sign of an overly simplistic model that fails to capture the underlying patterns in
the data, a phenomenon known as underfitting.
Now we know that the ideal case will be Low Bias and Low variance, but in practice,
it is not possible. So, we trade off between Bias and variance to achieve a balanced bias
and variance.
A model with balanced bias and variance is said to have optimal generalization
performance. This means that the model is able to capture the underlying patterns in the
data without overfitting or underfitting. The model is likely to be just complex enough
to capture the complexity of the data, but not too complex to overfit the training data.
This can happen when the model has been carefully tuned to achieve a good balance
between bias and variance, by adjusting the hyperparameters and selecting an
appropriate model architecture.
If the algorithm is too simple (hypothesis with linear equation) then it may be on high
bias and low variance condition and thus is error-prone. If algorithms fit too complex
(hypothesis with high degree equation) then it may be on high variance and low bias.
In the latter condition, the new entries will not perform well. Well, there is something
between both of these conditions, known as a Trade-off or Bias Variance Trade-off.
This tradeoff in complexity is why there is a tradeoff between bias and variance. An
algorithm can’t be more complex and less complex at the same time. For the graph, the
perfect tradeoff will be like this.
Deep Learning 15
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
The technique by which we analyze the performance of the machine learning model is
known as Bias Variance Decomposition. Now we give 1-1 example of Bias Variance
Decomposition for classification and regression.
BAYESIAN STATISTICS :
Bayes' Theorem
where:
• P(A|B) is the probability of event A occurring given that B is true.
• P(B|A) is the probability of event B occurring given that A is true.
• P(A) is the probability of event A.
• P(B) is the probability of event B.
This formula allows statisticians to update the probability estimate for a hypothesis as
more evidence or information becomes available.
Three key concepts in Bayesian statistics are the prior, the likelihood, and the posterior:
• Prior (P(A)): This is the initial judgment or belief about the probability of an
event before new data is introduced.
Deep Learning 16
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Likelihood (P(B|A)): This is the probability of observing the new data under the
assumption that the prior and the model are true.
• Posterior (P(A|B)): The updated probability of the event after considering the
new data. The posterior becomes the new prior if more data becomes available,
allowing for continuous updating of our belief.
Deep Learning 17
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
These steps form the backbone to any machine learning process and knowing them will
make your life much easier when trying to build ML models.
1. Data Collection
Machine learning requires training data, a lot of it. This data can either be labelled
meaning Supervised Learning or not labelled meaning Unsupervised Learning.
Accuracy of the model depends on the quality and quantity of the data. The
outcome of this step is generally a representation of data which will be used for
training. Using pre-collected data, by way of datasets from sites like Kaggle, UCI, etc.
forms the basis of you Machine learning project. You may also collect data through
user-surveys, analysis reports, trends, usage metrics, etc.
2. Data Preparation
We cannot work on raw data. Data needs to be processed by normalization,
removing duplicates, errors and biases.
Visualising data can be helpful in searching for patterns and outliers to check if the
data collected is right or if it contains missing values. This can be done using libraries
like seaborn, matplotlib, etc. Visualize data to help detect relevant relationships
between variables or class imbalances, or perform other exploratory analysis.
After performing data wrangling, we need to prepare the data for training. Cleaning of
data is done that involves steps like removing duplicates, dealing with missing values,
type conversions, correcting errors, normalizing the data, etc.
Not all the above steps are needed to be performed as it depends entirely on the data
collected. Some datasets may not require data preparation at all while for some
data preparation step takes majority of their ML model build time.
Deep Learning 18
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
We can also Randomize data, which erases the effects of the particular order in
which we collected and/or otherwise prepared our data. Later we can split the data
into training, testing and evaluation sets
3. Choose a Model / Algorithm
The third step consists of selecting the right model. There are many models which can
be used for many different purposes. Once the model is selected, it needs to meet the
business goal.
We need to have an idea about the preparation the model requires along with its
accuracy and scalability. Having a complex model does not mean a better model.
Common machine learning algorithms include Decision Trees, Random Forest, Linear
Regression, Support Vector Machines (SVM), Logistic Regression, K-means, Principal
Component Analysis (PCA), Naïve Bayes, and Neural Networks. Different algorithms
need to be applied to different tasks, you need to choose the correct one for your use
case.
4. Training the Model
Training a model forms the basis of machine learning. The goal is to use our training
data and improve the predictions of our model.
Every cycle in training a model involves updating the weights and biases in each
training step. We can use labelled sample data in case supervised machine learning and
unlabelled sample data for unsupervised learning.
The goal of training is to evaluate and further improve our model accuracy and
performance. Training happens in the form of iterations which is called a training step.
Deep Learning 19
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
A 70/30 split, or similar, is considered a good train/eval split, which depends on things
like data availability, dataset features, domain, etc.
6. Parameter Tuning
The original model parameters need to be tested after evaluating your model. By
increasing the training, it can lead to better results.
Parameter tuning is an experimental process and hence we need to define when to
stop parameter tuning otherwise it will continue to tweak the model.
Hyperparameter tuning is an art and one that requires patience & experience. Once
the model parameters are tuned it can give us better results. Some common
hyperparameters include: number of training steps, learning rate, initialization
values and distribution, etc.
7. Make Predictions
After the processes of collecting data, preparing the data, selecting a machine learning
algorithm, training the model and evaluating the model & tuning the parameters, we
need to make predictions.
Our machine learning model can make predictions ranging from image recognition to
predictive analytics to natural language processing.
After building the model needs to be tested on a testing set to check how the model
performs on unseen data. It helps to further evaluate the model and provides better
approximation.
Deep Learning 20
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
In many machine learning problems, the objective is to minimize a loss function, J(θ),
which is an average of the losses for each training example.
• Gradient Descent (GD): The update for standard gradient descent uses the gradient
of the entire loss function.
• Stochastic Gradient Descent (SGD): Instead of averaging the gradient over all n,
samples, SGD computes the gradient for a single randomly chosen sample, ik, at
each step.
The random selection of a single data point makes the gradient an unbiased
estimate of the true gradient.
Mini-batch SGD :
The most common variant of SGD used in practice is mini-batch SGD, which strikes a
balance between the computational efficiency of SGD and the update stability of
standard gradient descent.
Deep Learning 21
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Computational High. Processes all training Low per iteration. Computes the
cost examples to compute a single gradient for only one (or a small
gradient update. batch of) example(s).
Escaping local Can get stuck in local minima, The noisy updates can help the
minima especially in non-convex algorithm "jump out" of local
optimization problems. minima and saddle points.
Online learning Not suitable, as it requires the Well-suited for online learning, as
entire dataset for updates. it can update parameters with new
data points as they arrive.
Deep Learning 22
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Challenges motivating deep learning include the need to handle vast amounts of data,
overcome the "black box" problem of interpretability, and the high computational cost
of training models. Overfitting, scalability issues, the vulnerability of models to
adversarial attacks, and potential biases in data also pose significant hurdles that must
be addressed for deep learning to be applied effectively and ethically in real-world
scenarios.
Data-Related Challenges
• Bias:
Training data can contain inherent biases, leading to unfair or inaccurate
predictions and requiring careful steps for mitigation.
• Adversarial Attacks:
Malicious actors can manipulate input data to trick models, causing
misclassifications and unreliable outputs.
Model-Related Challenges :
• Overfitting:
Models can become too specialized to the training data, learning noise rather than
underlying patterns, leading to poor performance on new, unseen data.
• Scalability:
Effectively handling massive datasets and increasingly complex tasks in real-
world applications is a significant challenge.
• Computational Resources:
Training deep learning models is computationally expensive, requiring powerful
hardware like GPUs and TPUs.
Deep Learning 23
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
• Hyperparameter Tuning:
Finding the optimal settings for hyperparameters can be a complex and time-
consuming process.
• Generalization:
Traditional algorithms have failed to generalize well on complex AI tasks like speech
and object recognition, motivating the development of deep learning to address these
failures.
• Lack of Flexibility:
Deep learning models are often task-specific; they are ineffective at solving problems
other than the one they were trained for.
Deep Learning 24
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
1. Input Layer:
This layer receives the raw input data, such as pixels of an image or words in a
sentence.
2. Hidden Layers:
Multiple hidden layers are stacked between the input and output layers. Each
neuron in a hidden layer receives inputs from the previous layer, computes a
weighted sum, adds a bias, and then applies a nonlinear activation function. This
process introduces complex non-linear transformations, enabling the network to
learn intricate patterns.
3. Output Layer:
This final layer produces the network's output. The specific form of the output
function depends on the task, such as classifying an image or predicting a
numerical value.
4. Unidirectional Flow:
Data travels only from the input layer to the hidden layers and then to the output
layer, without any backward flow or loops.
Learning XOR:
Learning the XOR function is a classic problem in deep learning used to illustrate the
capabilities of multi-layer neural networks and the limitations of single-layer
perceptrons.
The XOR (exclusive OR) function returns a true (1) output if exactly one of its two
binary inputs is true (1), and a false (0) output otherwise. Its truth table is:
0 0 0
0 1 1
1 0 1
1 1 0
The challenge arises because the XOR function is not linearly separable. This means a
single straight line (or hyperplane in higher dimensions) cannot separate the input
Deep Learning 25
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
combinations that result in a 0 output from those that result in a 1 output. A simple,
single-layer perceptron, which can only learn linearly separable functions, therefore
cannot solve the XOR problem.
HIDDEN UNITS :
In deep learning, a hidden unit refers to an individual artificial neuron or node located
within a hidden layer of a neural network. Unlike input units, which directly receive
raw data, or output units, which produce the final predictions, hidden units are not
directly exposed to the external environment. Their primary function is to perform
intermediate computations and transform the input data into more abstract and
meaningful representations that can be used by subsequent layers.
Deep Learning 26
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Process:
• Forward Pass:
Input data is fed through the network, layer by layer, with each neuron computing its
output based on the weighted sum of its inputs and an activation function. This process
continues until an output is generated by the final layer.
• Loss Calculation:
The network's output is compared to the true target values, and a loss function
calculates the error or discrepancy between them.
Deep Learning 27
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])
lOMoARcPSD|56847386
Deep Learning 28
Downloaded by Tilak ram Sahu (tilakramsahu7618@[Link])