Autoencoders

CloudxLab
CloudxLabCloudxLab
Autoencoders
Autoencoders
● Autoencoders are
○ Artificial neural networks
○ Capable of learning efficient representations of the input data, called
codings, without any supervision
○ The training set is unlabeled.
● These codings typically have a much lower dimensionality than the input
data, making autoencoders useful for dimensionality reduction
Autoencoders
Autoencoders
Why use Autoencoders?
● Useful for dimensionality reduction
● Autoencoders act as powerful feature detectors,
● And they can be used for unsupervised pre-training of deep neural
networks
● Lastly, they are capable of randomly generating new data that looks very
similar to the training data; this is called a generative model
Autoencoders
Autoencoders
Autoencoders
Why use Autoencoders?
For example, we could train an autoencoder on pictures of faces, and it
would then be able to generate new faces
Autoencoders
● Surprisingly, autoencoders work by simply learning to copy their inputs
to their outputs
● This may sound like a trivial task, but we will see that constraining the
network in various ways can make it rather difficult
Autoencoders
Autoencoders
Autoencoders
For example
● You can limit the size of the internal representation, or you can add noise
to the inputs and train the network to recover the original inputs.
● These constraints prevent the autoencoder from trivially copying the
inputs directly to the outputs, which forces it to learn efficient ways of
representing the data
● In short, the codings are byproducts of the autoencoder’s attempt to
learn the identity function under some constraints
Autoencoders
What we’ll learn ?
● We will explain in more depth how autoencoders work
● What types of constraints can be imposed
● And how to implement them using TensorFlow, whether it is for
○ Dimensionality reduction,
○ Feature extraction,
○ Insupervised pretraining,
○ Or as generative models
Autoencoders
Autoencoders
Let’s try to understand
“why constraining an
autoencoder during training pushes it to discover and exploit
patterns in the data”
With an example
Efficient Data Representations
Autoencoders
Which of the following number sequences do you find the easiest
to memorize?
● 40, 27, 25, 36, 81, 57, 10, 73, 19, 68
● 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20
Efficient Data Representations
Autoencoders
● At first glance, it would seem that the first sequence should be easier,
since it is much shorter
● However, if you look carefully at the second sequence, you may notice
that it follows two simple rules:
○ Even numbers are followed by their half,
○ And odd numbers are followed by their triple plus one
This is a famous sequence known as the hailstone sequence
Efficient Data Representations
Autoencoders
● Once you notice this pattern, the second sequence becomes much easier
to memorize than the first because you only need to memorize the two
rules,
○ The first number,
○ And the length of the sequence
Efficient Data Representations
Autoencoders
● Note that if we could quickly and easily memorize very long sequences,
you would not care much about the existence of a pattern in the
second sequence
● You would just learn every number by heart, and that would be that
● It is the fact that it is hard to memorize long sequences that makes
it useful to recognize patterns,
● And hopefully this clarifies why constraining an autoencoder during
training pushes it to discover and exploit patterns in the data
Efficient Data Representations
Autoencoders
The relationship between memory, perception, and pattern matching was
famously studied by William Chase and Herbert Simon in the early
1970s
Efficient Data Representations
William Chase Herbert Simon
Autoencoders
Let’s see how their study of chess players is similar to an
Autoencoder
● They observed that expert chess players were able to memorize the
positions of all the pieces in a game by looking at the board for just 5
seconds,
● A task that most people would find impossible
● However, this was only the case when the pieces were placed in realistic
positions from actual games, not when the pieces were placed randomly.
Efficient Data Representations
Autoencoders
Let’s see how their study of chess players is similar to an
Autoencoder
● Chess experts don’t have a much better memory than you and I,
● They just see chess patterns more easily thanks to their experience with
the game
● Noticing patterns helps them store information efficiently
Efficient Data Representations
Autoencoders
Let’s see how their study of chess players is similar to an
Autoencoder
● Just like the chess players in this memory experiment, an autoencoder
○ looks at the inputs,
○ converts them to an efficient internal representation,
○ and then spits out something that (hopefully) looks very close to the
inputs
Efficient Data Representations
Autoencoders
Composition of Autoencoder
An autoencoder is always composed of two parts:
● An encoder or recognition network that converts the inputs to an
internal representation,
● Followed by a decoder or generative network that converts the
internal representation to the outputs
Efficient Data Representations
Autoencoders
Composition of Autoencoder
Efficient Data Representations
Autoencoders
Composition of Autoencoder
Efficient Data Representations
An autoencoder
typically has the same
architecture as a
Multi-Layer
Perceptron, except that
the number of neurons
in the output layer must
be equal to the
number of inputs
Autoencoders
There is just one hidden
layer composed of two
neurons (the encoder),
and one output layer
composed of three
neurons (the decoder)
Composition of Autoencoder
Efficient Data Representations
Autoencoders
Composition of Autoencoder
Efficient Data Representations
The outputs are often called
the reconstructions
since the autoencoder tries
to reconstruct the inputs,
and the cost function
contains a reconstruction
loss that penalizes the model
when the reconstructions are
different from the inputs.
Autoencoders
Because the internal
representation has a lower
dimensionality than the input
data, it is 2D instead of
3D, the autoencoder is said
to be undercomplete
Composition of Autoencoder
Efficient Data Representations
Autoencoders
Composition of Autoencoder
Efficient Data Representations
● An undercomplete
autoencoder cannot
trivially copy its inputs to
the codings, yet it must
find a way to output a
copy of its inputs
● It is forced to learn the
most important features in
the input data and drop
the unimportant ones
Autoencoders
Let’s implement a very simple undercomplete autoencoder for
dimensionality reduction
Autoencoders
PCA with an Undercomplete Linear Autoencoder
If the autoencoder uses only linear activations and the cost function is
the Mean Squared Error (MSE), then it can be shown that it ends up
performing Principal Component Analysis
Now we will build a simple linear autoencoder to perform PCA on a 3D
dataset, projecting it to 2D
Autoencoders
>>> import tensorflow as tf
>>> from tensorflow.contrib.layers import fully_connected
>>> n_inputs = 3 # 3D inputs
>>> n_hidden = 2 # 2D codings
>>> n_outputs = n_inputs
>>> learning_rate = 0.01
>>> X = tf.placeholder(tf.float32, shape=[None, n_inputs])
>>> hidden = fully_connected(X, n_hidden, activation_fn=None)
>>> outputs = fully_connected(hidden, n_outputs, activation_fn=None)
>>> reconstruction_loss = tf.reduce_mean(tf.square(outputs - X)) # MSE
>>> optimizer = tf.train.AdamOptimizer(learning_rate)
>>> training_op = optimizer.minimize(reconstruction_loss)
>>> init = tf.global_variables_initializer()
PCA with an Undercomplete Linear Autoencoder
Run it on Notebook
Autoencoders
PCA with an Undercomplete Linear Autoencoder
The two things to note in the previous code are are:
● The number of outputs is equal to the number of inputs
● To perform simple PCA, we set activation_fn=None i.e., all neurons
are linear, and the cost function is the MSE.
Autoencoders
Now let’s load the dataset, train the model on the training set, and use it to
encode the test set i.e., project it to 2D
>>> X_train, X_test = [...] # load the dataset
>>> n_iterations = 1000
>>> codings = hidden # the output of the hidden layer provides the
codings
>>> with tf.Session() as sess:
init.run()
for iteration in range(n_iterations):
training_op.run(feed_dict={X: X_train}) # no labels
codings_val = codings.eval(feed_dict={X: X_test})
PCA with an Undercomplete Linear Autoencoder
Run it on Notebook
Autoencoders
Above figure shows the original 3D dataset (at the left) and the output of
the autoencoder’s hidden layer (i.e., the coding layer, at the right)
PCA with an Undercomplete Linear Autoencoder
Autoencoders
PCA with an Undercomplete Linear Autoencoder
As you can see, the autoencoder found the best 2D plane to project the
data onto, preserving as much variance in the data as it could just like PCA
Questions?
https://discuss.cloudxlab.com
reachus@cloudxlab.com
1 de 31

