T1=denoise_snr010_zcorrect_hunhe_fam_starformingburstagn_qso(1:9000, :); % the spectra data used for dimensionality reduction
h=1000 % the dimension of the hidden vector
data1=T1; % the spectra data used for dimensionality reduction
data2=T1; % the spectra data used for dimensionality reduction

rbm1=rbm_train(data1,500,h);

vishid=rbm1.W;
hidbiases=rbm1.hidbiases;
W=rbm1.W;
visbiases=rbm1.visbiases;
totnum=size(data2,1);
recons=rbm1.negadata;
rbm.hiddata= 1./(1 + exp(-data2*vishid - repmat(hidbiases,totnum,1))); % rbm.hiddata is the low dimensional projection of the spectra data
rbm.rec=1./(1 + exp(-rbm2.hiddata*vishid' - repmat(visbiases,totnum,1))); %the reconstruction of the spectra