Train_X must be a float.

3 次查看(过去 30 天)
Rizwan Hassan
Rizwan Hassan 2019-11-11
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 个评论
Rizwan Hassan
Rizwan Hassan 2019-11-19
train_x=training data set
Walter Roberson
Walter Roberson 2019-11-19
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.

请先登录,再进行评论。

回答(1 个)

Puru Kathuria
Puru Kathuria 2020-3-6
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

类别

Help CenterFile Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by