Created
May 27, 2014 22:47
-
-
Save Davorak/3e33dd82ba31ceed9ee2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# language GeneralizedNewtypeDeriving #-} | |
import Control.DeepSeq | |
import HLearn.Algebra | |
import HLearn.Models.Distributions | |
iBag = [1..5] ++ [1..5] ++ [5..10] | |
newtype IG = IG Int | |
deriving (Read,Show, Num) | |
instance Eq IG where | |
(IG i1) == (IG i2) = i1 `div` 2 == i2 `div` 2 | |
instance Ord IG where | |
(IG i1) <= (IG i2) = i1 `div` 2 <= i2 `div` 2 | |
iDist = train iBag :: Categorical Int Int | |
igDist = train (map IG iBag) :: Categorical Int IG | |
{- | |
- ghci> iDist | |
- Categorical {pdfmap = fromList [(1,2),(2,2),(3,2),(4,2),(5,3),(6,1),(7,1),(8,1),(9,1),(10,1)]} | |
- ghci> igDist | |
- Categorical {pdfmap = fromList [(IG 1,2),(IG 2,4),(IG 4,5),(IG 6,2),(IG 8,2),(IG 10,1)]} | |
- ^ | |
- |> I expected this to be 0(Zero) | |
- (IG 0,2) rather then (IG 1,2) | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment