avatarRukshan Pramoditha

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3011

Abstract

f-hidden-layers-affects-the-quality-of-autoencoder-latent-representation-181215c8e7d1"><i>the number of hidden layers</i></a>, and <i>the</i> <i>number of nodes in each layer</i>. Generally, these things define the <a href="https://towardsdatascience.com/classification-of-neural-network-hyperparameters-c7991b6937c3#e0a5">structure</a> of the autoencoder architecture.</p><p id="a06c">By using an appropriate architecture, we can achieve the same “spatial relationship characteristic” with autoencoders as in t-SNE!</p><p id="616a">The following plot shows the lower-dimensional representation of MNIST data achieved using t-SNE.</p><figure id="50a8"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*C6QP8slmFmCX6BmVMvFJMw.png"><figcaption>(Image by author)</figcaption></figure><p id="fd99">It is clear that data points are separated as clusters according to their class labels. The nearby data points of the same class in the original dimension will still be nearby in the lower dimension!</p><p id="de08">Now, we will use the following autoencoder with only two hidden layers to visualize MNIST data in a lower-dimensional form.</p><figure id="e321"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*cIhnVc56jd1nDsKZ5HwKVg.png"><figcaption>(Image by author)</figcaption></figure><p id="87c4">This autoencoder architecture is capable of distinguishing between the nine clusters to some extent, but not perfectly as in t-SNE. The cluster separation is not good enough.</p><figure id="d723"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*y2yd_-siCeR_qIMx_9fjVA.png"><figcaption>(Image by author)</figcaption></figure><p id="6356">After we increase the number of hidden layers and nodes in the autoencoder architecture as in the following figure, the cluster separation becomes very clear!</p><figure id="b21f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*YiIClFfyPn0Qv2pbWc5X8Q.png"><figcaption>(Image by author)</figcaption></figure><p id="42ff">The separation of clusters is very clear now as in t-SNE!</p><figure id="eb13"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*rHZObRXfO04LooRmDxrn8w.png"><figcaption>(Image by author)</figcaption></figure><p id="b306">This is the end of today’s article.</p><p id="3f39"><b>Please let me know if you’ve any questions or feedback.</b></p><h2 id="1835">Other dimensionality reduction methods you might be interested in</h2><ul><li><a href="https://readmedium.com/3-easy-steps-to-perform-dimensionality-reduction-using-principal-component-analysis-pca-79121998b991"><b>Principal Component Analysis (PCA)</b></a></li><li><a href="https://towardsdatascience.com/factor-analysis-on-women-track-records-data-with-r-and-python-6731a73cd2e0"><b>Factor Analysis (FA)</b></a></li><li><a href="https://towardsdatascience.com/lda-is-highly-effective-than-pca-for-dimensionality-reduction-in-classification-datasets-4489eade632"><b>Linear Discriminant Analysis (LDA)</b></a></li><li><a

Options

href="https://towardsdatascience.com/non-negative-matrix-factorization-nmf-for-dimensionality-reduction-in-image-data-8450f4cae8fa"><b>Non-Negative Matrix Factorization (NMF)</b></a></li><li><a href="https://towardsdatascience.com/how-autoencoders-outperform-pca-in-dimensionality-reduction-1ae44c68b42f"><b>Autoencoders (AEs)</b></a></li><li><a href="https://towardsdatascience.com/dimensionality-reduction-for-linearly-inseparable-data-5030f0dc0f5e"><b>Kernel PCA</b></a></li><li><a href="https://rukshanpramoditha.medium.com/recursive-feature-elimination-rfe-in-regression-and-classification-models-7d2497930b10"><b>Recursive Feature Elimination (RFE)</b></a></li><li><a href="https://rukshanpramoditha.medium.com/truncated-svd-for-dimensionality-reduction-in-sparse-feature-matrices-c083b4af7ddc"><b>Truncated SVD</b></a></li><li><a href="https://towardsdatascience.com/how-t-sne-outperforms-pca-in-dimensionality-reduction-7a3975e8cbdb"><b>t-SNE</b></a></li></ul><h2 id="ea56">Read next (Recommended)</h2><ul><li><a href="https://rukshanpramoditha.medium.com/list/pca-and-dimensionality-reduction-special-collection-146045a5acb5"><b>PCA and Dimensionality Reduction Special Collection</b></a></li></ul><h2 id="ce44">How about an AI course?</h2><ul><li><a href="https://rukshanpramoditha.medium.com/list/neural-networks-and-deep-learning-course-a2779b9c3f75"><b>Neural Networks and Deep Learning Course</b></a></li></ul><h2 id="3f63">Support me as a writer</h2><p id="6e06"><i>I hope you enjoyed reading this article. If you’d like to support me as a writer, kindly consider <a href="https://rukshanpramoditha.medium.com/membership"><b>signing up for a membership</b></a> to get unlimited access to Medium. It only costs $5 per month and I will receive a portion of your membership fee.</i></p><div id="e612" class="link-block"> <a href="https://rukshanpramoditha.medium.com/membership"> <div> <div> <h2>Join Medium with my referral link - Rukshan Pramoditha</h2> <div><h3>As a Medium member, a portion of your membership fee goes to writers you read, and you get full access to every story…</h3></div> <div><p>rukshanpramoditha.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*0Z7Nvgi4-HVxFR_E)"></div> </div> </div> </a> </div><h2 id="7f0f">Join my private list of emails</h2><p id="3415"><i>Never miss a great story from me again. By <a href="https://rukshanpramoditha.medium.com/subscribe"><b>subscribing to my email list</b></a>, you will directly receive my stories as soon as I publish them.</i></p><p id="7ac0">Thank you so much for your continuous support! See you in the next article. Happy learning to everyone!</p><p id="5bac"><b>Designed and written by: <a href="undefined">Rukshan Pramoditha</a></b></p><p id="ce4c"><b>2023–06–30</b></p></article></body>