Recomendados

Autoencoders in Deep Learning por
Autoencoders in Deep LearningAutoencoders in Deep Learning
Autoencoders in Deep Learningmilad abbasi
1.5K visualizações27 slides
Autoencoder por
AutoencoderAutoencoder
AutoencoderWataru Hirota
1.3K visualizações32 slides
Autoencoder por
AutoencoderAutoencoder
AutoencoderHARISH R
986 visualizações24 slides
Simple Introduction to AutoEncoder por
Simple Introduction to AutoEncoderSimple Introduction to AutoEncoder
Simple Introduction to AutoEncoderJun Lang
28.3K visualizações35 slides
Introduction to Autoencoders por
Introduction to AutoencodersIntroduction to Autoencoders
Introduction to AutoencodersYan Xu
1.1K visualizações36 slides
An overview of gradient descent optimization algorithms por
An overview of gradient descent optimization algorithms An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms Hakky St
39.4K visualizações86 slides

Mais conteúdo relacionado

Mais procurados

Convolutional Neural Networks (CNN) por
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Gaurav Mittal
58.5K visualizações70 slides
Back propagation por
Back propagationBack propagation
Back propagationNagarajan
66.6K visualizações44 slides
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |... por
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...Edureka!
1.2K visualizações50 slides
Convolution Neural Network (CNN) por
Convolution Neural Network (CNN)Convolution Neural Network (CNN)
Convolution Neural Network (CNN)Suraj Aavula
13.6K visualizações22 slides
Introduction to ML (Machine Learning) por
Introduction to ML (Machine Learning)Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)SwatiTripathi44
2K visualizações31 slides
Statistical Pattern recognition(1) por
Statistical Pattern recognition(1)Statistical Pattern recognition(1)
Statistical Pattern recognition(1)Syed Atif Naseem
7.8K visualizações40 slides

