HLearn-distributions-1.1.0.2: Distributions for use with the HLearn library

Safe Haskell None

HLearn.Models.Distributions.Univariate.Categorical

Contents

Description

The categorical distribution is used for discrete data. It is also sometimes called the discrete distribution or the multinomial distribution. For more, see the wikipedia entry: https://en.wikipedia.org/wiki/Categorical_distribution

Synopsis

# Data types

newtype Categorical prob label Source

Constructors

 Categorical (Map label prob)

Instances

 (Num prob, Ord prob) => Monad (Categorical prob) Functor (Categorical prob) (Eq prob, Eq label) => Eq (Categorical prob label) (Ord prob, Ord label) => Ord (Categorical prob label) (Ord label, Read prob, Read label) => Read (Categorical prob label) (Show prob, Show label) => Show (Categorical prob label) (Ord label, Num prob) => Monoid (Categorical prob label) Num prob => NumDP (Categorical prob label) (Ord label, Num prob) => HomTrainer (Categorical prob label) Num prob => HasRing (Categorical prob label) (Ord label, Num prob) => Module (Categorical prob label) (Ord label, Num prob) => Abelian (Categorical prob label) (Ord label, Num prob) => Group (Categorical prob label) (NFData label, NFData prob) => NFData (Categorical prob label) (Num prob, Ord prob, Ord label) => Mean (Categorical prob label) (Ord label, Ord prob, Fractional prob) => PDF (Categorical prob label) (Ord label, Ord prob, Fractional prob) => CDF (Categorical prob label) Probabilistic (Categorical prob label) (Ord label, Show label, Ord prob, Show prob, Fractional prob) => PlottableDistribution (Categorical prob label)

# Helper functions

dist2list :: Categorical prob label -> [(label, prob)]Source

Converts a distribution into a list of (sample,probability) pai

mostLikely :: Ord prob => Categorical prob label -> labelSource

Extracts the element in the distribution with the highest probability