Simple denoising autoencoder for 1D data

14 visualizaciones (últimos 30 días)
vikakise vikakise
vikakise vikakise el 29 de Ag. de 2017
Comentada: Georgios Papageorgiou el 19 de Oct. de 2019
I'm trying to set up a simple denoising autoencoder with Matlab for 1D data. As currently there is no specialised input layer for 1D data the imageInputLayer() function has to be used:
function net = DenoisingAutoencoder(data)
[N, n] = size(data);
%setting up input
X = zeros([n 1 1 N]);
for i = 1:n
for j = 1:N
X(i, 1, 1, j) = data(j,i);
end
end
% noisy X : 1/10th of elements are set to 0
Xnoisy = X;
mask1 = (mod(randi(10, size(X)), 7) ~= 0);
Xnoisy = Xnoisy .* mask1;
layers = [imageInputLayer([n 1 1]) fullyConnectedLayer(n) regressionLayer()];
opts = trainingOptions('sgdm');
net = trainNetwork(X, Xnoisy, layers, opts);
However, the code fails with this error message:
The output size [1 1 n] of the last layer doesn't match the response size [ n 1 1].
Any thoughts on how should the input / layers should be reconfigured? If the fullyConnectedLayer is left out then the code runs fine, but obviously then I'm left without the hidden layer.
  1 comentario
Georgios Papageorgiou
Georgios Papageorgiou el 19 de Oct. de 2019
I assume N is the number of data and n is you data_size. I think if you make:
  1. X 1xnx1xN
  2. The input layer: imageInputLayer([1 n])
  3. X_noisy of dimension Nxn and finally,
  4. net = trainNetwork(Xnoisy, X, layers, opts);
it should work. Make sure at the end that your inpout of your Denoising Autoencoder is the noisy data and the desired output is your "clean" data. A similar version that I implemented in MATLAB works fine for me and the dimensions match usign the regressionLayer like this.

Iniciar sesión para comentar.

Respuestas (0)

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