Skip to main content

An automatic differentiation package

Project description

Welcome to PyADBCXY

build codecov

PyADBCXY is an automatic differentiation software package that can calculate the values and derivatives of complex functions while maintaining high levels of accuracy.

Contributors

Group Name: cs107-BCXY
Group Number: 12
Group Members:

Installation

Install the package with pip:

pip install pyadbcxy

Then you can run a simple example such as

import pyadbcxy as ad
x = ad.Variable(3)            # instantiate x variable
y = ad.Variable(4., 5.)       # instantiate y variable
f = lambda x, y: x + y        # define function of interest
fmode = ad.Forward(f, (x, y)) # instantiate forward mode
fmode.calculate()             # evaluate function at x and y
print(fmode.value)            # print value of f at x and y
print(fmode.derivative)       # print derivative of f and x and y

For further details on package usage as well as the math behind it, please see the documentation.

For developers

To install the package for further development, clone the repository to your machine:

git clone https://github.com/cs107-BCXY/cs107-FinalProject.git

Then, move into the repository and install the package dependencies

cd cs107-FinalProject
pip install -r requirements.txt

Testing

To run the tests, you can execute

python -m unittest discover -s tests -p 'test_*.py'

Alternatively, you can run the test driver script. The default testing framework is unittest and can be run with:

bash tests/run_tests.sh

If you'd like to execute the tests using pytest, simply specify in the command:

bash tests/run_tests.sh pytest

Finally, if you'd like to see the code coverage report, you can do so with the coverage keyword:

bash tests/run_tests.sh coverage

License

This project is licensed under the MIT License - see the LICENSE for more details.

Broader Impact and Inclusivity Statement

We strove to create a convenient way to automatically differentiate smoothly and accurately. The automatic differentiation package is able to efficiently compute the derivatives of functions of any numerical inputs granted they are mathematically valid in the constraints of functions, including integers, floats, single and multiple variables. Traditionally in finite differentiation, users need to select an epsilon value for the algorithm that calculates the difference of slope. The choice of epsilon will impact the accuracy of the derivative especially since computationally the rounding error may be a specific problem. Our package eliminates this process for users by adopting autodifferentation method.

While automatic differentiation is proven to be powerful in calculating accurate derivatives, such function does not prevail in common machine learning packages. In neural networks and regression based models, gradient descent is widely used to find the optimal parameters. Automatic differentiation assists this process so that any differentiation, even when the algebraic form is hard to compute, can be done easily. This broadens the range of models one can choose from without concerning the complexity of their derivatives. If used responsibly, the benefit of a wider range of models and increasing accuracy can be broadcast to many fields including public health and medicine, where models are rather complicated.

We strongly believe in the importance of inclusivity of our package. We worked to ensure that our package is accessible to all and is licensed as such. We ensured proper documentation and simple and straightforward usage instruction that is easy to follow. The creation of this package was conducted through teamwork where every member was respected and represented, and contributed to the outcome. The coding process was discussed among members of the team as well as researched online through open source.

Our purpose in this development was to at once enrichment or own understanding of the mathematical and programming grounds of a commonly used and powerful tool as well as provide a basis for others to refer to and build upon. We discourage any illegal and unethical use of our package in projects that harm a particular group based on attributes including (but not limited to) age, culture, ethnicity, gender identity or expression, national origin, physical or mental difference, politics, race, religion, sex, sexual orientation, socio-economic status, and subculture.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyadbcxy-0.0.6.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyadbcxy-0.0.6-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file pyadbcxy-0.0.6.tar.gz.

File metadata

  • Download URL: pyadbcxy-0.0.6.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pyadbcxy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 92e6d63e6cbf3b77171f76b0a73d7ec80b484c7d046e8117c6d08160125e7e8a
MD5 f70226f922c7d2ed3e9c1ff4f9760ce9
BLAKE2b-256 534b47b371ae2075af1a6b7504d8835e1c8797e107e16f8f9b4aa64eefbb26d8

See more details on using hashes here.

File details

Details for the file pyadbcxy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyadbcxy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pyadbcxy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 32dfaadc2a94f86f163c6ea850582fd6fb2f9e72c47c66249ca83f5270c0acf8
MD5 82aef2640bd5d395b46016a160e1cc41
BLAKE2b-256 215d1af2e4404e309cbc7986fa75c79b32a6769aea413c2774fd1ca20f86068f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page