Autoencoders vs t-SNE for Dimensionality Reduction

While preserving spatial relationships between data points in both lower and higher dimensions

Photo by Crina-Miriam Cretu on Unsplash

Autoencoders (AEs) and t-SNE are two main techniques for dimensionality reduction.

Autoencoders are a type of neural network architecture with many practical applications. Dimensionality reduction is one of them. Autoencoders can be used for dimensionality reduction in non-linear data.

t-SNE is also a non-linear dimensionality reduction technique that can be used for visualizing high-dimensional data in a lower-dimensional space to find important clusters or groups in the data.

Both t-SNE and autoencoders can handle non-linear data which is very common in real-world applications.

However, autoencoders need a very large amount of data and computational resources to train the algorithm as it is a neural network architecture. In contrast, t-SNE is a general machine-learning algorithm that only needs a very small amount of data to train the algorithm.

In particular, t-SNE can preserve the spatial relationship between data points in both higher and lower dimensions after reducing the dimensionality of the data. It means that the nearby data points of the same class in the original dimension will still be nearby in the lower dimension. Therefore, t-SNE is mostly used for visualizing clusters in the data.

The same “spatial relationship characteristic” can also be achieved using autoencoders. The dimension of the latent representation of an autoencoder is significantly lower than the dimension of the input data. Therefore, we can use that latent representation to make visualizations of high-dimensional data in a lower-dimensional space.

When the quality of the latent representation increases, we get accurate visualizations in the lower dimensional space. The quality of the autoencoder latent representation depends on factors like the number of hidden layers, and the number of nodes in each layer. Generally, these things define the structure of the autoencoder architecture.

By using an appropriate architecture, we can achieve the same “spatial relationship characteristic” with autoencoders as in t-SNE!

The following plot shows the lower-dimensional representation of MNIST data achieved using t-SNE.

(Image by author)

It is clear that data points are separated as clusters according to their class labels. The nearby data points of the same class in the original dimension will still be nearby in the lower dimension!

Now, we will use the following autoencoder with only two hidden layers to visualize MNIST data in a lower-dimensional form.

(Image by author)

This autoencoder architecture is capable of distinguishing between the nine clusters to some extent, but not perfectly as in t-SNE. The cluster separation is not good enough.

(Image by author)

After we increase the number of hidden layers and nodes in the autoencoder architecture as in the following figure, the cluster separation becomes very clear!

(Image by author)

The separation of clusters is very clear now as in t-SNE!

(Image by author)

This is the end of today’s article.

Please let me know if you’ve any questions or feedback.

Other dimensionality reduction methods you might be interested in

Read next (Recommended)

How about an AI course?

Support me as a writer

I hope you enjoyed reading this article. If you’d like to support me as a writer, kindly consider signing up for a membership to get unlimited access to Medium. It only costs $5 per month and I will receive a portion of your membership fee.

Join my private list of emails

Never miss a great story from me again. By subscribing to my email list, you will directly receive my stories as soon as I publish them.

Thank you so much for your continuous support! See you in the next article. Happy learning to everyone!

Designed and written by: Rukshan Pramoditha

2023–06–30

Data Science
Machine Learning
Dimensionality Reduction
Artificial Intelligence
Neural Networks
Recommended from ReadMedium