C-SGHMC
=======================
This is a repository created as part of a statistical computation project at Duke University.
The code to be found here is a C++ implementation of SGHMC algorithm wrapped for Python using pybind11. It is further used to verify the results in the original paper on SGHMC: "Stochastic Gradient Hamiltonian Monte Carlo" by Tianqi Chen, Emily B. Fox and Carlos Guestrin.
As seen from our project this is a **15-time-efficiency-improvement** in terms of runtime over the pure python version.
Main files
=======================
- **sghmcwrap.cpp** is the original sghmc algo in C++ wrapped for Python
- **c_sghmc.py** calls and decorates the above extension and tests on an example from the original paper
Packages required to run the code
=======================
- The implementation makes use of **Eigen** library for C++ and hence run the following line:
! git clone https://github.com/RLovelett/eigen.git
Make sure you have it cloned in the same directory as your code.
- **pybind11** and **cppimport** are the two standard packages required for wrapping C++ codes for Python and importing them:
! pip3 install pybind11
! pip3 install cppimport
The example makes use of **sympy** to specify functions (such as potential and kinetic energies as well as the gradient of the former), **numpy** and **numpy.random**.
=======================
This is a repository created as part of a statistical computation project at Duke University.
The code to be found here is a C++ implementation of SGHMC algorithm wrapped for Python using pybind11. It is further used to verify the results in the original paper on SGHMC: "Stochastic Gradient Hamiltonian Monte Carlo" by Tianqi Chen, Emily B. Fox and Carlos Guestrin.
As seen from our project this is a **15-time-efficiency-improvement** in terms of runtime over the pure python version.
Main files
=======================
- **sghmcwrap.cpp** is the original sghmc algo in C++ wrapped for Python
- **c_sghmc.py** calls and decorates the above extension and tests on an example from the original paper
Packages required to run the code
=======================
- The implementation makes use of **Eigen** library for C++ and hence run the following line:
! git clone https://github.com/RLovelett/eigen.git
Make sure you have it cloned in the same directory as your code.
- **pybind11** and **cppimport** are the two standard packages required for wrapping C++ codes for Python and importing them:
! pip3 install pybind11
! pip3 install cppimport
The example makes use of **sympy** to specify functions (such as potential and kinetic energies as well as the gradient of the former), **numpy** and **numpy.random**.
Metadata
Release files for c-sghmc 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| c_sghmc-0.0.2.tar.gz | 3.0 kB | Details |
Release files / c_sghmc-0.0.2.tar.gz
| Download URL | c_sghmc-0.0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8afa9be6b3329be360ffa339d14f3d0997cc0c23996355f2a6d0d465acb26a9b
|
|
BLAKE2b-256 checksum How to use checksums |
6fa79f60e3a0e7d7b08ae2b57673a47514673c6ea34c3f58909d8f1a29383508
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |