How to visualize the data after the features extraction / dimension reduction using autoencoders

6 views (last 30 days)
I've done the aitoencoder model but a visualization of the data after autoencoder would provide a better explanation in my opinion.The problem is that I do not know how to create a visualization figure like the one shown below.
The figure here is obtained from the article I refered to while doing the autoencoder model for feature extraction / dimension reduction.

Answers (1)

Hari on 2 Jan 2024
Edited: Hari on 2 Jan 2024
Hi Ng Yong Jie,
I understand that you are inquiring about direct functions in MATLAB that are specifically designed to plot the features extracted by an autoencoder.
I am assuming you are using Neural Network Toolbox which includes functions for creating and working with autoencoders.
Neural Network Toolbox does provide a function called "plotWeights" which can be used to visualize the weights of an autoencoder. However, for visualizing the features extracted by the autoencoder (i.e., the activations of the hidden layer), you would typically extract the features manually and then use standard MATLAB plotting functions. Here's an example using the "encode" function to extract features and "tsne" to reduce the dimensionality for visualization:
% Assuming 'autoenc' is your trained autoencoder and 'x' is your input data
encodedData = encode(autoenc, x);
% Now using t-SNE to reduce the data to 2 dimensions for visualization
encoded2D = tsne(encodedData');
% Plotting the 2D data
scatter(encoded2D(:,1), encoded2D(:,2));
title('2D Visualization of Encoded Data');
xlabel('Dimension 1');
ylabel('Dimension 2');
For visualizing weights of an autoencoder, you can refer to the documentation of the "plotWeights" function.
To visualize the encoded data, you can refer to the documentation for the "encode" function for extracting features from an autoencoder.
For dimensionality reduction and visualization, consult the documentation on the "tsne" function.
Hope this helps!


Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!