MATLAB Answers

Error in trainAutoencoder function

34 views (last 30 days)
Hello,
when trying to train an autoencoder, no matter the input data, I get the following error:
Unable to resolve the name
Autoencoder.parseInputArguments.
Error in trainAutoencoder (line 107)
paramsStruct =
Autoencoder.parseInputArguments(varargin{:});
I've tried running the example found in here, which should work just fine, but I get the aforementioned error, plus a line indicating
Error in filename (line 21)
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1,'MaxEpochs',400,'L2WeightRegularization',0.004,'SparsityRegularization',4,'SparsityProportion',0.15,'ScaleData',
false);
From what I understand, the error is inside the trainAutoencoder function, in the paramsStruct = Autoencoder.parseInputArguments(varargin{:}) line
if nargin > 1
[varargin{:}] = convertStringsToChars(varargin{:});
end
paramsStruct = Autoencoder.parseInputArguments(varargin{:});
autonet = Autoencoder.createNetwork(paramsStruct);
autoenc = Autoencoder.train(X, autonet, paramsStruct.UseGPU);
end
I've tried looking up the error online, but to no avail. If it's something obvious I just can't see what it is. I have the needed toolboxes installed, and I get this error in the 2019 and 2020 versions of MatLab.
If anyone could help me out, I would be extremely grateful

  4 Comments

Show 1 older comment
Álvaro Pequeño Alonso
Álvaro Pequeño Alonso on 27 Mar 2020 at 7:58
Hi Devineni Aslesha thanks for answering
Here's my code, it's just the example mentioned:
clear all
close all
% Load the training data into memory
[xTrainImages,tTrain] = digitTrainCellArrayData;
% Display some of the training images
clf
for i = 1:20
subplot(4,5,i);
imshow(xTrainImages{i});
end
rng('default');
hiddenSize1 = 100;
autoenc1 = trainAutoencoder(xTrainImages,hiddenSize1,'MaxEpochs',400,'L2WeightRegularization',0.004,'SparsityRegularization',4,'SparsityProportion',0.15,'ScaleData', false);
view(autoenc1)
I'm not surprised you couldn't replicate it, I've tried asking my peers about it and nobody seems to be able to get the same error
Devineni Aslesha
Devineni Aslesha on 30 Mar 2020 at 14:37
I would suggest you to make sure to have the digitTrainCellArrayData.m file in the given path 'C:\Program Files\MATLAB\R2019a\toolbox\nnet\nndemos\nndatasets\digitTrainCellArrayData.m'. Also, try doing clear all before the code execution.
For more information, refer the following link.
Álvaro Pequeño Alonso
Álvaro Pequeño Alonso on 1 Apr 2020 at 20:20
Thanks Devineni Aslesha, I got the idea that solved the problem from your comment

Sign in to comment.

Accepted Answer

Álvaro Pequeño Alonso
Álvaro Pequeño Alonso on 1 Apr 2020 at 20:18
Updating the post with the solution
Putting the path where the function .m file is at the top of the list, resolves the problem. I don't know why, but there it is
Home/Set Path, search for the path, and press Move to Top
To identify where the function is (the path) use "which 'function name' "

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.