neural-0.3.0.0: Neural Networks in native Haskell

Copyright(c) Lars Brünjes, 2016
LicenseMIT
Maintainerbrunjlar@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • ScopedTypeVariables
  • BangPatterns
  • DeriveFunctor
  • GeneralizedNewtypeDeriving
  • ExplicitForAll

Data.Utils.Statistics

Description

This module provides utilities for working with statistics.

Synopsis

Documentation

data Probability a Source #

A type for representing probabilities.

Instances

Functor Probability Source # 

Methods

fmap :: (a -> b) -> Probability a -> Probability b #

(<$) :: a -> Probability b -> Probability a #

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 # 

Methods

rnf :: Probability a -> () #

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 #

the wrapped number

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

round' :: Int -> Double -> Double Source #

Rounds a Double to the specified number of decimals.

>>> round' 3 (2/3)
0.667