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

Safe HaskellNone

HLearn.Models.Distributions.KernelDensityEstimator

Contents

Description

Kernel Density Estimation (KDE) is a generic and powerful method for estimating a probability distribution. See wikipedia for more information: http://en.wikipedia.org/wiki/Kernel_density_estimation

Synopsis

Parameters

data KDEParams prob Source

Constructors

KDEParams 

Fields

bandwidth :: KDEBandwidth prob
 
samplePoints :: Vector prob

These data points must be sorted from smallest to largest

kernel :: KernelBox prob
 

Instances

(Eq prob, Unbox prob) => Eq (KDEParams prob) 
(Eq (KDEParams prob), Ord prob, Unbox prob) => Ord (KDEParams prob) 
(Show prob, Unbox prob) => Show (KDEParams prob) 
NFData prob => NFData (KDEParams prob) 
HomTrainer (KDEParams Double) Int (KDE Double) 
(Semigroup (KDE prob), Monoid (KDE prob), Model (KDEParams prob) (KDE prob), Eq prob, Fractional prob, Unbox prob) => HomTrainer (KDEParams prob) prob (KDE prob) 
(Eq prob, Num prob, Unbox prob) => Model (KDEParams prob) (KDE prob) 
Morphism (Categorical Int Double) (KDEParams Double) (KDE Double) 

data KDEBandwidth prob Source

The bandwidth is a "free parameter" that has a large influence on the resulting PDF. The simplest way to set the bandwidth is using a constant. However, we can also have a bandwidth that varies over the domain of the distribution. This is done using the Variable constructor. For more, see Wikipedia's entry on Variable KDE: https://en.wikipedia.org/wiki/Variable_kernel_density_estimation.

Constructors

Constant prob 
Variable (prob -> prob) 

Instances

Eq prob => Eq (KDEBandwidth prob) 
(Eq (KDEBandwidth prob), Ord prob) => Ord (KDEBandwidth prob) 
Show prob => Show (KDEBandwidth prob) 
NFData prob => NFData (KDEBandwidth prob) 

Data types

type KDE prob = RegSG2Group (KDE' prob)Source

The data structure that stores our Kernel Density Estimate. Because KDE' doesn't have an empty element, we use the RegSG2Group free structure to provide one for us. KDE inherits all the instances of KDE', plus Monoid and Group instances.

data KDE' prob Source

This is an intermediate data structure used by the KDE data type. You should NEVER use it directly because it doesn't have an empty element. It is exported because some other modules in the HLearn library need direct access to it.

Constructors

KDE' 

Fields

params :: KDEParams prob
 
n :: prob
 
sampleVals :: Vector prob
 

Instances

(Num prob, Unbox prob) => LeftOperator prob (KDE' prob) 
(Num prob, Unbox prob) => RightOperator prob (KDE' prob) 
(Eq prob, Unbox prob) => Eq (KDE' prob) 
(Eq (KDE' prob), Ord prob, Unbox prob) => Ord (KDE' prob) 
(Show prob, Unbox prob) => Show (KDE' prob) 
(Eq prob, Num prob, Unbox prob) => Semigroup (KDE' prob) 
(Semigroup (KDE' prob), Eq prob, Num prob, Unbox prob) => RegularSemigroup (KDE' prob) 
NFData prob => NFData (KDE' prob) 
PlottableDistribution (KDE Double) 
(Ord prob, Fractional prob, Unbox prob) => Distribution (KDE prob) prob prob 
HomTrainer (KDEParams Double) Int (KDE Double) 
(Semigroup (KDE prob), Monoid (KDE prob), Model (KDEParams prob) (KDE prob), Eq prob, Fractional prob, Unbox prob) => HomTrainer (KDEParams prob) prob (KDE prob) 
(Eq prob, Num prob, Unbox prob) => Model (KDEParams prob) (KDE prob) 
Morphism (Categorical Int Double) (KDEParams Double) (KDE Double) 

Easy creation of parameters

genSamplePoints :: (Fractional prob, Unbox prob) => Int -> Int -> Int -> Vector probSource

Generates a vector of the positions to sample our distribution at to generate the PDF. It is intended for use with KDEParams only.