Stability | experimental |
---|---|
Maintainer | Alexey Khudyakov <alexey.skladnoy@gmail.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
- lowerLimit :: b -> BinValue b
- upperLimit :: b -> BinValue b
- unsafeSliceBin :: Int -> Int -> b -> b
- 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
- zeroBin :: b -> b
- appendBin :: b -> b
- prependBin :: b -> b
- 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
toIndex :: b -> BinValue b -> IntSource
Convert from value to index. Function must not fail for any input and should produce out of range indices for invalid input.
fromIndex :: b -> Int -> BinValue bSource
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.
inRange :: b -> BinValue b -> BoolSource
Check whether value in range. Have default implementation. Should satisfy: inRange b x ⇔ toIndex b x ∈ [0,nBins b)
binsCenters :: (Bin b, Vector v (BinValue b)) => b -> v (BinValue b)Source
Return vector of bin centers
1D bins
class Bin b => IntervalBin b whereSource
For binning algorithms which work with bin values which have some natural ordering and every bin is continous interval.
binInterval :: b -> Int -> (BinValue b, BinValue b)Source
Interval for n'th bin
binsList :: Vector v (BinValue b, BinValue b) => b -> v (BinValue b, BinValue b)Source
List of all bins. Could be overridden for efficiency.
IntervalBin BinI | |
IntervalBin BinInt | |
IntervalBin BinD | |
IntervalBin LogBinD | |
Enum a => IntervalBin (BinEnum a) | |
RealFrac f => IntervalBin (BinF f) | |
IntervalBin b => IntervalBin (BinPermute b) |
class IntervalBin b => Bin1D b whereSource
IntervalBin
which domain is single finite interval
lowerLimit :: b -> BinValue bSource
Minimal accepted value of histogram
upperLimit :: b -> BinValue bSource
Maximal accepted value of histogram
unsafeSliceBin :: Int -> Int -> b -> bSource
Slice bin by indices. This function doesn't perform any checks and may produce invalid bin
class Bin b => VariableBin b whereSource
1D binning algorithms with variable bin size
VariableBin BinI | |
VariableBin BinInt | |
VariableBin BinD | |
VariableBin LogBinD | |
RealFrac f => VariableBin (BinF f) | |
VariableBin b => VariableBin (BinPermute b) |
class VariableBin b => UniformBin b whereSource
1D binning algorithms with constant size bins. Constant sized bins could be thought as specialization of variable-sized bins therefore a superclass constraint.
UniformBin BinI | |
UniformBin BinInt | |
UniformBin BinD | |
RealFrac f => UniformBin (BinF f) | |
UniformBin b => UniformBin (BinPermute b) |
class Bin1D b => GrowBin b whereSource
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
prependBin :: b -> bSource
Prepend one bin at lower bin
Conversion
class (Bin b, Bin b') => ConvertBin b b' whereSource
Class for conversion between binning algorithms.
convertBin :: b -> b'Source
Convert bins
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) |