HLearn-algebra-0.1.2.0: Algebraic foundation for homomorphic learning

Safe HaskellNone

HLearn.Algebra.Models

Contents

Description

The HomTrainer class forms the base of the HLearn library. It represents homomorphisms from a free monoid/group to any other structure. This captures our intuitive notion of how data mining and machine learning algorithms should behave, but in a way that allows for the easy creation of parallel and online algorithms.

Unfortunately, we must slightly complicate the matter by also introducing the Model class. Many learning algorithms take some sort of parameters, and we need the model class to define what those parameters should look like.

Synopsis

Parameters

class Model modelparams model | modelparams -> model, model -> modelparams whereSource

Every model has at least one data type that that fully describes its parameters. Many models do not actually *need* any parameters, in which case they will simply use an empty data type for modelparams.

Methods

getparams :: model -> modelparamsSource

class Model modelparams model => DefaultModel modelparams model | model -> modelparams whereSource

For those algorithms that do not require parameters (or that have reasonable default parameters), this class lets us use a more convenient calling notation.

Methods

defparams :: modelparamsSource

HomTrainer

class (Semigroup model, Monoid model, Model modelparams model) => HomTrainer modelparams datapoint model | model -> modelparams datapoint whereSource

A minimal complete definition of the class is the singleton trainer 'train1dp\''

Methods

train1dp' :: modelparams -> datapoint -> modelSource

The singleton trainer

train' :: (Functor container, FunctorConstraint container model, FunctorConstraint container datapoint, Foldable container, FoldableConstraint container model) => modelparams -> container datapoint -> modelSource

The batch trainer

add1dp :: model -> datapoint -> modelSource

The online trainer

addBatch :: (Functor container, FunctorConstraint container model, FunctorConstraint container datapoint, Foldable container, FoldableConstraint container model) => model -> container datapoint -> modelSource

The batch online trainer; will be more efficient than simply calling add1dp for each element being added

class (DefaultModel modelparams model, HomTrainer modelparams datapoint model) => DefaultHomTrainer modelparams datapoint model | model -> modelparams whereSource

Provides parameterless functions for those training algorithms that do not require parameters

Methods

train1dp :: datapoint -> modelSource

A singleton trainer that doesn't require parameters (uses defparams)

train :: (Functor container, FunctorConstraint container model, FunctorConstraint container datapoint, Foldable container, FoldableConstraint container model) => container datapoint -> modelSource

A batch trainer that doesn't require parameters (uses defparams)

Instances

(DefaultModel modelparams model, HomTrainer modelparams datapoint model) => DefaultHomTrainer modelparams datapoint model 

Convenience functions

sub1dp :: (RegularSemigroup model, HomTrainer modelparams datapoint model, DefaultModel modelparams model) => model -> datapoint -> modelSource

subBatch :: (Functor container, FunctorConstraint container model, FunctorConstraint container datapoint, Foldable container, FoldableConstraint container model, RegularSemigroup model, HomTrainer modelparams datapoint model, DefaultModel modelparams model) => model -> container datapoint -> modelSource

Type synonyms