https://github.com/dirmeier/jar
Reverse-mode autodiff for R
https://github.com/dirmeier/jar
autodiff autograd r
Last synced: 2 months ago
JSON representation
Reverse-mode autodiff for R
- Host: GitHub
- URL: https://github.com/dirmeier/jar
- Owner: dirmeier
- License: gpl-3.0
- Created: 2021-09-22T15:24:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-27T19:54:47.000Z (about 4 years ago)
- Last Synced: 2025-03-08T10:59:14.872Z (7 months ago)
- Topics: autodiff, autograd, r
- Language: R
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---# jar
[](http://www.repostatus.org/#concept)
[](https://github.com/dirmeier/jar/actions)
[](https://codecov.io/gh/dirmeier/jar?branch=master)> Reverse-mode autodiff for R
## Introduction
This package implements a proof-of-concept of reverse-mode autodiff for R functions. The package is motivated and influenced by [`jax`](https://github.com/google/jax) without being very mature or computationally performant.
```{r}
library(jar)logpdf <- function(y, mu, sigma) {
-0.5 * ((y - mu) / sigma) ^ 2 - log(sigma) - 0.5 * log(2*pi)
}grad(logpdf, 1L)(1.0, 0.0, 1.0)
grad(logpdf, 2L)(1.0, 0.0, 1.0)
grad(logpdf, 3L)(1.0, 0.0, 1.0)
```## Installation
Get the package using:
```{r, eval=FALSE}
devtools::install_github("dirmeier/jar")
```## Author
* Simon Dirmeier simon.dirmeier @ web.de