Giter VIP home page Giter VIP logo

restricted-boltzmann-machines-in-pytorch's Introduction

restricted-boltzmann-machines-in-pytorch's People

Contributors

odie2630463 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

restricted-boltzmann-machines-in-pytorch's Issues

Loss value is increasing but reconstruction is fine

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

numerical instability in free_energy

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! : )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.