README.md

jar

Project
Status R build
status Codecov test
coverage

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 without being very mature or computationally performant.

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)
## [1] -1
grad(logpdf, 2L)(1.0, 0.0, 1.0)
## [1] 1
grad(logpdf, 3L)(1.0, 0.0, 1.0)
## [1] 0

Installation

Get the package using:

devtools::install_github("dirmeier/jar")

Author



dirmeier/jar documentation built on Dec. 20, 2021, 12:03 a.m.