Docsity

This the deep learning notes., Study notes of Data Acquisition

Toggle sidebar
bg1
Unit I
Foundations of Deep learning
Contents:
What is machine learning and deep learning? History of deep learning, Advantage and
challenges of deep learning. Learning representations from data , Understanding how deep
learning works in three figures(input, hidden layer, output), Common Architectural Principles
of Deep Network, Architecture Design, Applications of Deep learning, Hyperparameters :
Learning Rate, Regularization, Momentum, Sparsity, Hidden Units, cost functions, error back
propagation, Gradient-Based Learning, Implementing Gradient Descent, vanishing and
Exploding gradient descent, Optimization algorithm(SGD, AdaGrad, RMSProp, adam).
What is machine learning and deep learning?
Machine Learning
Machine Learning is a branch of Artificial Intelligence that enables computer systems to
learn patterns from data and make predictions or decisions without being explicitly
programmed by humans.
โ— Works with smaller datasets.
โ— Requires manual feature extraction.
โ— Easier to interpret and implement.
โ— Best for structured data like tables or CSV files.
Types of Machine Learning Algorithms
Different types of ML Algorithms:
1. Supervised Learning: Here the model learns from labelled datasets, where the
input and output are clearly defined.
2. Unsupervised Learning: Here the model identifies patterns or relationships in
data without any predefined labels.
3. Reinforcement Learning: Here the system learns by interacting with an
environment and receiving rewards or penalties based on its actions.
Applications:
1. Spam Emails: Detecting spam emails or fraudulent transactions.
2. Recommendation Systems: Building recommendation systems for movies,
products or content.
3. Analytics: Predictive analytics in finance, healthcare and marketing.
Deep Learning
Deep Learning uses artificial neural networks with multiple hidden layers that can
automatically learn complex patterns from raw data like images, sound, and text. Itโ€™s used in
applications such as image recognition, natural language processing, and speech recognition.
โ— Learn features automatically from data.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download This the deep learning notes. and more Study notes Data Acquisition in PDF only on Docsity!

Unit I

Foundations of Deep learning

Contents:

What is machine learning and deep learning? History of deep learning, Advantage and

challenges of deep learning. Learning representations from data , Understanding how deep

learning works in three figures(input, hidden layer, output), Common Architectural Principles

of Deep Network, Architecture Design, Applications of Deep learning, Hyperparameters :

Learning Rate, Regularization, Momentum, Sparsity, Hidden Units, cost functions, error back propagation, Gradient-Based Learning, Implementing Gradient Descent, vanishing and

Exploding gradient descent, Optimization algorithm(SGD, AdaGrad, RMSProp, adam).

What is machine learning and deep learning?

Machine Learning

Machine Learning is a branch of Artificial Intelligence that enables computer systems to

learn patterns from data and make predictions or decisions without being explicitly

programmed by humans.

โ— Works with smaller datasets.

โ— Requires manual feature extraction.

โ— Easier to interpret and implement.

โ— Best for structured data like tables or CSV files.

Types of Machine Learning Algorithms

Different types of ML Algorithms:

  1. Supervised Learning: Here the model learns from labelled datasets, where the input and output are clearly defined.
  2. Unsupervised Learning: Here the model identifies patterns or relationships in data without any predefined labels.
  3. Reinforcement Learning: Here t he system learns by interacting with an environment and receiving rewards or penalties based on its actions.

Applications:

  1. Spam Emails: Detecting spam emails or fraudulent transactions.
  2. Recommendation Systems: Building recommendation systems for movies, products or content.
  3. Analytics: Predictive analytics in finance, healthcare and marketing.

Deep Learning Deep Learning uses artificial neural networks with multiple hidden layers that can automatically learn complex patterns from raw data like images, sound, and text. Itโ€™s used in applications such as image recognition, natural language processing, and speech recognition.

โ— Learn features automatically from data.