Mais procurados(20)

Convolutional Neural Networks (CNN) por Gaurav Mittal
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)
Gaurav Mittal58.5K visualizações
Back propagation por Nagarajan
Back propagationBack propagation
Back propagation
Nagarajan66.6K visualizações
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |... por Edureka!
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...
Autoencoders Tutorial | Autoencoders In Deep Learning | Tensorflow Training |...
Edureka!1.2K visualizações
Convolution Neural Network (CNN) por Suraj Aavula
Convolution Neural Network (CNN)Convolution Neural Network (CNN)
Convolution Neural Network (CNN)
Suraj Aavula13.6K visualizações
Introduction to ML (Machine Learning) por SwatiTripathi44
Introduction to ML (Machine Learning)Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)
SwatiTripathi442K visualizações
Statistical Pattern recognition(1) por Syed Atif Naseem
Statistical Pattern recognition(1)Statistical Pattern recognition(1)
Statistical Pattern recognition(1)
Syed Atif Naseem7.8K visualizações
Convolutional Neural Network and Its Applications por Kasun Chinthaka Piyarathna
Convolutional Neural Network and Its ApplicationsConvolutional Neural Network and Its Applications
Convolutional Neural Network and Its Applications
Kasun Chinthaka Piyarathna4.6K visualizações
Introduction to CNN por Shuai Zhang
Introduction to CNNIntroduction to CNN
Introduction to CNN
Shuai Zhang8.8K visualizações
backpropagation in neural networks por Akash Goel
backpropagation in neural networksbackpropagation in neural networks
backpropagation in neural networks
Akash Goel25.9K visualizações
Stochastic Gradient Decent (SGD).pptx por Shubham Jaybhaye
Stochastic Gradient Decent (SGD).pptxStochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptx
Shubham Jaybhaye665 visualizações
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L... por Md. Main Uddin Rony
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Md. Main Uddin Rony4.4K visualizações
Convolutional neural network por Yan Xu
Convolutional neural network Convolutional neural network
Convolutional neural network
Yan Xu5.3K visualizações
Convolution Neural Network (CNN) por Basit Rafiq
Convolution Neural Network (CNN)Convolution Neural Network (CNN)
Convolution Neural Network (CNN)
Basit Rafiq584 visualizações
Convolutional Neural Network Models - Deep Learning por Benha University
Convolutional Neural Network Models - Deep LearningConvolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep Learning
Benha University12.6K visualizações
Naive bayes por Ashraf Uddin
Naive bayesNaive bayes
Naive bayes
Ashraf Uddin73.3K visualizações
Machine Learning With Logistic Regression por Knoldus Inc.
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
Knoldus Inc.5.6K visualizações
Linear regression with gradient descent por Suraj Parmar
Linear regression with gradient descentLinear regression with gradient descent
Linear regression with gradient descent
Suraj Parmar1.7K visualizações
Deep neural networks por Si Haem
Deep neural networksDeep neural networks
Deep neural networks
Si Haem162.4K visualizações
Convolutional neural network por MojammilHusain
Convolutional neural networkConvolutional neural network
Convolutional neural network
MojammilHusain1.1K visualizações

