1

I want to implement Gaussian RBM.For that i want to make zero mean and unit variance of data.my data is MNIST dataset.The dataset has been taken and followed from the following link.

Visit http://www.cs.toronto.edu/~hinton/code/makebatches.m

so i implemented in below way.But my data become NAN.It becomes NAN after dividing the data with standard deviation.

for epoch = epoch:maxepoch,
fprintf(1,'epoch %d \r',epoch); 
errsum=0;
for batch = 1:numbatches,
fprintf(1,'epoch %d batch %d \r',epoch,batch); 

%START POSITIVE PHASE

data = batchdata(:,:,batch);

% zero mean and unit variance

data_mean = mean(data,1);
data=bsxfun(@minus,data,data_mean);
data_std = std(data1,[],1);
data=bsxfun(@rdivide,data,data_std);

I tried this with small set of examples.It works well.What will be the reason to become NAN.

How to get rid of this and make Gaussian input with zero mean and unit variance.

prakash
  • 125
  • 6

2 Answers2

1

I would recommend normalizing the mean and variance of your data before starting the GBRBM training. This would you'd be able to check the batchdata variable manually in MATLAB workspace. While training a GBRBM, I often see NaN as the training/validation error when my learning rate is too high. It should help to set the learning rate below or equal to 0.001.

muneeb
  • 142
  • 13
0

You appear to be using an undefined variable "data1" in your "data_std = ..." code as opposed to "data".

A.R.Ferguson
  • 133
  • 7