ArticleslgStudy

computer science

Autoencoder

Autoencoder is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Autoencoder rather than just read about it. In short: An autoencoder is a type of artificial neural network used to learn efficient codings of unlabeled data (unsupervised learning). An autoencoder learns two functions: an encoding function that transforms the input data, and a decoding function that recreates the input data from the encoded representation.

Autoencoder — main illustration
Autoencoder — illustration

Key takeaways

  • Autoencoder belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Autoencoder to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Autoencoder from memory before moving on to harder problems.

Reference excerpt

An autoencoder is a type of artificial neural network used to learn efficient codings of unlabeled data (unsupervised learning). An autoencoder learns two functions: an encoding function that transforms the input data, and a decoding function that recreates the input data from the encoded representation. The autoencoder learns an efficient representation (encoding) for a set of data, typically for dimensionality reduction, to generate lower-dimensional embeddings for subsequent use by other machine learning algorithms. Variants exist which aim to make the learned representations assume useful properties. Examples are regularized autoencoders (sparse, denoising and contractive autoencoders), which are effective in learning representations for subsequent classification tasks, and variational autoencoders, which can be used as generative models. Autoencoders are applied to many problems, including facial recognition, feature detection, anomaly detection, and learning the meaning of words. In terms of data synthesis, autoencoders can also be used to randomly generate new data that is similar to the input (training) data.

Mathematical principles

Definition An autoencoder is defined by the following components: Two sets: the space of encoded messages 𝒵; the space of decoded messages 𝒳. Typically 𝒳 and 𝒵 are Euclidean spaces, that is, 𝒳=ℝm,𝒵=ℝn with m>n. Two parametrized families of functions: the encoder family Eϕ:𝒳→𝒵, parametrized by ϕ; the decoder family Dθ:𝒵→𝒳, parametrized by θ.For any x∈𝒳, we usually write z=Eϕ(x), and refer to it as the code, the latent variable, latent representation, latent vector, etc. Conversely, for any z∈𝒵, we usually write x′=Dθ(z), and refer to it as the (decoded) message. Usually, both the encoder and the decoder are defined as multilayer perceptrons (MLPs). For example, a one-layer-MLP encoder Eϕ is:

Eϕ(𝐱)=σ(Wx+b) where σ is an element-wise activation function, W is a "weight" matrix, and b is a "bias" vector.

Training an autoencoder An autoencoder, by itself, is simply a tuple of two functions. To judge its quality, we need a task. A task is defined by a reference probability distribution μref over 𝒳, and a "reconstruction quality" function d:𝒳×𝒳→[0,∞], such that d(x,x′) measures how much x′ differs from x. With those, we can define the loss function for the autoencoder asL(θ,ϕ):=𝔼x∼μref[d(x,Dθ(Eϕ(x)))]The optimal autoencoder for the given task (μref,d) is then arg⁡minθ,ϕL(θ,ϕ). The search for the optimal autoencoder can be accomplished by any mathematical optimization technique, but usually by gradient descent. This search process is referred to as "training the autoencoder". In most situations, the reference distribution is just the empirical distribution given by a dataset {x1,...,xN}⊂𝒳, so thatμref=1N∑i=1Nδxi where δxi is the Dirac measure, the quality function is just L2 loss: d(x,x′)=‖x−x′‖22, and ‖⋅‖2 is the Euclidean norm. Then the problem of searching for the optimal autoencoder is just a least-squares optimization:minθ,ϕL(θ,ϕ),where L(θ,ϕ)=1N∑i=1N‖xi−Dθ(Eϕ(xi))‖22

