Copyright | (c) Lars Brünjes, 2016 |
---|---|
License | MIT |
Maintainer | brunjlar@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
This module provides utilities for working with statistics.
- data Probability a
- probability :: RealFloat a => a -> Probability a
- fromProbability :: Probability a -> a
- countMeanVar :: forall a. Fractional a => [a] -> (Int, a, a)
- mean :: forall a. Fractional a => [a] -> a
- auc :: Ord a => [(a, Bool)] -> Probability Double
- auc' :: forall a b. (Ord a, Fractional b) => [(a, b, Bool)] -> b
- round' :: Int -> Double -> Double
Documentation
data Probability a Source
A type for representing probabilities.
Functor Probability Source | |
Eq a => Eq (Probability a) Source | |
Num a => Num (Probability a) Source | |
Ord a => Ord (Probability a) Source | |
Read a => Read (Probability a) Source | |
Show a => Show (Probability a) Source | |
NFData a => NFData (Probability a) Source |
probability :: RealFloat a => a -> Probability a Source
Smart constructor for probabilities.
>>>
probability (0.7 :: Double)
Probability {fromProbability = 0.7}
>>>
probability (1.2 :: Double)
Probability {fromProbability = 1.0}
>>>
probability (-0.3 :: Double)
Probability {fromProbability = 0.0}
fromProbability :: Probability a -> a Source
countMeanVar :: forall a. Fractional a => [a] -> (Int, a, a) Source
Returns number of elements, mean and variance of a collection of elements.
>>>
countMeanVar [1, 2, 3, 4 :: Float]
(4,2.5,1.25)
mean :: forall a. Fractional a => [a] -> a Source
Calculates the mean of a collection of elements.
>>>
mean [1 .. 5 :: Float]
3.0
auc :: Ord a => [(a, Bool)] -> Probability Double Source
Calculates the area under the curve.
>>>
auc [(1, False), (2, True), (3, False), (4, True), (5, False), (6, True), (7, True)]
Probability {fromProbability = 0.75}
auc' :: forall a b. (Ord a, Fractional b) => [(a, b, Bool)] -> b Source
Calculates the area under the curve for weighted samples.
>>>
auc' [(1, (1 :: Double), False), (2, 0.5, True), (3, 1, False), (4, 1, True), (5, 1, False), (6, 1, True), (7, 1, True)]
0.8095238095238095