โ— Performs better with large datasets. โ— Needs GPUs or TPUs for training. โ— Best for unstructured data such as images, audio or text. โ— Used in complex applications like self-driving cars or chatbots.

Types of Deep Learning

Deep learning encompasses various architectures, each suited to different types of tasks:

  1. Convolutional Neural Networks : Used for image processing tasks, CNNs are designed to adaptively learn spatial hierarchies of features through convolutional layers.
  2. Recurrent Neural Networks : Ideal for sequential data. RNNs have loops that allow information to persist, effective for tasks like speech recognition and language modeling.
  3. Long Short-Term Memory Networks : A type of RNN that addresses the vanishing gradient problem. They are used for complex sequences including text and speech.
  4. Generative Adversarial Networks : GANs consist of two neural networks that are generator and discriminator that compete against each other, creates synthetic data such as images.
  5. Transformers : Handles long-range dependencies in data. They are the backbone of models like GPT and BERT, used in natural language processing.

Applications

Some of the applications of DL:

  1. Object Detection: Recognizing objects and faces in images or videos.
  2. Natural Language Processing: Converting spoken language into text and understanding speech commands.
  3. Autonomous Vehicle: Enabling autonomous vehicles to perceive and navigate their environment.

Basis Machine Learning (ML) Deep Learning (DL)

Definition Algorithms that learn from data and improve with experience.

Subset of ML using multi-layered neural networks.

logic and mathematics. This work became the foundation of artificial neural networks and modern deep learning.

1957โ€“1958 โ€“ Perceptron: In 1957โ€“1958, Frank Rosenblatt introduced the Perceptron, one of the earliest neural network models. It was capable of learning from data and classifying inputs into categories. The Perceptron demonstrated that machines could learn automatically, which was a major breakthrough in artificial intelligence.

1965 โ€“ Early Deep Learning Algorithm: In 1965, Alexey Ivakhnenko and Valentin Lapa introduced one of the first working deep learning algorithms for multi-layer perceptrons (MLPs). Their work showed that multi-layer networks could be trained, laying early groundwork for deep neural networks.

1970sโ€“1990s: Connectionism and Initial Slowdowns

1970 โ€“ Backpropagation Derived: In 1970, Seppo Linnainmaa derived the mathematical foundations of backpropagation, a method used to train neural networks by minimizing errors. Although the concept was introduced in 1970, it was not widely used in neural networks until the 1980s.

1979/1980s โ€“ Neocognitron: During 1979 and the 1980s, Kunihiko Fukushima developed the Neocognitron. This model was the forerunner of modern Convolutional Neural Networks (CNNs). It was designed for visual pattern recognition and inspired later deep learning architectures used in image processing.

1986 โ€“ Popularization of Backpropagation: In 1986, Geoffrey Hinton, David Rumelhart, and Ronald Williams popularized the backpropagation algorithm. Their work made it practical to train multi-layer neural networks, leading to renewed interest in connectionism.

1997 โ€“ Introduction of LSTM: In 1997, Sepp Hochreiter and Jรผrgen Schmidhuber introduced Long Short-Term Memory (LSTM) networks. LSTM solved the vanishing gradient problem in Recurrent Neural Networks (RNNs), enabling better learning from long sequences of data such as text and speech.

2000sโ€“Present: The Deep Learning Revolution

2006 โ€“ Deep Belief Networks: In 2006, Geoffrey Hinton and his colleagues demonstrated that Deep Belief Networks (DBNs) could be effectively trained. This achievement marked the revival of deep learning research after years of limited progress.

2009โ€“2012 โ€“ ImageNet and GPU Acceleration: Between 2009 and 2012, the introduction of the ImageNet dataset and the use of Graphics Processing Units (GPUs) greatly improved training speed and accuracy. The breakthrough came in 2012 when Alex Krizhevsky, under the supervision of Geoffrey Hinton, developed AlexNet, which won the ImageNet competition. This victory proved the superiority of deep Convolutional Neural Networks (CNNs) for computer vision tasks.

