55 RealVector zeroH(rbm.numberOfHN(),0.0);
56 RealVector zeroV(rbm.numberOfVN(),0.0);
57 double logPartition = rbm.visibleNeurons().logMarginalize(zeroV,0.0);
58 logPartition += rbm.hiddenNeurons().logMarginalize(zeroH,0.0);
62 typedef typename RBMType::HiddenType::StateSpace::EnumerationTag HiddenTag;
63 typedef typename RBMType::VisibleType::StateSpace::EnumerationTag VisibleTag;
65 return detail::logPartitionFunction(rbm,VisibleTag(),HiddenTag(),beta);
120 RealMatrix
const& energyDiffUp,
121 RealMatrix
const& energyDiffDown,
124 std::size_t chains = energyDiffUp.size1();
125 std::size_t samples = energyDiffUp.size2();
129 deltaF = soft_max(-sum(as_columns(energyDiffUp)))-std::log(
double(samples));
132 for(std::size_t i = chains-1; i != 0; --i){
133 deltaF += soft_max(-row(energyDiffUp,i))-std::log(
double(samples));
137 for(std::size_t i = chains-1; i != 0; --i){
138 deltaF += detail::twoSidedAIS(row(energyDiffUp,i),row(energyDiffDown,i-1));
142 for(std::size_t i = chains-1; i != 0; --i){
143 deltaF += detail::acceptanceRatio(row(energyDiffUp,i),row(energyDiffDown,i-1));
147 deltaF = detail::acceptanceRatio(sum(as_columns(energyDiffUp)),sum(as_columns(energyDiffDown)));
156 RealVector
const& beta, std::size_t samples,
158 float burnInPercentage =0.1
160 std::size_t chains = beta.size();
161 RealMatrix energyDiffUp(chains,samples);
162 RealMatrix energyDiffDown(chains,samples);
163 detail::sampleEnergies(rbm,initDataset,beta,energyDiffUp,energyDiffDown,burnInPercentage);
166 energyDiffUp,energyDiffDown,algorithm
172 RBMType& rbm,RealVector
const& beta, std::size_t samples
174 std::size_t chains = beta.size();
175 RealMatrix energyDiffTempering(chains,samples,0.0);
176 detail::sampleEnergiesWithTempering(rbm,beta,energyDiffTempering);
178 return soft_max(-sum(as_columns(energyDiffTempering)))-std::log(
double(samples));
184 std::size_t chains, std::size_t samples,
186 float burnInPercentage =0.1
188 RealVector beta(chains);
189 for(std::size_t i = 0; i != chains; ++i){
190 beta(i) = 1.0-i/double(chains-1);