Similar a Autoencoders

Autoecoders.pptx por
Autoecoders.pptxAutoecoders.pptx
Autoecoders.pptxMirzaJahanzeb5
5 visualizações23 slides
UNIT-4.pdf por
UNIT-4.pdfUNIT-4.pdf
UNIT-4.pdfNiharikaThakur32
30 visualizações42 slides
UNIT-4.pdf por
UNIT-4.pdfUNIT-4.pdf
UNIT-4.pdfNiharikaThakur32
9 visualizações42 slides
UNIT-4.pptx por
UNIT-4.pptxUNIT-4.pptx
UNIT-4.pptxNiharikaThakur32
184 visualizações75 slides
ENNEoS Presentation - HackMiami por
ENNEoS Presentation - HackMiamiENNEoS Presentation - HackMiami
ENNEoS Presentation - HackMiamiDrew Kirkpatrick
227 visualizações15 slides
ENNEoS Presentation - CackalackyCon por
ENNEoS Presentation - CackalackyConENNEoS Presentation - CackalackyCon
ENNEoS Presentation - CackalackyConDrew Kirkpatrick
18 visualizações15 slides

Similar a Autoencoders(20)

Autoecoders.pptx por MirzaJahanzeb5
Autoecoders.pptxAutoecoders.pptx
Autoecoders.pptx
MirzaJahanzeb55 visualizações
UNIT-4.pptx por NiharikaThakur32
UNIT-4.pptxUNIT-4.pptx
UNIT-4.pptx
NiharikaThakur32184 visualizações
ENNEoS Presentation - HackMiami por Drew Kirkpatrick
ENNEoS Presentation - HackMiamiENNEoS Presentation - HackMiami
ENNEoS Presentation - HackMiami
Drew Kirkpatrick227 visualizações
ENNEoS Presentation - CackalackyCon por Drew Kirkpatrick
ENNEoS Presentation - CackalackyConENNEoS Presentation - CackalackyCon
ENNEoS Presentation - CackalackyCon
Drew Kirkpatrick18 visualizações
Unsupervised Feature Learning por Amgad Muhammad
Unsupervised Feature LearningUnsupervised Feature Learning
Unsupervised Feature Learning
Amgad Muhammad7.2K visualizações
Denoising autoencoder by Harish.R por HARISH R
Denoising autoencoder by Harish.RDenoising autoencoder by Harish.R
Denoising autoencoder by Harish.R
HARISH R706 visualizações
Data Analysis with TensorFlow in PostgreSQL por EDB
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQL
EDB264 visualizações
MySQL Query Optimisation 101 por Federico Razzoli
MySQL Query Optimisation 101MySQL Query Optimisation 101
MySQL Query Optimisation 101
Federico Razzoli852 visualizações
Computer Architecture and Organization por ssuserdfc773
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organization
ssuserdfc77325 visualizações
Introduction to Tensor Flow for Optical Character Recognition (OCR) por Vincenzo Santopietro
Introduction to Tensor Flow for Optical Character Recognition (OCR)Introduction to Tensor Flow for Optical Character Recognition (OCR)
Introduction to Tensor Flow for Optical Character Recognition (OCR)
Vincenzo Santopietro3K visualizações
Meetup 29042015 por lbishal
Meetup 29042015Meetup 29042015
Meetup 29042015
lbishal584 visualizações
Practical ML por Antonio Pitasi
Practical MLPractical ML
Practical ML
Antonio Pitasi20 visualizações
Intro to Instrumentation por Paige Cruz
Intro to InstrumentationIntro to Instrumentation
Intro to Instrumentation
Paige Cruz5 visualizações
2019 session 6 develop programs to solve a variety of problems in math , phys... por Osama Ghandour Geris
2019 session 6 develop programs to solve a variety of problems in math , phys...2019 session 6 develop programs to solve a variety of problems in math , phys...
2019 session 6 develop programs to solve a variety of problems in math , phys...
Osama Ghandour Geris43 visualizações
Machine Learning Lecture 3 Decision Trees por ananth
Machine Learning Lecture 3 Decision TreesMachine Learning Lecture 3 Decision Trees
Machine Learning Lecture 3 Decision Trees
ananth5.8K visualizações

Mais de CloudxLab

Understanding computer vision with Deep Learning por
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep LearningCloudxLab
1.6K visualizações191 slides
Deep Learning Overview por
Deep Learning OverviewDeep Learning Overview
Deep Learning OverviewCloudxLab
1.5K visualizações153 slides
Recurrent Neural Networks por
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural NetworksCloudxLab
913 visualizações218 slides
Natural Language Processing por
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingCloudxLab
1.1K visualizações65 slides
Naive Bayes por
Naive BayesNaive Bayes
Naive BayesCloudxLab
7.5K visualizações27 slides
Training Deep Neural Nets por
Training Deep Neural NetsTraining Deep Neural Nets
Training Deep Neural NetsCloudxLab
809 visualizações264 slides

Mais de CloudxLab(20)

Understanding computer vision with Deep Learning por CloudxLab
Understanding computer vision with Deep LearningUnderstanding computer vision with Deep Learning
Understanding computer vision with Deep Learning
CloudxLab1.6K visualizações
Deep Learning Overview por CloudxLab
Deep Learning OverviewDeep Learning Overview
Deep Learning Overview
CloudxLab1.5K visualizações
Recurrent Neural Networks por CloudxLab
Recurrent Neural NetworksRecurrent Neural Networks
Recurrent Neural Networks
CloudxLab913 visualizações
Natural Language Processing por CloudxLab
Natural Language ProcessingNatural Language Processing
Natural Language Processing
CloudxLab1.1K visualizações
Naive Bayes por CloudxLab
Naive BayesNaive Bayes
Naive Bayes
CloudxLab7.5K visualizações
Training Deep Neural Nets por CloudxLab
Training Deep Neural NetsTraining Deep Neural Nets
Training Deep Neural Nets
CloudxLab809 visualizações
Reinforcement Learning por CloudxLab
Reinforcement LearningReinforcement Learning
Reinforcement Learning
CloudxLab829 visualizações
Apache Spark - Key Value RDD - Transformations | Big Data Hadoop Spark Tutori... por CloudxLab
Apache Spark - Key Value RDD - Transformations | Big Data Hadoop Spark Tutori...Apache Spark - Key Value RDD - Transformations | Big Data Hadoop Spark Tutori...
Apache Spark - Key Value RDD - Transformations | Big Data Hadoop Spark Tutori...
CloudxLab293 visualizações
Advanced Spark Programming - Part 2 | Big Data Hadoop Spark Tutorial | CloudxLab por CloudxLab
Advanced Spark Programming - Part 2 | Big Data Hadoop Spark Tutorial | CloudxLabAdvanced Spark Programming - Part 2 | Big Data Hadoop Spark Tutorial | CloudxLab
Advanced Spark Programming - Part 2 | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab903 visualizações
Apache Spark - Dataframes & Spark SQL - Part 2 | Big Data Hadoop Spark Tutori... por CloudxLab
Apache Spark - Dataframes & Spark SQL - Part 2 | Big Data Hadoop Spark Tutori...Apache Spark - Dataframes & Spark SQL - Part 2 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 2 | Big Data Hadoop Spark Tutori...
CloudxLab450 visualizações
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori... por CloudxLab
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
CloudxLab656 visualizações
Apache Spark - Running on a Cluster | Big Data Hadoop Spark Tutorial | CloudxLab por CloudxLab
Apache Spark - Running on a Cluster | Big Data Hadoop Spark Tutorial | CloudxLabApache Spark - Running on a Cluster | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Running on a Cluster | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab449 visualizações
Introduction to SparkR | Big Data Hadoop Spark Tutorial | CloudxLab por CloudxLab
Introduction to SparkR | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to SparkR | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to SparkR | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab173 visualizações
Introduction to NoSQL | Big Data Hadoop Spark Tutorial | CloudxLab por CloudxLab
Introduction to NoSQL | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to NoSQL | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to NoSQL | Big Data Hadoop Spark Tutorial | CloudxLab
CloudxLab192 visualizações
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial... por CloudxLab
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
Introduction to MapReduce - Hadoop Streaming | Big Data Hadoop Spark Tutorial...
CloudxLab443 visualizações
Introduction To TensorFlow | Deep Learning Using TensorFlow | CloudxLab por CloudxLab
Introduction To TensorFlow | Deep Learning Using TensorFlow | CloudxLabIntroduction To TensorFlow | Deep Learning Using TensorFlow | CloudxLab
Introduction To TensorFlow | Deep Learning Using TensorFlow | CloudxLab
CloudxLab867 visualizações
Introduction to Deep Learning | CloudxLab por CloudxLab
Introduction to Deep Learning | CloudxLabIntroduction to Deep Learning | CloudxLab
Introduction to Deep Learning | CloudxLab
CloudxLab448 visualizações
Dimensionality Reduction | Machine Learning | CloudxLab por CloudxLab
Dimensionality Reduction | Machine Learning | CloudxLabDimensionality Reduction | Machine Learning | CloudxLab
Dimensionality Reduction | Machine Learning | CloudxLab
CloudxLab1.9K visualizações
Ensemble Learning and Random Forests por CloudxLab
Ensemble Learning and Random ForestsEnsemble Learning and Random Forests
Ensemble Learning and Random Forests
CloudxLab2.2K visualizações
Decision Trees por CloudxLab
Decision TreesDecision Trees
Decision Trees
CloudxLab797 visualizações

