Skip to content

dirmeier/clad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clad

Project Status Build status

Reverse-mode autodiff for Clojure

Introduction

This package implements a proof-of-concept of reverse-mode autodiff in Clojure. It is mainly thought for learning Clojure, hence it offers minimal functionality, lacks (code) quality, and is probably buggy.

(require '[clad.core :refer [grad]])

(defn f [x y]
  (/ (- 1.0 (Math/exp (- x)))
     (+ 1.0 (Math/exp (- y)))))
     
(def g ((grad f 0) 2.0 1.0))

g
=> 0.0989

Author

Simon Dirmeier sfyrbnd @ pm me