Giter Club home page Giter Club logo

cat-ad's Introduction

Project Plan

First Milestone

  • implement required module signature
  • implement a vanilla implementation
  • represent a formula using functor
  • evaluate the formula using ocaml category

Second Milestone

  • replace additive type with float
    • in order to deal with generic zero object issue
    • I choose not to have parameterized type and use float only
      • 0.0 is zero object
  • implement the forward AAD version

Airport Milestone

  • airport_typeclass: compare haskell type class vs ocaml modular
  • haskell foundation: type class/type family
  • basic Haskell type class trick
  • concat implementation on Additive constraints
  • hacking solution to introduce additive

X Milestone

  • represent linear map as generalized matrices
  • represent linear map as continuation of linear map
  • RAD implementation

Helper function

  • linear map: scale (d x r)
  • scalarD
scalarD f d = D (\x -> let r = f x in (r, scale (d x r)))
  • scalarR f d = scalarD f (const d)
    • const :: a -> b -> a
    • d :: (s -> s)
    • target :: s -> (s -> s)
    • const :: (s -> s) -> s -> (s -> s)
    • const d :: s -> (s -> s)
    • (const d) x r = d r $$ \frac{d(\frac{1}{x})}{dx} = -(\frac{1}{x})^2 $$
  • scalarX f d = scalarD f (const . d)
    • const :: a -> b -> a
    • (.) :: (b -> c) -> (a -> b) -> (a -> c)
    • d :: s -> s
    • (.) :: (s -> (s -> s)) -> (s -> s) -> (s -> (s -> s))
    • const :: s -> (s -> s)
    • (const . d) :: s -> (s -> s)
    • (const . d) x r = ((const . d) x) r = (const (d x)) r = d x

$$ \frac{d(cos(x))}{x} = - sin(x) $$

$$ \begin{aligned} d(a/b) &= \frac{a'b -ab'}{b^2}\\ D_(x * y) (a, b) (da, db) &= a\times db + b \times da \\ D_(x * \frac{1}{y}) (a, \frac{1}{b}) (da, d(\frac{1}{b})) &= a \times d(\frac{1}{b}) + \frac{1}{b} \times da\\ & = - a \times db \frac{1}{b^2} + \frac{da\times b}{b^2} \\ & = \frac{da\times b - db\times a}{b^2} \end{aligned} $$

  • chain rule $$ D(f . g) (a) = Df(g(a)). Dg(a) $$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.