Último

Case Study Copenhagen Energy and Business Central.pdf por
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdfAitana
16 visualizações3 slides
6g - REPORT.pdf por
6g - REPORT.pdf6g - REPORT.pdf
6g - REPORT.pdfLiveplex
10 visualizações23 slides
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf por
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdfDr. Jimmy Schwarzkopf
19 visualizações29 slides
Network Source of Truth and Infrastructure as Code revisited por
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisitedNetwork Automation Forum
26 visualizações45 slides
STPI OctaNE CoE Brochure.pdf por
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdfmadhurjyapb
14 visualizações1 slide
Data Integrity for Banking and Financial Services por
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
21 visualizações26 slides

Último(20)

Case Study Copenhagen Energy and Business Central.pdf por Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 visualizações
6g - REPORT.pdf por Liveplex
6g - REPORT.pdf6g - REPORT.pdf
6g - REPORT.pdf
Liveplex10 visualizações
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf por Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
Dr. Jimmy Schwarzkopf19 visualizações
Network Source of Truth and Infrastructure as Code revisited por Network Automation Forum
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum26 visualizações
STPI OctaNE CoE Brochure.pdf por madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 visualizações
Data Integrity for Banking and Financial Services por Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely21 visualizações
virtual reality.pptx por G036GaikwadSnehal
virtual reality.pptxvirtual reality.pptx
virtual reality.pptx
G036GaikwadSnehal11 visualizações
Business Analyst Series 2023 - Week 3 Session 5 por DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10248 visualizações
Future of AR - Facebook Presentation por ssuserb54b561
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
ssuserb54b56114 visualizações
Special_edition_innovator_2023.pdf por WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 visualizações
Evolving the Network Automation Journey from Python to Platforms por Network Automation Forum
Evolving the Network Automation Journey from Python to PlatformsEvolving the Network Automation Journey from Python to Platforms
Evolving the Network Automation Journey from Python to Platforms
Network Automation Forum13 visualizações
Powerful Google developer tools for immediate impact! (2023-24) por wesley chun
Powerful Google developer tools for immediate impact! (2023-24)Powerful Google developer tools for immediate impact! (2023-24)
Powerful Google developer tools for immediate impact! (2023-24)
wesley chun10 visualizações
Kyo - Functional Scala 2023.pdf por Flavio W. Brasil
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdf
Flavio W. Brasil368 visualizações
Microsoft Power Platform.pptx por Uni Systems S.M.S.A.
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptx
Uni Systems S.M.S.A.53 visualizações
Uni Systems for Power Platform.pptx por Uni Systems S.M.S.A.
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptx
Uni Systems S.M.S.A.56 visualizações
Piloting & Scaling Successfully With Microsoft Viva por Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Richard Harbridge12 visualizações
NET Conf 2023 Recap por Lee Richardson
NET Conf 2023 RecapNET Conf 2023 Recap
NET Conf 2023 Recap
Lee Richardson10 visualizações

