pyADiff: A simple, pure python algorithmic differentiation package
pyADiff is a (yet) very basic algorithmic differentiation package, which implements forward and adjoint/reverse mode differentiation. If you are looking for a fully-featured and faster library, have a look at google/jax, autograd or dco/c++ (or many more), but if you are interested in a package where you are able to quickly "look under the hood", you may be right here.
Motivation
My motivation to start this project arose from curiosity while listening to the lecture "Computational Differentiation" by Prof. Naumann at RWTH Aachen University. So basically I tried to understand the concepts from the lecture by implementing them by myself. In the end I was (positively) surprised with the outcome and decided to bundle it in a python package. Additionaly this gave me the chance to learn about python packaging, distributing, documentation, ...
Basic Usage
Suppose we want to compute the gradient of the function
f(x₀, x₁) = 2 x₀ x₁².
This is a rather trivial task, because by simple calculus, the gradient is:
∇f(x₀, x₁) = (2 x₁², 4 x₀ x₁)
Nevertheless we use this example illustrate the use of pyADiff.
import pyADiff as ad
# define the function f
def f(x):
return 2.*x[0]*x[1]**2.
# call the gradient function of pyADiff
df = ad.gradient(f)
x = [0.5, 2.0]
# Call the function f and the gradient function df
y = f(x)
dy = df(x)
print("f({}) = {}".format(x, y)) # prints f([0.5, 2.0]) = 4.0
print("f'({}) = {}".format(x, dy)) # prints f'([0.5, 2.0]) = [8. 4.]
Which corresponds to the evaluation of the analytic gradient.
∇f(0.5, 2) = (2*2², 4*0.5*2) = (8, 4)
For more sophisticated examples see the Documentation or have a look at the .ipynb notebooks
Installation
Installation using pip
TODO
Installation from source
This will clone the repository and install the pyADiff package using the setup.py script.
> git clone https://github.com/tam724/pyADiff
> python pyADiff/setup.py install
Documentation
Availiable on readthedocs.org
References
Algorithmic Differentiation:
- Uwe Naumann, Lecture Computational Differentiation, RWTH Aachen
Metadata
Release files for pyADiff 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| pyADiff-0.1.1.tar.gz | 20.5 kB | Without provenance | Details for pyADiff-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyADiff-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyADiff-0.1.1-py3-none-any.whl |
Total release size: 42.2 kB
Release files / pyADiff-0.1.1.tar.gz
| Download URL | pyADiff-0.1.1.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc79b6fc0377c1d83f011597414ea458cddf31fdf3c630f34d1370c568ecf2ac
|
|
BLAKE2b-256 checksum How to use checksums |
5bcf4eb683213297a5f9898f51545164ca903890f653d9da8453851533b91a34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.5
|
Release files / pyADiff-0.1.1-py3-none-any.whl
| Download URL | pyADiff-0.1.1-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3e4410ac39d730d90456d558fc1bbf0ae5f8937252e454e1f7cbea5f5305e29
|
|
BLAKE2b-256 checksum How to use checksums |
952354253770a38463b36fd4f03730cbbf6c85d3a6e186c73aa349286ddba6d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.5
|
Security for pyADiff 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.