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

Safe HaskellNone

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

data Categorical sampletype prob Source

Constructors

Categorical !(Map sampletype prob) 

Instances

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

Helper functions

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

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

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

Extracts the element in the distribution with the highest probability