Unable to get toy rbnFit example to work with a really really simple MOG case

41 views
Skip to first unread message

Isaac Gerg

unread,
Dec 2, 2011, 3:53:05 PM12/2/11
to MATRBM-group
I am trying to get the rbmFit to work on a mixture of Gaussian case
where the variance of each mixture is very small. The means are 0.1,
0.2, and 0.3. I cant figure out why the classifier doesnt work
correctly.

Can anyone provide guidance? Below is the code. Thanks in advance.
~Isaac

N = 100;
numClasses = 3;
means = [.10 .20 .30];
class = round(mod(randperm(N),numClasses))+1;
data = zeros(N,1);
figure; hold on;
cmap = jet(numClasses)
for k=1:N
data(k) = means(class(k));
plot(data(k), 'x','Color', cmap(class(k),:));
end
hold off; grid on; title('Input data with class coloring');

numHidden = [10];
for kk=1:length(numHidden)
for k=1:1
trainingSet = randperm(N); trainingSet =
trainingSet(1:round(0.5*N));
testSet = setxor(trainingSet,1:N);
m=rbmFit(data,numHidden(kk),class,'verbose',true,'maxepoch',
100, 'nclasses', numClasses, 'eta',0.01,'method','SML');
visualize(m.W);
yhat=rbmPredict(m,data);

% op.verbose=true;
% op.maxepoch = 1000;
% models=dbnFit(data,[10 10],class,op,op);
% yhat=dbnPredict(models,data);

e = abs(yhat - class.');

%m=rbmFit(data(trainingSet),numHidden(kk),class(trainingSet),'verbose',true,'maxepoch',
100);
%yhat=rbmPredict(m,data(testSet));
%e = abs(yhat - class(testSet).');
err(k) = sum(abs(e)>0)/length(e);
end
resultsMeanErr(kk) = mean(err);
resultsStdErr(kk) = std(err);
end

figure; plot(resultsMeanErr);

Isaac Gerg

unread,
Dec 8, 2011, 2:36:49 PM12/8/11
to MATRBM-group
I found the solution to my problem. You cannot fed this RBM
continuous input. It must be binary. Verified this by rewriting the
code.

So this brings up another question: where can i find a good continuous
RBM code?

Thanks in advance,
Isaac

Andrej

unread,
Dec 8, 2011, 5:02:25 PM12/8/11
to matrbm...@googlegroups.com
Hey, yes its only for binary data, I mention that on top in comments.

try looking through deeplearning.net or pages of Geoff Hinton or Yoshua Bengio

Isaac Gerg

unread,
Dec 9, 2011, 4:32:38 PM12/9/11
to matrbm...@googlegroups.com
To be clear, the code says you can use binary or probabilistic inputs.  
Reply all
Reply to author
Forward
0 new messages