Is there any working implementation of reverse mode automatic differentiation for Haskell?

前端 未结 4 968
醉话见心
醉话见心 2021-02-13 12:28

The closest-related implementation in Haskell I have seen is the forward mode at http://hackage.haskell.org/packages/archive/fad/1.0/doc/html/Numeric-FAD.html.

The close

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-13 12:52

    I think forward is the way to go in Haskell. You shouldn't be able to do reverse mode on arbitrary functions, as Edward pointed out. But you responded that you should be able to do it on certain constrained functions. And said constraints can lead readily to forward mode. Eg. if you have a function:

    foo :: Num a => a -> a -> a
    

    Then you can instantiate a with a differentiable type, and thus differentiate foo in forward mode.

    See the vector-space library on Hackage for very elegant forward mode automatic differentiation. It might not be entirely clear how to use it at first. Read the paper about it, Beautiful Differentiation by Conal Elliott.

提交回复
热议问题