pzivich / Delicatessen

Delicatessen: the Python one-stop sandwich (variance) shop 🥪
https://deli.readthedocs.io/en/latest/index.html
MIT License
22 stars 2 forks source link

Add functionality to compute the gradient for the bread matrix #23

Closed pzivich closed 1 year ago

pzivich commented 1 year ago

Is your feature request related to a problem? Please describe. Not related to a problem.

Describe the solution you'd like Add internal functions in delicatessen.utilities for computing the derivatives. Ideally, I would support both the central difference method (approximations) and forward mode automatic differentiation (exact).

Describe alternatives you've considered Right now, we rely on scipy approx_fprime to compute the derivatives. This is fine but it restricted the versions I supported in the v1 release. In the future, I would like to avoid having to update based on functionalities of other libraries. I want to use the minimal amount of outside functionalities. Right now, the derivative piece is the main part.

The automatic differentation would be a nice feature as it gives the exact derivatives rather than an approximation.

Additional context I have working implementations of central difference and automatic differentiation written. I need to verify them further and ensure they work as intended. Plan would be to add at v2 release.

pzivich commented 1 year ago

In case I need to consider backwards-mode

https://towardsdatascience.com/build-your-own-automatic-differentiation-program-6ecd585eec2a