2014โ€“Present โ€“ GANs, ResNet, and Transformers: From 2014 onwards, new architectures such as Generative Adversarial Networks (GANs), Residual Networks (ResNet), and Transformers revolutionized artificial intelligence. GANs enabled realistic image and data generation, ResNet improved very deep network training, and Transformers transformed Natural Language Processing (NLP) and generative AI systems used in modern applications.

Advantage and challenges of deep learning:

Advantages of Deep Learning

1. Automatic Feature Extraction: Deep learning models automatically learn important features from raw data without manual feature engineering. Unlike traditional machine learning, no separate feature selection step is required. 2. High Accuracy: Deep learning provides very high accuracy, especially in complex tasks like image recognition, speech recognition, and natural language processing. 3. Handles Large and Complex Data: It works very well with large datasets (Big Data) and can process structured, semi-structured, and unstructured data such as images, audio, and text. 4. End-to-End Learning: Deep learning systems can learn directly from input to output in a single model. For example, in image classification, the model directly predicts the class from pixels. 5. Continuous Improvement: Performance improves as more data becomes available. The more data you provide, the better the model learns. 6. State-of-the-Art Applications: Deep learning powers modern technologies such as:

โ— OpenAI models (like GPT)

โ— Google voice assistants

โ— Tesla self-driving systems

Challenges of Deep Learning

1. Requires Large Amount of Data: Deep learning models need huge datasets for training. With small datasets, performance may be poor. 2. High Computational Cost: Training deep neural networks requires powerful hardware like GPUs or TPUs, which can be expensive.

โ— Learning speech representations for voice assistants.

โ— Extracting molecular or biomedical features for scientific analysis.

5. Mechanism: Representation learning uses multiple layers of non-linear transformations such as ReLU activation functions, normalization, and weighted combinations. Early layers learn simple patterns (like edges in images), while deeper layers learn complex and abstract concepts. This hierarchical structure allows simple inputs to be transformed into powerful, actionable representations.

Why It Is Important

Representation learning is crucial because it helps identify hidden structures and patterns in raw data that are difficult for humans to manually define. It enables machines to automatically understand complex data formats such as images, text, audio, and scientific signals, forming the foundation of modern artificial intelligence systems.

Understanding how deep learning works in three figures(input, hidden

layer, output):

1. Input Layer

โ— The input layer is the first layer of a deep learning model where raw data is fed into the network. โ— It acts as the entry point and does not perform any complex computation. Instead, it simply receives the input features and passes them to the next layer. โ— All input data must be converted into numerical form because neural networks operate only on numbers. โ— For example, in image processing, each pixel value (ranging from 0 to 255) becomes an input neuron.

โ— In text processing, words are converted into numerical vectors called embeddings. Before entering the input layer, data is usually preprocessed through normalization, scaling, or cleaning to improve training efficiency and stability.

2. Hidden Layer(s)

โ— The hidden layers are the core components of deep learning models where actual learning takes place. โ— A neural network is called โ€œdeepโ€ when it contains multiple hidden layers. Each neuron in a hidden layer receives inputs from the previous layer, multiplies them by weights, adds a bias value, and then applies a non-linear activation function such as ReLU, Sigmoid, or Tanh. This process allows the network to learn complex relationships in the data. โ— The hidden layers create a hierarchy of features, where early layers learn simple patterns and deeper layers learn more abstract and meaningful representations. โ— During training, the network uses forward propagation to make predictions and backpropagation to adjust weights by minimizing error through optimization algorithms like gradient descent. This repeated process enables the model to improve its accuracy over time.

3. Output Layer