Interpretation An autoencoder has two main parts: an encoder that maps the message to a code, and a decoder that reconstructs the message from the code. An optimal autoencoder would perform as close to perfect reconstruction as possible, with "close to perfect" defined by the reconstruction quality function d. The simplest way to perform the copying task perfectly would be to duplicate the signal. To suppress this behavior, the code space 𝒵 usually has fewer dimensions than the message space 𝒳. Such an autoencoder is called undercomplete. It can be interpreted as compressing the message, or reducing its dimensionality. At the limit of an ideal undercomplete autoencoder, every possible code z in the code space is used to encode a message x that really appears in the distribution μref, and the decoder is also perfect: Dθ(Eϕ(x))=x. This ideal autoencoder can then be used to generate messages indistinguishable from real messages, by feeding its decoder arbitrary code z and obtaining Dθ(z), which is a message that really appears in the distribution μref. If the code space 𝒵 has dimension larger than (overcomplete), or equal to, the message space 𝒳, or the hidden units are given enough capacity, an autoencoder can learn the identity function and become useless. However, experimental results found that overcomplete autoencoders might still learn useful features. In the ideal setting, the code dimension and the model capacity could be set on the basis of the complexity of the data distribution to be modeled. A standard way to do so is to add modifications to the basic autoencoder, to be detailed below.

Variations

Variational autoencoder (VAE)

Variational autoencoders (VAEs) belong to the families of variational Bayesian methods. Despite the architectural similarities with basic autoencoders, VAEs are architected with different goals and have a different mathematical formulation. The latent space is, in this case, composed of a mixture of distributions instead of fixed vectors. Given an input dataset x characterized by an unknown probability function P(x) and a multivariate latent encoding vector z, the objective is to model the data as a distribution pθ(x), with θ defined as the set of the network parameters so that pθ(x)=∫zpθ(x,z)dz.

… excerpt ends here. Continue reading the full article.

Illustrations

Autoencoder: A schema of an autoencoder. An autoencoder has two main parts: an encoder that maps the message to a code, and a decoder that reconstructs the message from the code.
A schema of an autoencoder. An autoencoder has two main parts: an encoder that maps the message to a code, and a decoder that reconstructs the message from the code.
Autoencoder: The basic scheme of a variational autoencoder. The model receives x as input. The encoder compresses it into the latent space. The decoder receives as input the information sampled from the latent space and produces x′ as similar as possible to x.
The basic scheme of a variational autoencoder. The model receives x as input. The encoder compresses it into the latent space. The decoder receives as input the information sampled from the latent space and produces x′ as similar as possible to x.
Autoencoder: Simple schema of a single-layer sparse autoencoder. The hidden nodes in bright yellow are activated, while the light yellow ones are inactive. The activation depends on the input.
Simple schema of a single-layer sparse autoencoder. The hidden nodes in bright yellow are activated, while the light yellow ones are inactive. The activation depends on the input.
Autoencoder: A schema of a denoising autoencoder
A schema of a denoising autoencoder
Autoencoder: Schematic structure of an autoencoder with 3 fully connected hidden layers. The code (z, or h for reference in the text) is the most internal layer.
Schematic structure of an autoencoder with 3 fully connected hidden layers. The code (z, or h for reference in the text) is the most internal layer.

Worked examples

Example 1 — a first encounter with Autoencoder

Start with the simplest possible case. Write down what Autoencoder claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Autoencoder before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Autoencoder ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Autoencoder

In research
Autoencoder appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Autoencoder in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Autoencoder is common in secondary-school and first-year university syllabi. It links to neighbouring topics Dimension reduction, Neural network architectures, Unsupervised learning, so understanding it makes those chapters shorter.
In everyday life
Look for Autoencoder outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Autoencoder” →

How to study Autoencoder in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Autoencoder means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Autoencoder out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Autoencoder in simple terms?

An autoencoder is a type of artificial neural network used to learn efficient codings of unlabeled data (unsupervised learning). An autoencoder learns two functions: an encoding function that transforms the input data, and a decoding function that recreates the input data from the encoded represent…

Why does Autoencoder matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Autoencoder?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Autoencoder.

Tags

  • Dimension reduction
  • Neural network architectures
  • Unsupervised learning

Keep exploring