|Maintainer||Alexey Khudyakov <email@example.com>|
Type classes for binning algorithms. This is mapping from set of interest to integer indices and approximate reverse.
- class Bin b where
- binsCenters :: (Bin b, Vector v (BinValue b)) => b -> v (BinValue b)
- class Bin b => IntervalBin b where
- class IntervalBin b => Bin1D b where
- sliceBin :: Bin1D b => Int -> Int -> b -> b
- class Bin b => VariableBin b where
- class VariableBin b => UniformBin b where
- class Bin1D b => GrowBin b where
- class (Bin b, Bin b') => ConvertBin b b' where
- convertBin :: b -> b'
Bin type class
This type represent some abstract data binning algorithms. It maps sets/intervals of values of type 'BinValue b' to integer indices.
Following invariant is expected to hold:
toIndex . fromIndex == id
Convert from value to index. Function must not fail for any input and should produce out of range indices for invalid input.
Convert from index to value. Returned value should correspond to center of bin. Definition of center is left for definition of instance. Funtion may fail for invalid indices but encouraged not to do so.
Total number of bins.
Check whether value in range. Have default implementation. Should satisfy: inRange b x ⇔ toIndex b x ∈ [0,nBins b)
Return vector of bin centers
For binning algorithms which work with bin values which have some natural ordering and every bin is continous interval.
Interval for n'th bin
List of all bins. Could be overridden for efficiency.
IntervalBin which domain is single finite interval
Minimal accepted value of histogram
Maximal accepted value of histogram
Slice bin by indices. This function doesn't perform any checks and may produce invalid bin
1D binning algorithms with variable bin size
1D binning algorithms with constant size bins. Constant sized bins could be thought as specialization of variable-sized bins therefore a superclass constraint.
Binning algorithm which allows to append and prepend bins.
Set number of bins to zero. By convention bins are shrinked to lower bound.
Append one bin at upper bound
Prepend one bin at lower bin
Class for conversion between binning algorithms.
|ConvertBin BinI BinD|
|ConvertBin BinInt BinD|
|RealFrac f => ConvertBin BinI (BinF f)|
|RealFrac f => ConvertBin BinInt (BinF f)|
|(ConvertBin bx bx', ConvertBin by by') => ConvertBin (Bin2D bx by) (Bin2D bx' by')|
|(ConvertBin by by', Bin bx) => ConvertBin (Bin2D bx by) (Bin2D bx by')|
|(ConvertBin bx bx', Bin by) => ConvertBin (Bin2D bx by) (Bin2D bx' by)|