โ— The output layer is the final layer of the neural network that produces the prediction or final result. โ— The number of neurons in this layer depends on the type of problem being solved. For binary classification tasks, the output layer usually has one neuron with a sigmoid activation function that provides a probability value between 0 and 1. โ— For multi-class classification problems, the output layer contains one neuron per class and uses a softmax activation function to generate probability distributions. โ— In regression tasks, the output layer typically has one neuron with a linear activation function to predict continuous values. โ— The prediction from the output layer is compared with the actual value using a loss function, and the error is used to update the network during training.

Common Architectural Principles of Deep Network:

1. Hierarchical Feature Learning (Layered Structure)

โ— Deep networks consist of multiple hidden layers stacked one after another. โ— Each layer performs a transformation on its input and passes the result to the next layer. โ— Early layers learn low-level features such as edges, textures, or simple signals. โ— Intermediate layers combine low-level features to form patterns, shapes, or object parts. โ— Deeper layers learn high-level abstract concepts such as objects, faces, or semantic meaning. โ— This layered abstraction enables the network to model highly complex data distributions.

โ— Optimization algorithms like Gradient Descent, Adam, and RMSprop update weights efficiently. โ— Learning rate scheduling improves convergence performance.

6. Attention Mechanisms

โ— Allows the model to focus on the most relevant parts of input data. โ— Assigns dynamic importance weights to different input components. โ— Reduces dependency on fixed-length context representation. โ— Forms the core of Transformer architecture. โ— Enables parallel processing of sequences (unlike RNNs). โ— Improves long-range dependency modeling. โ— Used in modern NLP models such as BERT and GPT. โ— Significantly improves machine translation, text summarization, and question answering.

7. Residual Connections (Skip Connections)

โ— Designed to enable training of extremely deep networks. โ— Allows input of one layer to bypass intermediate layers. โ— Helps reduce vanishing gradient problems. โ— Prevents degradation of training accuracy in deeper networks. โ— Makes gradient flow easier during backpropagation. โ— Improves convergence speed and training stability. โ— Introduced in ResNet by Kaiming He. โ— Enabled successful training of networks with 100+ layers.

Architecture Design:

1. Input Layer, Hidden Layers, Output Layer Input Layer โ— Receives raw input data (images, text, audio, tabular data). โ— Converts data into numerical format. โ— Does not perform heavy computation.

Hidden Layers โ— Perform feature extraction and pattern recognition. โ— Each layer transforms data into higher-level representations. โ— Multiple hidden layers increase learning capacity. โ— Deeper networks learn more abstract concepts.

Output Layer โ— Produces final prediction. โ— The number of neurons depends on task type. โ— Uses task-specific activation functions. The depth (number of hidden layers) and connectivity pattern directly affect model complexity.

2. Neurons, Weights, and Biases Neurons (Nodes) โ— Basic computational units of the network. โ— Receive input, apply transformation, and pass output forward.

Weights โ— Represent strength of connection between neurons. โ— Higher weight means stronger influence. โ— Adjusted during training to reduce prediction error.

Biases โ— Allow shifting of activation function. โ— Increase model flexibility. โ— Help in fitting data more accurately. Training mainly focuses on optimizing weights and biases.

3. Activation Functions โ— Introduce non-linearity into the network. โ— Allow learning of complex relationships.

Common Activation Functions: โ— ReLU โ€“ Fast, simple, widely used in hidden layers. โ— Sigmoid โ€“ Used for binary classification outputs. โ— Tanh โ€“ Outputs values between -1 and 1. โ— Softmax โ€“ Converts outputs into probability distribution for multi-class tasks. Without activation functions, deep networks cannot model complex patterns.

4. Loss Functions and Optimization Loss Function โ— Measures difference between predicted output and actual output. โ— Acts as a feedback signal for learning. โ— Examples: โ—‹ Binary Cross-Entropy โ—‹ Categorical Cross-Entropy โ—‹ Mean Squared Error

3. Speech Recognition

โ— Converts spoken language into text. โ— Used in voice assistants and smart devices. โ— Applied in call center automation.

4. Healthcare and Medical Diagnosis

