synapse-0.1.0.0: Synapse is a machine learning library written in pure Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Synapse.NN.Layers.Activations

Description

Provides activation functions - unary functions that are differentiable almost everywhere and so they can be used in backward loss propagation.

Synopsis

ActivationFn type alias and Activation newtype

type ActivationFn a = SymbolMat a -> SymbolMat a Source #

ActivationFn is a type alias that represents unary functions that differentiable almost everywhere.

activateScalar :: Symbolic a => ActivationFn a -> a -> a Source #

Applies activation function to a scalar to produce new scalar.

activateMat :: Symbolic a => ActivationFn a -> Mat a -> Mat a Source #

Applies activation function to a scalar to produce new scalar.

newtype Activation a Source #

Activation newtype wraps ActivationFns - unary functions that can be thought of as activation functions for neural network layers.

Any activation function must be differentiable almost everywhere and so it must be function that operates on Symbols, which is allows for function to be differentiated when needed.

Constructors

Activation 

Fields

layerActivation :: Activation a -> LayerConfiguration (Activation a) Source #

Creates configuration for activation layer.

Activation functions

relu :: (Symbolic a, Fractional a) => ActivationFn a Source #

ReLU function.

sigmoid :: (Symbolic a, Floating a) => ActivationFn a Source #

Sigmoid function.