How to train dataset after dimension reduced with autoencoder into a support vector machine?

2 visualizaciones (últimos 30 días)
I am doing a anomaly detection by using stacked autoencoder and one-class svm. The stacked autoencoder is done. The problem is I am unsure of how to use the dimension reduced data after the autoencoder to be trained in the one-class svm?
Here's the code for the stacked autoencoder:
train1 = fullfile(dataFolder, "train_FD001.txt");
[train_data1, train_labels1] = importdata(train1)
% To avoid results from training are different each time
% Explicitly set the random number generator seed
rng('default')
% Specifying the values for the regularizers for the training
%autoenc1 = trainAutoencoder(train_data1,hiddenSize1, ...
autoenc1 = trainAutoencoder(train_data1,100,'MaxEpochs',400,'L2WeightRegularization',1.0, ...
'DecoderTransferFunction','purelin','UseGPU',true)
% Visualize the first autoencoder
view(autoenc1)
% Train the next autoencoder on a set of these vectors extracted from the training data.
% First, you must use the encoder from the trained autoencoder to generate the features.
feat1 = encode(autoenc1,train_data1)
% Specifying the values for the regularizers for the training
autoenc2 = trainAutoencoder(feat1,10,'MaxEpochs',400,...
'DecoderTransferFunction','purelin','UseGPU',true)
% Visualize the second autoencoder
view(autoenc2)
% Train the next autoencoder on a set of these vectors extracted from the training data.
% First, you must use the encoder from the trained autoencoder to generate the features.
feat2 = encode(autoenc2,feat1)
% Specifying the values for the regularizers for the training
autoenc3 = trainAutoencoder(feat2,1,'MaxEpochs',400,...
'DecoderTransferFunction','purelin','UseGPU',true)
% Visualize the third autoencoder
view(autoenc3)
% Train the next autoencoder on a set of these vectors extracted from the training data.
% First, you must use the encoder from the trained autoencoder to generate the features.
feat3 = encode(autoenc3,feat2)
%% Training the final softmax layer
% Train a softmax layer to classify the 50-dimensional feature vectors.
% Unlike the autoencoders, you train the softmax layer in a supervised fashion using labels for the training data.
softnet = trainSoftmaxLayer(feat3,train_data1,'MaxEpochs',400)
% Vizualize the diagram of the softmax layer
view(softnet)
%% Forming a stacked neural network
stackednet = stack(autoenc1,autoenc2,autoenc3,softnet)
% Vizualize the stacked autoencoder
view(stackednet)

Respuestas (1)

yanqi liu
yanqi liu el 8 de Feb. de 2022
yes,sir,may be use the encoder net to get data low dimension vector as feature,reshape them to feature matrix and label vector,then train it in new svm model
  8 comentarios
yanqi liu
yanqi liu el 9 de Feb. de 2022
yes,sir,may be use feat3 as input,of course,its dimension reduce,may be consider use feat1、feat2

Iniciar sesión para comentar.

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by