Autoencoders

  • 2. Autoencoders ● Autoencoders are ○ Artificial neural networks ○ Capable of learning efficient representations of the input data, called codings, without any supervision ○ The training set is unlabeled. ● These codings typically have a much lower dimensionality than the input data, making autoencoders useful for dimensionality reduction Autoencoders
  • 3. Autoencoders Why use Autoencoders? ● Useful for dimensionality reduction ● Autoencoders act as powerful feature detectors, ● And they can be used for unsupervised pre-training of deep neural networks ● Lastly, they are capable of randomly generating new data that looks very similar to the training data; this is called a generative model Autoencoders
  • 4. Autoencoders Autoencoders Why use Autoencoders? For example, we could train an autoencoder on pictures of faces, and it would then be able to generate new faces
  • 5. Autoencoders ● Surprisingly, autoencoders work by simply learning to copy their inputs to their outputs ● This may sound like a trivial task, but we will see that constraining the network in various ways can make it rather difficult Autoencoders
  • 6. Autoencoders Autoencoders For example ● You can limit the size of the internal representation, or you can add noise to the inputs and train the network to recover the original inputs. ● These constraints prevent the autoencoder from trivially copying the inputs directly to the outputs, which forces it to learn efficient ways of representing the data ● In short, the codings are byproducts of the autoencoder’s attempt to learn the identity function under some constraints
  • 7. Autoencoders What we’ll learn ? ● We will explain in more depth how autoencoders work ● What types of constraints can be imposed ● And how to implement them using TensorFlow, whether it is for ○ Dimensionality reduction, ○ Feature extraction, ○ Insupervised pretraining, ○ Or as generative models Autoencoders
  • 8. Autoencoders Let’s try to understand “why constraining an autoencoder during training pushes it to discover and exploit patterns in the data” With an example Efficient Data Representations
  • 9. Autoencoders Which of the following number sequences do you find the easiest to memorize? ● 40, 27, 25, 36, 81, 57, 10, 73, 19, 68 ● 50, 25, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20 Efficient Data Representations
  • 10. Autoencoders ● At first glance, it would seem that the first sequence should be easier, since it is much shorter ● However, if you look carefully at the second sequence, you may notice that it follows two simple rules: ○ Even numbers are followed by their half, ○ And odd numbers are followed by their triple plus one This is a famous sequence known as the hailstone sequence Efficient Data Representations
  • 11. Autoencoders ● Once you notice this pattern, the second sequence becomes much easier to memorize than the first because you only need to memorize the two rules, ○ The first number, ○ And the length of the sequence Efficient Data Representations
  • 12. Autoencoders ● Note that if we could quickly and easily memorize very long sequences, you would not care much about the existence of a pattern in the second sequence ● You would just learn every number by heart, and that would be that ● It is the fact that it is hard to memorize long sequences that makes it useful to recognize patterns, ● And hopefully this clarifies why constraining an autoencoder during training pushes it to discover and exploit patterns in the data Efficient Data Representations
  • 13. Autoencoders The relationship between memory, perception, and pattern matching was famously studied by William Chase and Herbert Simon in the early 1970s Efficient Data Representations William Chase Herbert Simon
  • 14. Autoencoders Let’s see how their study of chess players is similar to an Autoencoder ● They observed that expert chess players were able to memorize the positions of all the pieces in a game by looking at the board for just 5 seconds, ● A task that most people would find impossible ● However, this was only the case when the pieces were placed in realistic positions from actual games, not when the pieces were placed randomly. Efficient Data Representations
  • 15. Autoencoders Let’s see how their study of chess players is similar to an Autoencoder ● Chess experts don’t have a much better memory than you and I, ● They just see chess patterns more easily thanks to their experience with the game ● Noticing patterns helps them store information efficiently Efficient Data Representations
  • 16. Autoencoders Let’s see how their study of chess players is similar to an Autoencoder ● Just like the chess players in this memory experiment, an autoencoder ○ looks at the inputs, ○ converts them to an efficient internal representation, ○ and then spits out something that (hopefully) looks very close to the inputs Efficient Data Representations
  • 17. Autoencoders Composition of Autoencoder An autoencoder is always composed of two parts: ● An encoder or recognition network that converts the inputs to an internal representation, ● Followed by a decoder or generative network that converts the internal representation to the outputs Efficient Data Representations
  • 19. Autoencoders Composition of Autoencoder Efficient Data Representations An autoencoder typically has the same architecture as a Multi-Layer Perceptron, except that the number of neurons in the output layer must be equal to the number of inputs
  • 20. Autoencoders There is just one hidden layer composed of two neurons (the encoder), and one output layer composed of three neurons (the decoder) Composition of Autoencoder Efficient Data Representations
  • 21. Autoencoders Composition of Autoencoder Efficient Data Representations The outputs are often called the reconstructions since the autoencoder tries to reconstruct the inputs, and the cost function contains a reconstruction loss that penalizes the model when the reconstructions are different from the inputs.
  • 22. Autoencoders Because the internal representation has a lower dimensionality than the input data, it is 2D instead of 3D, the autoencoder is said to be undercomplete Composition of Autoencoder Efficient Data Representations
  • 23. Autoencoders Composition of Autoencoder Efficient Data Representations ● An undercomplete autoencoder cannot trivially copy its inputs to the codings, yet it must find a way to output a copy of its inputs ● It is forced to learn the most important features in the input data and drop the unimportant ones
  • 24. Autoencoders Let’s implement a very simple undercomplete autoencoder for dimensionality reduction
  • 25. Autoencoders PCA with an Undercomplete Linear Autoencoder If the autoencoder uses only linear activations and the cost function is the Mean Squared Error (MSE), then it can be shown that it ends up performing Principal Component Analysis Now we will build a simple linear autoencoder to perform PCA on a 3D dataset, projecting it to 2D
  • 26. Autoencoders >>> import tensorflow as tf >>> from tensorflow.contrib.layers import fully_connected >>> n_inputs = 3 # 3D inputs >>> n_hidden = 2 # 2D codings >>> n_outputs = n_inputs >>> learning_rate = 0.01 >>> X = tf.placeholder(tf.float32, shape=[None, n_inputs]) >>> hidden = fully_connected(X, n_hidden, activation_fn=None) >>> outputs = fully_connected(hidden, n_outputs, activation_fn=None) >>> reconstruction_loss = tf.reduce_mean(tf.square(outputs - X)) # MSE >>> optimizer = tf.train.AdamOptimizer(learning_rate) >>> training_op = optimizer.minimize(reconstruction_loss) >>> init = tf.global_variables_initializer() PCA with an Undercomplete Linear Autoencoder Run it on Notebook
  • 27. Autoencoders PCA with an Undercomplete Linear Autoencoder The two things to note in the previous code are are: ● The number of outputs is equal to the number of inputs ● To perform simple PCA, we set activation_fn=None i.e., all neurons are linear, and the cost function is the MSE.
  • 28. Autoencoders Now let’s load the dataset, train the model on the training set, and use it to encode the test set i.e., project it to 2D >>> X_train, X_test = [...] # load the dataset >>> n_iterations = 1000 >>> codings = hidden # the output of the hidden layer provides the codings >>> with tf.Session() as sess: init.run() for iteration in range(n_iterations): training_op.run(feed_dict={X: X_train}) # no labels codings_val = codings.eval(feed_dict={X: X_test}) PCA with an Undercomplete Linear Autoencoder Run it on Notebook
  • 29. Autoencoders Above figure shows the original 3D dataset (at the left) and the output of the autoencoder’s hidden layer (i.e., the coding layer, at the right) PCA with an Undercomplete Linear Autoencoder
  • 30. Autoencoders PCA with an Undercomplete Linear Autoencoder As you can see, the autoencoder found the best 2D plane to project the data onto, preserving as much variance in the data as it could just like PCA