neural-0.1.1.0: Neural Networks in native Haskell

Copyright(c) Lars Brünjes, 2016
LicenseMIT
Maintainer[email protected]
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
ExtensionsGeneralizedNewtypeDeriving

Data.Utils.Analytic

Description

This module defines the numeric type Analytic, which has "built in differentiation".

Synopsis

Documentation

data Analytic Source

The numeric type Analytic is a wrapper around Edward Kmett's Kahn Double type. Using functions from Analytics to Analytics, we automatically get numerically exact gradients. An number of type Analytic is conceptionally a Double together with an infinitesimal component.

fromDouble :: Double -> Analytic Source

Converts a Double to an Analytic without infinitesimal component.

fromAnalytic :: Analytic -> Maybe Double Source

Tries to convert an Analytic to a Double. This conversion will work if the Analytic has no infinitesimal component.

gradient Source

Arguments

:: Traversable t 
=> (Double -> Double -> a)

how to combine argument and gradient

-> (t Analytic -> Analytic)

analytic function

-> t Double

function argument

-> (Double, t a)

function value and combination of argument and gradient

Computes the gradient of an analytic function and combines it with the argument.

>>> gradient (\_ d -> d) (\[x, y] -> x * x + 3 * y + 7) [2, 1]
(14.0,[4.0,3.0])