DL Unit 3
DL Unit 3
By
Dr Nisarg Gandhewar
Overview of Syllabus
Unit 3: Autoencoders
you can actually keep these balls in smaller boxes(in size) with
force and they will acquire their original shape back
(approximately) once the box is opened.
•Autoencoder is a type of neural network where the output layer has the same dimensionality
as the input layer.
•In simpler words, the number of output units in the output layer is equal to the number of
input units in the input layer.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
•Autoencoders are special neural networks that learn how to recreate the given information.
•An autoencoder replicates the data from the input to the output in an unsupervised manner
and is therefore sometimes referred to as a replicator neural network.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Autoencoder
• Autoencoders are neural network models primarily used for unsupervised learning
tasks such as dimensionality reduction, data compression, and feature extraction.
•They learn to reconstruct the input data and capture its essential patterns, making
them useful for anomaly detection and image-denoising tasks.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Components / Layers of Autoencoder
Loss Function: A loss function measures the difference between the input
and the reconstructed output, guiding the auto encoder’s training process.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Example of Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Mathematical Formulation of Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Application of Autoencoder
•Image and Audio Compression: Autoencoders can compress huge images or audio files
while maintaining most of the vital information.
•Data Generation: Employ autoencoders to generate new data similar to the training data.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
•Denoising: One can utilize autoencoders to reduce noise from data. We can accomplish
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
this by teaching an autoencoder to recover the original data from a noisy version.
•Anomaly Detection: Any input that the autoencoder cannot accurately reconstruct is called
an anomaly.
Autoencoder vs PCA
•The choice between them depends on the specific characteristics of the data and
the goals of the analysis.
•PCA, being a linear technique, is computationally efficient and interpretable but may
not perform as well on highly non-linear data.
Autoencoder vs PCA
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Autoencoder vs PCA
•Linearity:
PCA: It is essentially a linear transformation, finds axes with maximum variance, assumes
linear relationships in data.
Autoencoders: Can be non-linear, learn complex relationships, suitable for non-linear data.
It is capable of capturing non-linear relationships within the data due to their neural network
architecture.
•Interpretability: https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Computation:
PCA: Fast and computationally efficient.
Autoencoders: Can be computationally expensive, especially with complex architectures.
PCA is faster and computationally cheaper than autoencoders.
Autoencoder vs PCA
• PCA is easier to implement and understand, and can give you a good idea of the
variance and structure of the data.
• Autoencoders are better suited for exploring more complex and nonlinear
relationships, or for tasks that require a neural network approach.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Autoencoder vs PCA
•If the features have non-linear relationship with each other then autoencoder will be
able to compress the information better into low dimensional latent space
Regularization in Auto Encoders
•Overfitting occurs when the autoencoder learns the training data too well, capturing
noise or specific details that do not generalize well to new, unseen data.
•L1 regularization (Lasso): Adds the sum of absolute values of weights to the loss function. This
encourages sparsity, where many weights become zero, forcing the model to rely on a smaller subset
of features.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
•L2 regularization (Ridge): Adds the sum of squared weights to the loss function. This encourages
small weights, preventing individual features from having too much influence and promoting stability.
Regularization in Auto Encoders
•Dropout: Randomly drops out a fraction of units in each layer during training. This prevents units
from co-adapting excessively and encourages features to be independently useful.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
•Early Stopping:
Monitors the model's performance on a validation set. Stops training when performance on the
validation set starts to deteriorate, preventing overfitting to the training data.
Regularization in Auto Encoders
The best regularization technique for your autoencoder depends on your specific
data and goals. Consider factors like:
Data size and complexity: Large datasets benefit from stronger regularization like
L1, while smaller datasets might require weaker methods like L2.
Computational resources: Techniques like dropout are efficient, while L1/L2 require
more computation.
Types of Auto Encoders
Over the years, different types of Autoencoders have been developed:
•Undercomplete Autoencoder
•Overcomplete Autoencoder
•Sparse Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
•Contractive Autoencoder
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
•Denoising Autoencoder
•Variational Autoencoder
•Convolutional Autoencoder
Undercomplete Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Overcomplete Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Sparse Autoencoder
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Contractive Autoencoder
•The model learns a vector field for mapping the input data
towards a lower dimensional manifold which describes the
natural data to cancel out the added noise.
•DAEs are particularly useful for tasks where the input data
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
is subject to noise, such as image denoising, speech
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
training data.
Applications
•Image Generation
•Text Generation
•Recommender Systems
•Anomaly Detection
•Image Denoising
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph
Convolutional Autoencoder
•They are particularly well-suited for tasks involving image data and spatial relationships.
https://www.linkedin.com/pulse/how-does-machine-learning-work-rohit-jayale/
https://www.freepik.com/free-vector/isometric-people-working-with-technology_5083803.htm#query=DeFi&position=6&from_view=search&track=sph