Understanding Latent Space in Machine Learning

栏目: IT技术 · 发布时间: 6年前

内容简介:If I have to describe latent space in one sentence, it simply means a representation of compressed data.Imagine a large dataset of handwritten digits (0–9) like the one shown above. Handwritten images of the same number (i.e. images that are 3’s) are the m

Learn a fundamental, yet often ‘hidden,’ concept of deep learning

Feb 4 ·9min read

Understanding Latent Space in Machine Learning

Source: Hackernoon, https://hackernoon.com/latent-space-visualization-deep-learning-bits-2-bd09a46920df

What is Latent Space?

If I have to describe latent space in one sentence, it simply means a representation of compressed data.

Imagine a large dataset of handwritten digits (0–9) like the one shown above. Handwritten images of the same number (i.e. images that are 3’s) are the most similar to each other compared to other images of different numbers (i.e. 3s vs. 7s). But can we train an algorithm to recognize these similarities? How?

If you have trained a model to classify digits , then you have also trained the model to learn the ‘structural similarities’ between images. In fact, this is how the model is able to classify digits in the first place- by learning the features of each digit.

If it seems that this process is ‘hidden’ from you, it’s because it is. Latent, by definition, means “hidden.”

The concept of “latent space” is important because it’s utility is at the core of ‘deep learning’ — learning the features of data and simplifying data representations for the purpose of finding patterns.

Intrigued? Let’s break latent space down bit by bit:

Why do we compress data in ML?

Data compressionis defined as the process of encoding information using fewer bits than the original representation. This is like taking a 19D data point (need 19 values to define unique point) and squishing all that information into a 9D data point.

Understanding Latent Space in Machine Learning

Illustration of compression. Source: Faust 2013

More often than not, data is compressed in machine learning to learn important information about data points . Let me explain with an example.

Say we would like to train a model to classify an image using a fully convolutional neural network (FCN). (i.e. output digit number given image of digit). As the model ‘learns’, it is simply learning features at each layer (edges, angles, etc.) and attributing a combination of features to a specific output.

But each time the model learns through a data point, the dimensionality of the image is first reduced before it is ultimately increased. (see Encoder and Bottleneck below). When the dimensionality is reduced, we consider this a form of lossy compression.

Understanding Latent Space in Machine Learning

Depiction of convolutional neural network. Source: Source: Hackernoon Latent Space Visualization.

Because the model is required to then reconstruct the compressed data (see Decoder), it must learn to store all relevant information and disregard the noise. This is the value of compression- it allows us to get rid of any extraneous information, and only focus on the most important features.

This ‘compressed state’ is the Latent Space Representation of our data.

What do I mean by space?

You may be wondering why we call it a latent space . After all, compressed data, at first glance, may not evoke any sort of “space.”

But here’s the parallel.

In this rather simplistic example, let’s say our original dataset are images with dimensions 5 x 5 x 1. We will set our latent space dimensions to be 3 x 1, meaning our compressed data point is a vector with 3-dimensions.

Understanding Latent Space in Machine Learning
Example 5x5x1 data
Understanding Latent Space in Machine Learning
Example compressed 3x1 data in ‘latent space’

Now, each compressed data point is uniquely defined by only 3 numbers. That means we can graph this data on a 3D Plane (One number is x, the other y, the other z).

Understanding Latent Space in Machine Learning

Point (0.4, 0.3, 0.8) graphed in 3D space

This is the “space” that we are referring to.

Whenever we graph points or think of points in latent space, we can imagine them as coordinates in space in which points that are “similar” are closer together on the graph.

A natural question that arises is how would we imagine space of 4D points or n-dimensional points, or even non-vectors (since the latent space representation is NOT required to be 2 or 3-dimensional vectors, and is oftentimes not since too much information would be lost).

The unsatisfying answer is, we can’t . We are 3-dimensional creatures that cannot fathom n-dimensional space (such that n > 3). However, there are tools such as t-SNE which can transform our higher dimensional latent space representations into representations that we can visualize (2D or 3D). (See Visualizing Latent Space section below.)

But you may be wondering, what are ‘similar’ images, and why does reducing the dimensionality of our data make similar images ‘closer’ together in space?

What do I mean by similar?

If we look at three images, two of a chair and one of a desk, we would easily say that the two chair images are the most similar whereas the desk is the most different from either of the chair images.


以上所述就是小编给大家介绍的《Understanding Latent Space in Machine Learning》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

人类思维如何与互联网共同进化

人类思维如何与互联网共同进化

[美] 约翰·布罗克曼 / 付晓光 / 浙江人民出版社 / 2017-3 / 79.90元

➢人类是否因互联网的诞生进入了公平竞争的场域? “黑天鹅事件”频频发生,我们的预测能力是否正在退化? 智人的第四阶段有哪些特征? 全球脑会使人类成为“超级英雄”吗? 虚拟现实技术会不会灭绝人类的真实体验? 还有更多不可预知答案的问题,你将在本书中找到属于自己的答案! ➢ 我们的心智正和互联网发生着永无止境的共振,人类思维会因此产生怎样的进化效应?本书编者约翰•布......一起来看看 《人类思维如何与互联网共同进化》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具