GithubHelp home page GithubHelp logo

potfit's Introduction

PotFit

A PyTorch Example of Potential Fitting

Problem

Provide there exists a potential V(x). Given some observations { V(xi), dV/dx(xi) }i=1,...,N, obtain the approximate potential P(x) which satisfies L(V,P) < δ, where

L(V,P) = (1/N) ∑i ( |V(xi)-P(xi)|2 + λ |dV/dx(xi)-dP/dx(xi)|2 ).

δ > 0 and λ > 0, and they are given constants.

Potentail

The values at N=100 random points are shown as solid cricles.

Models

This code uses the neural networks as follows:

z0 = σ( x Win ),

zl = σ( zl-1 Wl )   (l=1,...,L),

P(x) = zL Wout + bout,

where σ(x) = SSP(x) = Softplus(x) - Softplus(0). Win, Wl, and Wout are the 1xH, HxH, and Hx1 matrices, respectively.

The default setting: L=5 and H=500.

Enviroment

  • Python 3.7
  • PyTorch 1.0.0.dev20181107

How to run

python potfit.py --num_epochs 20000

This code uses λ = 1/25.

You will eventually get outputs like as follows:

epoch 19995 lr 0.0003774 mse0 0.00228 mse1 2.07881 loss 0.08543
epoch 19996 lr 0.0003774 mse0 0.00557 mse1 2.85378 loss 0.11972
epoch 19997 lr 0.0003774 mse0 0.00285 mse1 4.02198 loss 0.16373
epoch 19998 lr 0.0003774 mse0 0.00476 mse1 4.44875 loss 0.18271
epoch 19999 lr 0.0003774 mse0 0.01051 mse1 2.68157 loss 0.11777
Best score: 0.007930990790831857

loss = mse0 + λ mse1.

You can plot predictions of the best model as the following:

python plot_predictions.py best

Predicted Potentail

Potential History

References

Deep Neural Networks

Shiyu Liang and R. Srikant, "Why Deep Neural Networks for Function Approximation?", ICLR 2017 link

Softplus

Vinod Nair and Geoffrey E. Hinton, "Rectified Linear Units Improve Restricted Boltzmann Machines", ICML 2010 link

Shifted Softplus (SSP)

Kristof T. Schütt, Huziel E. Sauceda, Pieter-Jan Kindermans, Alexandre Tkatchenko, and Klaus-Robert Müller, "SchNet - a deep learning architecture for molecules and materials", J. Chem. Phys. 148, 241722 (2018) link

License

Apache License 2.0

potfit's People

Contributors

tony-y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

guanshaoheng

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.