{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances #-}

-- | The confusion matrix contains four data points: the true and false
-- positives and the true and false negatives. From these four data points,
-- other statistics can be extracted.
--
-- Fawcett, ROC Graphs: Notes and Practical Considerations for Researchers,
-- 2004, Kluwer Academic Publishers

module Statistics.ConfusionMatrix where



-- | The confusion matrix.

data ConfusionMatrix = ConfusionMatrix
  { fn :: WrappedDouble
  , fp :: WrappedDouble
  , tn :: WrappedDouble
  , tp :: WrappedDouble
  } deriving (Read,Show,Eq)

type WrappedDouble = Either String Double

-- | Given a certain data-set, create a confusion matrix.

class MkConfusionMatrix a where
  mkConfusionMatrix :: a -> ConfusionMatrix