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

Synapse.NN.Layers.Constraints

Description

Allows to constraint values of layers parameters.

ConstraintFn type alias represents functions that are able to constrain the values of matrix and Constraint newtype wraps ConstraintFns.

ConstraintFns should be applied on matrices from the updateParameters function.

Synopsis

ConstraintFn type alias and Constraint newtype

type ConstraintFn a = Mat a -> Mat a Source #

ConstraintFn type alias represents functions that are able to constrain the values of matrix.

newtype Constraint a Source #

Constraint newtype wraps ConstraintFns - functions that are able to constrain the values of matrix.

Constructors

Constraint 

Fields

Value constraints

nonNegative :: (Num a, Ord a) => ConstraintFn a Source #

Ensures that matrix values are non-negative.

clampMin :: Ord a => a -> ConstraintFn a Source #

Ensures that matrix values are more or equal than given value.

clampMax :: Ord a => a -> ConstraintFn a Source #

Ensures that matrix values are less or equal than given value.

clampMinMax :: Ord a => (a, a) -> ConstraintFn a Source #

Ensures that matrix values are clamped between given values.

Matrix-specific constraints

centralize :: Fractional a => a -> ConstraintFn a Source #

Ensures that matrix values are centralized by mean around given value.