โ— Detects diseases from medical images. โ— Predicts patient risk and treatment outcomes. โ— Used in drug discovery and genomics. โ— Assists doctors in clinical decision-making.

5. Autonomous Vehicles

โ— Enables object detection, pedestrian recognition, and traffic sign detection. โ— Processes sensor data from cameras, radar, and LiDAR. โ— Makes real-time driving decisions.

6. Recommendation Systems

โ— Suggests products, movies, or content based on user behavior. โ— Improves personalized user experience. โ— Used in e-commerce and streaming platforms.

7. Fraud Detection and Cybersecurity

โ— Detects unusual patterns in financial transactions. โ— Identifies spam emails and phishing attacks. โ— Monitors network traffic for suspicious activities.

Hyperparameters :

Learning Rate:

1. Learning Rate

โ— Learning rate is a hyperparameter that controls how much the model weights are updated during training. โ— It determines the step size taken while moving toward the minimum of the loss function. โ— If the learning rate is too high, the model may overshoot the minimum and fail to converge. โ— If it is too low, training becomes very slow and may get stuck in local minima. โ— Choosing an appropriate learning rate is very important for stable and faster convergence. โ— Learning rate scheduling (reducing it gradually) often improves performance.

2. Regularization

โ— Regularization is a technique used to prevent overfitting in deep learning models. โ— It adds a penalty term to the loss function to reduce model complexity. โ— Common types include L1 regularization (adds absolute weight values) and L regularization (adds squared weight values). โ— Dropout is another regularization technique where some neurons are randomly deactivated during training. โ— Regularization helps improve model generalization on unseen data.

3. Momentum

โ— Momentum is an optimization technique that helps accelerate gradient descent. โ— It considers the previous weight update while calculating the current update. โ— This helps reduce oscillations and speeds up convergence. โ— Especially useful in deep networks where gradients change direction frequently. โ— It improves stability and faster training.

4. Sparsity

โ— Sparsity means that only a small number of neurons are active at a time. โ— Sparse representations improve model efficiency and reduce overfitting. โ— L1 regularization often promotes sparsity in weights. โ— Sparse models require less memory and are computationally efficient. โ— It helps in feature selection by automatically ignoring irrelevant features.

5. Hidden Units

โ— Hidden units are neurons present in hidden layers of a neural network. โ— They learn intermediate representations of input data. โ— Increasing hidden units increases model capacity but may cause overfitting. โ— Too few hidden units may lead to underfitting. โ— Proper selection depends on problem complexity and dataset size.

6. Cost Function (Loss Function)

โ— A cost function measures how well the model predictions match actual values. โ— It calculates the error between predicted and true outputs. โ— Common loss functions include: โ—‹ Mean Squared Error (MSE) for regression โ—‹ Binary Cross-Entropy for binary classification โ—‹ Categorical Cross-Entropy for multi-class classification โ— The objective of training is to minimize the cost function.

โ— Gradient clipping. โ— Use advanced optimizers. โ— Batch normalization.

11. Optimization Algorithms

a) Stochastic Gradient Descent (SGD)

โ— Updates weights using one training sample at a time. โ— Faster than batch gradient descent. โ— Introduces noise but helps escape local minima.

b) AdaGrad

โ— Adapts learning rate for each parameter. โ— Frequently updated parameters get smaller learning rates. โ— Good for sparse data. โ— The learning rate may become very small over time.

c) RMSProp

โ— Improves AdaGrad by preventing learning rate from shrinking too much. โ— Uses moving average of squared gradients. โ— Works well for non-stationary problems.

d) Adam (Adaptive Moment Estimation)

โ— Combines Momentum and RMSProp. โ— Maintains moving average of gradients and squared gradients. โ— Fast convergence and widely used in practice. โ— Default optimizer for many deep learning tasks.

Question Paper

Q1)

a) What are the advantages and challenges of deep learning?

Ans:

Advantages of Deep Learning

1. Automatic Feature Extraction

