neural-0.3.0.0: Neural Networks in native Haskell

Copyright(c) Lars Brünjes, 2016
LicenseMIT
Maintainerbrunjlar@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances
  • RankNTypes
  • ExplicitForAll

Data.Utils.Analytic

Description

This module defines the numeric class Analytic, "differentiable" functions Diff f g and an adapted version of gradWith'.

Synopsis

Documentation

class (Floating a, Ord a) => Analytic a where Source #

Class Analytic is a helper class for defining differentiable functions.

Minimal complete definition

fromDouble

Methods

fromDouble :: Double -> a Source #

newtype Diff f g Source #

Type Diff f g can be thought of as the type of "differentiable" functions f Double -> g Double.

Constructors

Diff 

Fields

Instances

Category (* -> *) Diff Source # 

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat a c #

type Diff' = forall a. Analytic a => a -> a Source #

Type Diff' can be thought of as the type of differentiable functions Double -> Double.

diff :: Functor f => Diff' -> Diff f f Source #

Lifts a differentiable function by pointwise application.

gradWith' Source #

Arguments

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

how to combine argument and gradient

-> Diff t Identity

differentiable 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.

>>> gradWith' (\_ d -> d) (Diff $ \[x, y] -> Identity $ x * x + 3 * y + 7) [2, 1]
(14.0,[4.0,3.0])