Train_X must be a float.
3 views (last 30 days)
Show older comments
May anybody help me to train my autoencoder for training dataset.
My training dataset is of size 10000*3072.But I want to let my model to train for its subset of different sizes like 1000*700, 1500*1000, 784,100 etc
but for every dataset sometimes it generates error: train_x must be float or train_x must be an integer.
here is the error.
here is the code
function demo_SAE
load('data_batch_1.mat');
train_x=(data(1:1200,1:1200));
rand('state',0)
sae = saesetup([784 100]);
sae.ae{1}.activation_function = 'sigm';
sae.ae{1}.learningRate = 1;
sae.ae{1}.inputZeroMaskedFraction = 0.0;
opts.numepochs = 10;
opts.batchsize = 100;
sae = saetrain(sae, train_x, opts);
visualize(sae.ae{1}.W{1}(:,2:end)')
3 Comments
Walter Roberson
on 19 Nov 2019
Use the GUI to put a breakpoint at the beginning of the line
rand('state',0)
Now execute the code. It will stop before executing the rand() call. Now at the command window, give the command
class(train_x)
and copy and paste the result into a response here.
Answers (1)
Puru Kathuria
on 6 Mar 2020
Hi,
I see that you are not able to train your model because of the data type of your training data. I think the following snippet might solve your issue. Put the following snippet before training and see if it helps.
isItFloat = isfloat(train_x);
if(isItFloat == 0)
train_x = double(train_x);
end
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!