โ— Deep learning models automatically learn important features from raw data. โ— No need for manual feature engineering. โ— Especially useful for images, audio, and text data.

2. High Accuracy

โ— Provides very high accuracy in complex tasks like image recognition and speech recognition. โ— Performs better than traditional machine learning when large data is available.

3. Handles Large and Complex Data

โ— Can process structured and unstructured data (images, videos, text, audio). โ— Works well with big datasets.

4. End-to-End Learning

โ— Can directly map input to output without multiple separate processing steps. โ— Reduces need for domain-specific preprocessing.

5. Scalability

โ— Performance improves as more data is added. โ— Can be scaled using GPUs and distributed systems.

Challenges of Deep Learning

1. Requires Large Amount of Data

โ— Needs huge labeled datasets for good performance. โ— Not suitable for small datasets.

2. High Computational Cost

โ— Requires powerful hardware like GPUs. โ— Training can take hours or days.

Initialization is important because poor initialization may cause vanishing or exploding gradients.

3. Forward Propagation

Forward propagation is the process of passing input data through the network to obtain output.

โ— Each neuron receives input signals. โ— Inputs are multiplied by corresponding weights. โ— A bias is added to the weighted sum. โ— The result is passed through an activation function.

This process continues layer by layer until the final output is produced. The output is the modelโ€™s prediction.

4. Loss (Error) Computation

โ— The predicted output is compared with the actual target value. โ— The difference between them is calculated using a loss function. โ— The loss function measures how far the prediction is from the correct output.

The objective of training is to minimize this loss value.

5. Backward Propagation of Error

This is the core concept of the algorithm.

โ— The error calculated at the output layer is propagated backward through the network. โ— Using the chain rule of calculus, the algorithm calculates how much each weight contributed to the error. โ— The gradients (partial derivatives) of the loss with respect to each weight are computed.

This step determines the direction in which weights must be adjusted to reduce the error.

6. Gradient Calculation

โ— The gradient represents the slope of the loss function. โ— It shows whether the weight should increase or decrease. โ— Large gradient โ†’ large correction needed. โ— Small gradient โ†’ small correction needed.

Gradients are calculated for all weights and biases in the network.

7. Weight Update Using Gradient Descent

โ— After computing gradients, weights are updated. โ— The update is done in the opposite direction of the gradient. โ— A learning rate controls how big the update step should be.

If the learning rate is too high, training becomes unstable. If it is too low, learning becomes slow.

8. Iterative Learning (Epochs)

โ— The forward and backward process is repeated for all training samples. โ— One complete pass through the dataset is called an epoch. โ— Training continues for multiple epochs until: โ—‹ The loss becomes minimal, or โ—‹ A fixed number of epochs is reached.

With each iteration, the model gradually improves its predictions.

9. Convergence

โ— When the loss function stops decreasing significantly, the model is said to have converged. โ— At convergence, weights reach near-optimal values. โ— The network is now ready to make predictions on new unseen data.

c) State any five applications of deep learning.

Ans:

  1. Image Recognition and Computer Vision

โ— Deep learning is widely used for identifying objects, faces, and patterns in images. โ— Convolutional Neural Networks (CNNs) are commonly used for image classification and object detection. โ— Applications include facial recognition systems, medical image analysis, and security surveillance. โ— It is used in self-driving cars for detecting pedestrians, traffic signs, and obstacles.

  1. Speech Recognition

โ— Deep learning models convert spoken language into text. โ— Recurrent Neural Networks (RNNs) and Transformers are commonly used. โ— Used in virtual assistants like Siri, Google Assistant, and Alexa. โ— Applied in voice-controlled systems and automatic transcription services.

  1. Natural Language Processing (NLP)

โ— Deep learning helps computers understand, interpret, and generate human language. โ— Used in machine translation, chatbots, sentiment analysis, and text summarization. โ— Models like transformers power applications such as chatbots and language translation systems.