RBM procedure using pytorch test on MNIST datasets
odie2630463 / restricted-boltzmann-machines-in-pytorch Goto Github PK
View Code? Open in Web Editor NEWRBM in Pytorch
RBM in Pytorch
RBM procedure using pytorch test on MNIST datasets
Hi,
Thank you for your nice codes and it works quite well on MNIST reconstruction!
However, I do notice a very interesting phenomena: Although the training seems to be successful and the visualization of reconstruction looks good, the loss is increasing during training. But it seems that the optimizer in pytorch should always lower the training loss. I am very curious about the reason, and would you please explain why?
I also print the L1loss between the original images and the reconstructed images, and the L1loss is decreasing as expected.
Best regards,
Wang
Hello~
Thank you very much for sharing the code, which really helps me a lot.
But I find some problem when I use the code in
RBM.ipynb
def free_energy(self,v):
vbias_term = v.mv(self.v_bias)
wx_b = F.linear(v,self.W,self.h_bias)
hidden_term = wx_b.exp().add(1).log().sum(1)
return (-hidden_term - vbias_term).mean()
I found that there may be numerical instability in free_energy. In hidden_term = wx_b.exp().add(1).log().sum(1)
, if wx_b
contains elements that greater than or equal to 88, the result of wx_b.exp() is inf. And this may cause the result of loss to become NAN.
It could be fixed by making the following change:
hidden_term = wx_b.exp().clamp(max=87).add(1).log().sum(1)
Hope to hear from you ~
Thanks in advance! : )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.