NeuroDiffGym / neurodiffeq

A library for solving differential equations using neural networks based on PyTorch, used by multiple research groups around the world, including at Harvard IACS.
http://pypi.org/project/neurodiffeq/
MIT License
680 stars 89 forks source link

unable to train correct result (gives incorrect answers even when everything is set correct) #145

Closed Liza23 closed 2 years ago

Liza23 commented 2 years ago

I've been trying to solve some ordinary differential equation (in one variable) but each time I run the model, I get different results -- sometime exactly as expected and other times entirely opposite to what is expected. How can this be reliable in such a case?

The training & validation error is usually pretty low and hence doesn't add to model misbehaving.

shuheng-liu commented 2 years ago

Hi Liza, usually, there's randomness involved when network weights are initialized. Try manually setting the random see for torch and numpy will guarantee reproducible results.

If you're worried about the model being susceptible to random seeding, can you share your code so I can know which ODE you're solving and what hyperparameters you are using?