hbayes 0.5 → 0.5.2
raw patch · 9 files changed
+376/−152 lines, 9 filesdep +hbayesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: hbayes
Dependency ranges changed: base
API changes (from Hackage documentation)
- Bayes: instance (Eq a, Eq b) => Eq (SimpleGraph DE a b)
- Bayes: instance (Show b, Show e) => Show (UndirectedSG e b)
- Bayes: instance Arbitrary (DirectedSG () String)
- Bayes: instance Arbitrary (DirectedSG String String)
- Bayes: instance DirectedGraph DirectedSG
- Bayes: instance Factor f => Arbitrary (DirectedSG () f)
- Bayes: instance FactorContainer (SimpleGraph local edge)
- Bayes: instance Foldable (SimpleGraph local edge)
- Bayes: instance FoldableWithVertex (SimpleGraph local)
- Bayes: instance Functor (SimpleGraph local edge)
- Bayes: instance FunctorWithVertex (SimpleGraph local)
- Bayes: instance Graph DirectedSG
- Bayes: instance Graph UndirectedSG
- Bayes: instance Monad (GraphMonad g e f)
- Bayes: instance MonadState (GMState g e f) (GraphMonad g e f)
- Bayes: instance NamedGraph DirectedSG
- Bayes: instance NamedGraph UndirectedSG
- Bayes: instance NeighborhoodStructure DE
- Bayes: instance NeighborhoodStructure UE
- Bayes: instance Show (DirectedSG () CPT)
- Bayes: instance Show (DirectedSG () MAXCPT)
- Bayes: instance Show (DirectedSG String String)
- Bayes: instance Traversable (SimpleGraph local edge)
- Bayes: instance UndirectedGraph UndirectedSG
- Bayes.BayesianNetwork: instance Eq LE
- Bayes.BayesianNetwork: instance Instantiable d v DVI => Testable d v
- Bayes.Continuous: instance BayesianVariable DN
- Bayes.Continuous: instance Fractional DN
- Bayes.Continuous: instance Fractional RN
- Bayes.Continuous: instance Instantiable DN Double CVI
- Bayes.Continuous: instance Monoid (DistributionSupport (Double, Double))
- Bayes.Continuous: instance Num DN
- Bayes.Continuous: instance Num RN
- Bayes.Continuous: instance VariableName ()
- Bayes.Continuous: instance VariableName String
- Bayes.Examples.Influence: instance Bounded E
- Bayes.Examples.Influence: instance Bounded EF
- Bayes.Examples.Influence: instance Bounded F
- Bayes.Examples.Influence: instance Bounded I
- Bayes.Examples.Influence: instance Bounded IN
- Bayes.Examples.Influence: instance Bounded S
- Bayes.Examples.Influence: instance Enum E
- Bayes.Examples.Influence: instance Enum EF
- Bayes.Examples.Influence: instance Enum F
- Bayes.Examples.Influence: instance Enum I
- Bayes.Examples.Influence: instance Enum IN
- Bayes.Examples.Influence: instance Enum S
- Bayes.Examples.Influence: instance Eq E
- Bayes.Examples.Influence: instance Eq EF
- Bayes.Examples.Influence: instance Eq F
- Bayes.Examples.Influence: instance Eq I
- Bayes.Examples.Influence: instance Eq IN
- Bayes.Examples.Influence: instance Eq S
- Bayes.Examples.Tutorial: instance Bounded Coma
- Bayes.Examples.Tutorial: instance Enum Coma
- Bayes.Examples.Tutorial: instance Eq Coma
- Bayes.Factor: instance FactorContainer []
- Bayes.Factor: instance LabeledVertex DV
- Bayes.Factor: instance LabeledVertex DVI
- Bayes.Factor: instance Real a => Distribution [a]
- Bayes.Factor: vertexId :: Vertex -> Int
- Bayes.Factor.CPT: instance Arbitrary CPT
- Bayes.Factor.CPT: instance Factor CPT
- Bayes.Factor.CPT: instance FactorElement Double
- Bayes.Factor.CPT: instance IsBucketItem CPT
- Bayes.Factor.CPT: instance MultiDimTable CPT
- Bayes.Factor.CPT: instance Show CPT
- Bayes.Factor.MaxCPT: instance Factor MAXCPT
- Bayes.Factor.MaxCPT: instance FactorElement (Double, PossibleInstantiations)
- Bayes.Factor.MaxCPT: instance IsBucketItem MAXCPT
- Bayes.Factor.MaxCPT: instance MultiDimTable MAXCPT
- Bayes.Factor.MaxCPT: instance Show MAXCPT
- Bayes.FactorElimination: instance Eq VertexCluster
- Bayes.FactorElimination: instance Ord VertexCluster
- Bayes.FactorElimination: instance Show VertexCluster
- Bayes.ImportExport: instance (Binary l, Binary e, Binary v) => Binary (SimpleGraph l e v)
- Bayes.ImportExport: instance (Ord c, Binary c, Binary f) => Binary (JTree c f)
- Bayes.ImportExport: instance Binary (Vector Double)
- Bayes.ImportExport: instance Binary (v Double) => Binary (PrivateCPT v Double)
- Bayes.ImportExport: instance Binary Cluster
- Bayes.ImportExport: instance Binary DE
- Bayes.ImportExport: instance Binary DV
- Bayes.ImportExport: instance Binary Edge
- Bayes.ImportExport: instance Binary UE
- Bayes.ImportExport: instance Binary Vertex
- Bayes.ImportExport: instance Binary a => Binary (NodeValue a)
- Bayes.ImportExport: instance Binary a => Binary (SeparatorValue a)
- Bayes.ImportExport.HuginNet: instance Eq Section
- Bayes.ImportExport.HuginNet: instance Show Section
- Bayes.InfluenceDiagram: instance BayesianDiscreteVariable DEV
- Bayes.InfluenceDiagram: instance BayesianDiscreteVariable PorD
- Bayes.InfluenceDiagram: instance BayesianVariable DEV
- Bayes.InfluenceDiagram: instance BayesianVariable PorD
- Bayes.InfluenceDiagram: instance ChanceVariable (TDV s)
- Bayes.InfluenceDiagram: instance ChanceVariable DV
- Bayes.InfluenceDiagram: instance Eq ChancesOrDecision
- Bayes.InfluenceDiagram: instance Eq DEV
- Bayes.InfluenceDiagram: instance Eq EdgeKind
- Bayes.InfluenceDiagram: instance Eq IDValue
- Bayes.InfluenceDiagram: instance Eq JoinSum
- Bayes.InfluenceDiagram: instance Eq PorD
- Bayes.InfluenceDiagram: instance Eq UV
- Bayes.InfluenceDiagram: instance Initializable (TDV s)
- Bayes.InfluenceDiagram: instance Initializable DEV
- Bayes.InfluenceDiagram: instance Initializable DV
- Bayes.InfluenceDiagram: instance Initializable UV
- Bayes.InfluenceDiagram: instance Instantiable DEV Int DVI
- Bayes.InfluenceDiagram: instance IsBucketItem JoinSum
- Bayes.InfluenceDiagram: instance Monoid EdgeKind
- Bayes.InfluenceDiagram: instance MultiDimTable DecisionFactor
- Bayes.InfluenceDiagram: instance Ord ChancesOrDecision
- Bayes.InfluenceDiagram: instance Ord DEV
- Bayes.InfluenceDiagram: instance Show ChancesOrDecision
- Bayes.InfluenceDiagram: instance Show DEV
- Bayes.InfluenceDiagram: instance Show DecisionFactor
- Bayes.InfluenceDiagram: instance Show EdgeKind
- Bayes.InfluenceDiagram: instance Show IDValue
- Bayes.InfluenceDiagram: instance Show InfluenceDiagram
- Bayes.InfluenceDiagram: instance Show JoinSum
- Bayes.Sampling: instance Graph g => Show (Sample g CVI)
- Bayes.Sampling: instance Graph g => Show (Sample g [(Double, Double, Double)])
- Bayes.Sampling: instance Graph g => Show (Sample g [DVI])
- Bayes.Sampling: instance SampleGeneration CV CVI (Double, Double) Double
- Bayes.Sampling: instance SampleGeneration DV DVI DV Int
- Bayes.Sampling: instance SamplingBounds (Double, Double) Double
- Bayes.Sampling: instance SamplingBounds DV Int
- Bayes.VariableElimination.Buckets: instance Show f => Show (Buckets f)
+ Bayes: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Bayes.PrivateTypes.SimpleGraph Bayes.PrivateTypes.DE a b)
+ Bayes: instance (GHC.Show.Show b, GHC.Show.Show e) => GHC.Show.Show (Bayes.UndirectedSG e b)
+ Bayes: instance Bayes.DirectedGraph Bayes.DirectedSG
+ Bayes: instance Bayes.Factor.Factor f => Test.QuickCheck.Arbitrary.Arbitrary (Bayes.DirectedSG () f)
+ Bayes: instance Bayes.Factor.FactorContainer (Bayes.PrivateTypes.SimpleGraph local edge)
+ Bayes: instance Bayes.FoldableWithVertex (Bayes.PrivateTypes.SimpleGraph local)
+ Bayes: instance Bayes.FunctorWithVertex (Bayes.PrivateTypes.SimpleGraph local)
+ Bayes: instance Bayes.Graph Bayes.DirectedSG
+ Bayes: instance Bayes.Graph Bayes.UndirectedSG
+ Bayes: instance Bayes.NamedGraph Bayes.DirectedSG
+ Bayes: instance Bayes.NamedGraph Bayes.UndirectedSG
+ Bayes: instance Bayes.NeighborhoodStructure Bayes.PrivateTypes.DE
+ Bayes: instance Bayes.NeighborhoodStructure Bayes.PrivateTypes.UE
+ Bayes: instance Bayes.UndirectedGraph Bayes.UndirectedSG
+ Bayes: instance Control.Monad.State.Class.MonadState (Bayes.GMState g e f) (Bayes.GraphMonad g e f)
+ Bayes: instance Data.Foldable.Foldable (Bayes.PrivateTypes.SimpleGraph local edge)
+ Bayes: instance Data.Traversable.Traversable (Bayes.PrivateTypes.SimpleGraph local edge)
+ Bayes: instance GHC.Base.Applicative (Bayes.GraphMonad g e f)
+ Bayes: instance GHC.Base.Functor (Bayes.GraphMonad g e f)
+ Bayes: instance GHC.Base.Functor (Bayes.PrivateTypes.SimpleGraph local edge)
+ Bayes: instance GHC.Base.Monad (Bayes.GraphMonad g e f)
+ Bayes: instance GHC.Show.Show (Bayes.DirectedSG () Bayes.Factor.PrivateCPT.CPT)
+ Bayes: instance GHC.Show.Show (Bayes.DirectedSG () Bayes.Factor.PrivateCPT.MAXCPT)
+ Bayes: instance GHC.Show.Show (Bayes.DirectedSG GHC.Base.String GHC.Base.String)
+ Bayes: instance Test.QuickCheck.Arbitrary.Arbitrary (Bayes.DirectedSG () GHC.Base.String)
+ Bayes: instance Test.QuickCheck.Arbitrary.Arbitrary (Bayes.DirectedSG GHC.Base.String GHC.Base.String)
+ Bayes.BayesianNetwork: instance Bayes.PrivateTypes.Instantiable d v Bayes.PrivateTypes.DVI => Bayes.BayesianNetwork.Testable d v
+ Bayes.BayesianNetwork: instance GHC.Classes.Eq Bayes.BayesianNetwork.LE
+ Bayes.Continuous: gammaD :: VariableName s => s -> DN -> DN -> CNMonad DN
+ Bayes.Continuous: instance Bayes.Continuous.VariableName ()
+ Bayes.Continuous: instance Bayes.Continuous.VariableName GHC.Base.String
+ Bayes.Continuous: instance Bayes.PrivateTypes.BayesianVariable Bayes.Continuous.DN
+ Bayes.Continuous: instance Bayes.PrivateTypes.Instantiable Bayes.Continuous.DN GHC.Types.Double Bayes.PrivateTypes.CVI
+ Bayes.Continuous: instance GHC.Base.Monoid (Bayes.PrivateTypes.DistributionSupport (GHC.Types.Double, GHC.Types.Double))
+ Bayes.Continuous: instance GHC.Float.Floating Bayes.Continuous.DN
+ Bayes.Continuous: instance GHC.Float.Floating Bayes.Continuous.RN
+ Bayes.Continuous: instance GHC.Num.Num Bayes.Continuous.DN
+ Bayes.Continuous: instance GHC.Num.Num Bayes.Continuous.RN
+ Bayes.Continuous: instance GHC.Real.Fractional Bayes.Continuous.DN
+ Bayes.Continuous: instance GHC.Real.Fractional Bayes.Continuous.RN
+ Bayes.Examples.ContinuousSampling: complexsamples :: IO ()
+ Bayes.Examples.ContinuousSampling: writesamples :: FilePath -> IO ()
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.E
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.EF
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.F
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.I
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.IN
+ Bayes.Examples.Influence: instance GHC.Classes.Eq Bayes.Examples.Influence.S
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.E
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.EF
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.F
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.I
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.IN
+ Bayes.Examples.Influence: instance GHC.Enum.Bounded Bayes.Examples.Influence.S
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.E
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.EF
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.F
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.I
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.IN
+ Bayes.Examples.Influence: instance GHC.Enum.Enum Bayes.Examples.Influence.S
+ Bayes.Examples.Tutorial: instance GHC.Classes.Eq Bayes.Examples.Tutorial.Coma
+ Bayes.Examples.Tutorial: instance GHC.Enum.Bounded Bayes.Examples.Tutorial.Coma
+ Bayes.Examples.Tutorial: instance GHC.Enum.Enum Bayes.Examples.Tutorial.Coma
+ Bayes.Factor: [vertexId] :: Vertex -> Int
+ Bayes.Factor: instance Bayes.Factor.FactorContainer []
+ Bayes.Factor: instance Bayes.Factor.LabeledVertex Bayes.PrivateTypes.DV
+ Bayes.Factor: instance Bayes.Factor.LabeledVertex Bayes.PrivateTypes.DVI
+ Bayes.Factor: instance GHC.Real.Real a => Bayes.Factor.Distribution [a]
+ Bayes.Factor.CPT: instance Bayes.Factor.Factor Bayes.Factor.PrivateCPT.CPT
+ Bayes.Factor.CPT: instance Bayes.Factor.MultiDimTable Bayes.Factor.PrivateCPT.CPT
+ Bayes.Factor.CPT: instance Bayes.Factor.PrivateCPT.FactorElement GHC.Types.Double
+ Bayes.Factor.CPT: instance Bayes.VariableElimination.Buckets.IsBucketItem Bayes.Factor.PrivateCPT.CPT
+ Bayes.Factor.CPT: instance GHC.Show.Show Bayes.Factor.PrivateCPT.CPT
+ Bayes.Factor.CPT: instance Test.QuickCheck.Arbitrary.Arbitrary Bayes.Factor.PrivateCPT.CPT
+ Bayes.Factor.MaxCPT: instance Bayes.Factor.Factor Bayes.Factor.PrivateCPT.MAXCPT
+ Bayes.Factor.MaxCPT: instance Bayes.Factor.MultiDimTable Bayes.Factor.PrivateCPT.MAXCPT
+ Bayes.Factor.MaxCPT: instance Bayes.Factor.PrivateCPT.FactorElement (GHC.Types.Double, Bayes.Factor.PrivateCPT.PossibleInstantiations)
+ Bayes.Factor.MaxCPT: instance Bayes.VariableElimination.Buckets.IsBucketItem Bayes.Factor.PrivateCPT.MAXCPT
+ Bayes.Factor.MaxCPT: instance GHC.Show.Show Bayes.Factor.PrivateCPT.MAXCPT
+ Bayes.FactorElimination: instance GHC.Classes.Eq Bayes.FactorElimination.VertexCluster
+ Bayes.FactorElimination: instance GHC.Classes.Ord Bayes.FactorElimination.VertexCluster
+ Bayes.FactorElimination: instance GHC.Show.Show Bayes.FactorElimination.VertexCluster
+ Bayes.ImportExport: instance (Data.Binary.Class.Binary l, Data.Binary.Class.Binary e, Data.Binary.Class.Binary v) => Data.Binary.Class.Binary (Bayes.PrivateTypes.SimpleGraph l e v)
+ Bayes.ImportExport: instance (GHC.Classes.Ord c, Data.Binary.Class.Binary c, Data.Binary.Class.Binary f) => Data.Binary.Class.Binary (Bayes.FactorElimination.JTree.JTree c f)
+ Bayes.ImportExport: instance Data.Binary.Class.Binary (Data.Vector.Unboxed.Base.Vector GHC.Types.Double)
+ Bayes.ImportExport: instance Data.Binary.Class.Binary (Data.Vector.Vector GHC.Types.Double)
+ Bayes.ImportExport: instance Data.Binary.Class.Binary (v GHC.Types.Double) => Data.Binary.Class.Binary (Bayes.Factor.PrivateCPT.PrivateCPT v GHC.Types.Double)
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.FactorElimination.JTree.Cluster
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.PrivateTypes.DE
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.PrivateTypes.DV
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.PrivateTypes.Edge
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.PrivateTypes.UE
+ Bayes.ImportExport: instance Data.Binary.Class.Binary Bayes.PrivateTypes.Vertex
+ Bayes.ImportExport: instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Bayes.FactorElimination.JTree.NodeValue a)
+ Bayes.ImportExport: instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Bayes.FactorElimination.JTree.SeparatorValue a)
+ Bayes.ImportExport.HuginNet: instance GHC.Classes.Eq Bayes.ImportExport.HuginNet.Section
+ Bayes.ImportExport.HuginNet: instance GHC.Show.Show Bayes.ImportExport.HuginNet.Section
+ Bayes.InfluenceDiagram: instance Bayes.Factor.MultiDimTable Bayes.Factor.PrivateCPT.DecisionFactor
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.ChanceVariable (Bayes.PrivateTypes.TDV s)
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.ChanceVariable Bayes.PrivateTypes.DV
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.Initializable (Bayes.PrivateTypes.TDV s)
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.Initializable Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.Initializable Bayes.InfluenceDiagram.UV
+ Bayes.InfluenceDiagram: instance Bayes.InfluenceDiagram.Initializable Bayes.PrivateTypes.DV
+ Bayes.InfluenceDiagram: instance Bayes.PrivateTypes.BayesianDiscreteVariable Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance Bayes.PrivateTypes.BayesianDiscreteVariable Bayes.InfluenceDiagram.PorD
+ Bayes.InfluenceDiagram: instance Bayes.PrivateTypes.BayesianVariable Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance Bayes.PrivateTypes.BayesianVariable Bayes.InfluenceDiagram.PorD
+ Bayes.InfluenceDiagram: instance Bayes.PrivateTypes.Instantiable Bayes.InfluenceDiagram.DEV GHC.Types.Int Bayes.PrivateTypes.DVI
+ Bayes.InfluenceDiagram: instance Bayes.VariableElimination.Buckets.IsBucketItem Bayes.InfluenceDiagram.JoinSum
+ Bayes.InfluenceDiagram: instance GHC.Base.Monoid Bayes.InfluenceDiagram.EdgeKind
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.ChancesOrDecision
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.EdgeKind
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.IDValue
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.JoinSum
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.PorD
+ Bayes.InfluenceDiagram: instance GHC.Classes.Eq Bayes.InfluenceDiagram.UV
+ Bayes.InfluenceDiagram: instance GHC.Classes.Ord Bayes.InfluenceDiagram.ChancesOrDecision
+ Bayes.InfluenceDiagram: instance GHC.Classes.Ord Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.Factor.PrivateCPT.DecisionFactor
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.ChancesOrDecision
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.DEV
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.EdgeKind
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.IDValue
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.InfluenceDiagram
+ Bayes.InfluenceDiagram: instance GHC.Show.Show Bayes.InfluenceDiagram.JoinSum
+ Bayes.Sampling: instance Bayes.Graph g => GHC.Show.Show (Bayes.PrivateTypes.Sample g Bayes.PrivateTypes.CVI)
+ Bayes.Sampling: instance Bayes.Graph g => GHC.Show.Show (Bayes.PrivateTypes.Sample g [(GHC.Types.Double, GHC.Types.Double, GHC.Types.Double)])
+ Bayes.Sampling: instance Bayes.Graph g => GHC.Show.Show (Bayes.PrivateTypes.Sample g [Bayes.PrivateTypes.DVI])
+ Bayes.Sampling: instance Bayes.Sampling.SampleGeneration Bayes.PrivateTypes.CV Bayes.PrivateTypes.CVI (GHC.Types.Double, GHC.Types.Double) GHC.Types.Double
+ Bayes.Sampling: instance Bayes.Sampling.SampleGeneration Bayes.PrivateTypes.DV Bayes.PrivateTypes.DVI Bayes.PrivateTypes.DV GHC.Types.Int
+ Bayes.Sampling: instance Bayes.Sampling.SamplingBounds (GHC.Types.Double, GHC.Types.Double) GHC.Types.Double
+ Bayes.Sampling: instance Bayes.Sampling.SamplingBounds Bayes.PrivateTypes.DV GHC.Types.Int
+ Bayes.VariableElimination.Buckets: instance GHC.Show.Show f => GHC.Show.Show (Bayes.VariableElimination.Buckets.Buckets f)
- Bayes.BayesianNetwork: t :: a
+ Bayes.BayesianNetwork: t :: t
- Bayes.Factor.CPT: debugCPT :: (Show (t a), Show a) => PrivateCPT t a -> IO ()
+ Bayes.Factor.CPT: debugCPT :: (Show a, Show (t a)) => PrivateCPT t a -> IO ()
- Bayes.InfluenceDiagram: t :: a
+ Bayes.InfluenceDiagram: t :: t
- Bayes.InfluenceDiagram: utilityNode :: NamedGraph g => String -> IDMonad g UV
+ Bayes.InfluenceDiagram: utilityNode :: (NamedGraph g) => String -> IDMonad g UV
- Bayes.Sampling: D :: !CV -> !DistributionF DirectedSG (Double, Double) CVI -> Distri
+ Bayes.Sampling: D :: !CV -> !(DistributionF DirectedSG (Double, Double) CVI) -> Distri
- Bayes.Sampling: Sampler :: !b -> !GenIO -> IO (Sample g a) -> !GenIO -> SamplerGraph g a -> !SamplingScheme g b a -> Sampler g a
+ Bayes.Sampling: Sampler :: !b -> !(GenIO -> IO (Sample g a)) -> !(GenIO -> SamplerGraph g a) -> !(SamplingScheme g b a) -> Sampler g a
- Bayes.VariableElimination.Buckets: Buckets :: !EliminationOrder DV -> !Map DV [f] -> Buckets f
+ Bayes.VariableElimination.Buckets: Buckets :: !(EliminationOrder DV) -> !(Map DV [f]) -> Buckets f
- Bayes.VariableElimination.Buckets: createBuckets :: IsBucketItem f => [f] -> EliminationOrder DV -> EliminationOrder DV -> Buckets f
+ Bayes.VariableElimination.Buckets: createBuckets :: (IsBucketItem f) => [f] -> EliminationOrder DV -> EliminationOrder DV -> Buckets f
Files
- Bayes.hs +12/−12
- Bayes/Continuous.hs +77/−6
- Bayes/Examples/ContinuousSampling.hs +109/−5
- Bayes/ImportExport.hs +103/−103
- Bayes/Network.hs +21/−21
- LICENSE +1/−1
- ModuleTest.hs +3/−0
- README.md +6/−0
- hbayes.cabal +44/−4
Bayes.hs view
@@ -777,17 +777,17 @@ instance (Show b, Show e) => Show (UndirectedSG e b)where show g@(SP em vm nm) = execWriter $ do- tell "graph dot {\n"- mapM_ (addVertexToUndirectedGraphviz nm) $ IM.toList vm- tell "\n"- mapM_ (addEdgeToGraphviz) $ M.toList em- tell "}\n"- where- addEdgeToGraphviz (e@(Edge (Vertex vs) (Vertex ve)),l) = do- tell $ show vs - tell " -- "- tell $ show ve- tell "\n"+ tell "graph dot {\n"+ mapM_ (addVertexToUndirectedGraphviz nm) $ IM.toList vm+ tell "\n"+ mapM_ (addEdgeToGraphviz) $ M.toList em+ tell "}\n"+ where+ addEdgeToGraphviz (e@(Edge (Vertex vs) (Vertex ve)),l) = do+ tell $ show vs + tell " -- "+ tell $ show ve+ tell "\n" displayFactors :: (NeighborhoodStructure n, Show f, Factor f, Graph (SimpleGraph n)) => SimpleGraph n a f -> String@@ -821,7 +821,7 @@ -- | Graph monad. -- The monad used to simplify the description of a new graph -- g is the graph type. e the edge type. f the node type (generally a 'Factor')-newtype GraphMonad g e f a = GM {runGraphMonad :: State (GMState g e f) a} deriving(Monad, MonadState (GMState g e f))+newtype GraphMonad g e f a = GM {runGraphMonad :: State (GMState g e f) a} deriving(Functor,Applicative,Monad, MonadState (GMState g e f)) -- | Get a named vertex from the graph monad getVertex :: Graph g => String -> GraphMonad g e f (Maybe Vertex)
Bayes/Continuous.hs view
@@ -23,6 +23,7 @@ , beta , beta' , exponential+ , gammaD , execCN , runCN , evalCN@@ -73,6 +74,26 @@ (RN a) / (RN b) = RN $ liftA2 (/) a b fromRational a = RN (return (fromRational a)) +instance Floating RN where + pi = RN (return pi)+ exp (RN b) = RN $ liftA exp b+ sqrt (RN b) = RN $ liftA sqrt b + log (RN b) = RN $ liftA log b+ sin (RN b) = RN $ liftA sin b+ cos (RN b) = RN $ liftA cos b+ tan (RN b) = RN $ liftA tan b+ asin (RN b) = RN $ liftA asin b + atan (RN b) = RN $ liftA atan b + acos (RN b) = RN $ liftA acos b + sinh (RN b) = RN $ liftA sinh b + tanh (RN b) = RN $ liftA tanh b + cosh (RN b) = RN $ liftA cosh b + asinh (RN b) = RN $ liftA asinh b + atanh (RN b) = RN $ liftA atanh b + acosh (RN b) = RN $ liftA acosh b + (**) (RN xb) (RN yb) = RN $ liftA2 (**) xb yb+ (logBase) (RN xb) (RN yb) = RN $ liftA2 logBase xb yb+ -- | An expression which can be a constant, variable or formula. -- In case it is a variable, it can be used as a 'BayesianVariable' -- or instantiated as an 'Instantiable' type.@@ -107,7 +128,28 @@ (DN da na) / (DN db nb) = DN (da `mappend`db) (na / nb) fromRational i = DN [] (fromRational i) +instance Floating DN where + pi = DN [] pi+ exp (DN a b) = DN a (exp b) + sqrt (DN a b) = DN a (sqrt b) + log (DN a b) = DN a (log b) + sin (DN a b) = DN a (sin b) + cos (DN a b) = DN a (cos b) + tan (DN a b) = DN a (tan b) + asin (DN a b) = DN a (asin b) + atan (DN a b) = DN a (atan b) + acos (DN a b) = DN a (acos b) + sinh (DN a b) = DN a (sinh b) + tanh (DN a b) = DN a (tanh b) + cosh (DN a b) = DN a (cosh b) + asinh (DN a b) = DN a (asinh b) + atanh (DN a b) = DN a (atanh b) + acosh (DN a b) = DN a (acosh b) + (**) (DN xa xb) (DN ya yb) = DN (xa `mappend` ya) (xb ** yb)+ (logBase) (DN xa xb) (DN ya yb) = DN (xa `mappend` ya) (xb ** yb) ++ {- Graph creation@@ -205,6 +247,35 @@ setBayesianNode v result return (node v) +-- | Gamma distribution +gammaD :: VariableName s + => s + -> DN -- ^ r+ -> DN -- ^ lambda+ -> CNMonad DN +gammaD s rm lambdam = do + v <- mkVariable s+ let la = dependencies rm + lb = dependencies lambdam + let l = la ++ lb+ cpt v l+ let bound = do + lambda <- value lambdam + r <- value rm+ return . Unbounded $ r/lambda/lambda+ result = D v (Distri bound $ \inst -> do + lambda <- value lambdam+ r <- value rm+ let x = instantiationValue inst + if x < 0 + then + return 0.0 + else + return $ lambda**r * x**(r-1)*exp(-lambda*x)/gamma r+ )+ setBayesianNode v result + return (node v)+ -- | Beta distribution beta :: VariableName s => s @@ -270,10 +341,10 @@ lb = dependencies nb let l = la ++ lb cpt v l- let bound = do - a <- value na - b <- value nb - return (BoundedSupport (a,b) )+ let bound = do+ a <- value na + b <- value nb + return (BoundedSupport (a,b) ) let result = D v (Distri bound $ \inst -> do a <- value na b <- value nb@@ -296,8 +367,8 @@ let l = la ++ lb cpt v l let bound = do - s <- value std - return (Unbounded s )+ s <- value std + return (Unbounded s ) let result = D v (Distri bound $ \inst -> do m <- value mean s <- value std
Bayes/Examples/ContinuousSampling.hs view
@@ -81,18 +81,75 @@ We see in the histogram that the estimated value is around 1.5. +The example 'complexsamples' will create three files alpha.txt, beta.txt and tau.txt. It is corresponding to the following+bugs model++@+model {+ for (i in 1:n) {+ mu[i] <- alpha + beta*i/n;+ y[i] ~ dnorm(mu[i],tau);+ }+ alpha ~ dnorm(0.0,1.0E-4);+ beta ~ dnorm(0.0,1.0E-4);+ tau ~ dgamma(1.0E-3,1.0E-3);+ sigma <- 1.0/sqrt(tau);+}+@++with alpha = 0, beta = 0 and tau = 1++The Haskell code for this model is++@+complexMeasures = 100 +--+complex = 'runCN' $ do + let n = complexMeasures+ alpha <- 'normal' \"alpha\" 0.0 1e-4 + beta <- 'normal' \"beta\" 0.0 1e-4 + tau <- 'gammaD' \"tau\" 1e-3 1e-3 + let sigma = 1.0 / sqrt(tau)+ sample i = do + let mu = alpha + beta * fromIntegral i / fromIntegral n+ y <- 'normal' () mu tau + return y+ l <- mapM sample [0..n-1]+ return (alpha:beta:tau:l)+@++And the generation of the samples is done with++@+complexsamples = do + let n = complexMeasures+ ((alpha:beta:tau:obs),complexg) = complex + alphat = 0.0 + betat = 0.0 + taut = 1.0 + aMeasure g i = do + let mu = alphat + betat * fromIntegral i / fromIntegral n+ MWC.normal mu taut g+ g <- create+ measurements <- mapM (aMeasure g) [0..n-1] + let evidence = zipWith ('=:') obs measurements+@+ -} module Bayes.Examples.ContinuousSampling(- nbSensors - , sensor - , test - , debugcn- ) where+ nbSensors + , sensor + , test + , debugcn+ , writesamples+ , complexsamples+ ) where import Bayes import Bayes.Continuous import qualified System.Random.MWC.Distributions as MWC(normal) import System.Random.MWC(GenIO,create) import Data.Maybe(fromJust)+import System.IO(withFile,IOMode(..),hPrint) nbSensors = 10 @@ -105,6 +162,41 @@ sensors <- sequence (replicate nbSensors (sensor a)) return (a:sensors) +complexMeasures = 100 ++complex = runCN $ do + let n = complexMeasures+ alpha <- normal "alpha" 0.0 1e-4 + beta <- normal "beta" 0.0 1e-4 + tau <- gammaD "tau" 1e-3 1e-3 + let sigma = 1.0 / sqrt(tau)+ sample i = do + let mu = alpha + beta * fromIntegral i / fromIntegral n+ y <- normal () mu tau + return y+ l <- mapM sample [0..n-1]+ return (alpha:beta:tau:l)++complexsamples = do + let n = complexMeasures+ ((alpha:beta:tau:obs),complexg) = complex + alphat = 0.0 + betat = 0.0 + taut = 1.0 + aMeasure g i = do + let mu = alphat + betat * fromIntegral i / fromIntegral n+ MWC.normal mu taut g+ g <- create+ measurements <- mapM (aMeasure g) [0..n-1] + let evidence = zipWith (=:) obs measurements+ n <- runSampling 10000 200 (continuousMCMCSampler complexg evidence)+ let samples s a = do + let v = map (\g -> instantiationValue . fromJust . vertexValue g $ (vertex a)) n+ writeList s v+ samples "alpha.txt" alpha + samples "beta.txt" beta+ samples "tau.txt" tau+ debugcn = do let ((a:sensors), testG) = test g <- create @@ -115,4 +207,16 @@ h = histogram 6 samples print h +writeList :: Show a => FilePath -> [a] -> IO ()+writeList s l = do + withFile s WriteMode $ \h -> do + mapM_ (hPrint h) l +writesamples s = do + let ((a:sensors), testG) = test+ g <- create + measurements <- sequence . replicate nbSensors $ (MWC.normal 1.5 0.1 g)+ let evidence = zipWith (=:) sensors measurements+ n <- runSampling 10000 200 (continuousMCMCSampler testG evidence)+ let samples = map (\g -> instantiationValue . fromJust . vertexValue g $ (vertex a)) n+ writeList s samples
Bayes/ImportExport.hs view
@@ -4,13 +4,13 @@ -} module Bayes.ImportExport (- -- * Networks- writeNetworkToFile- , readNetworkFromFile- -- * Junction Tree - , writeVariableMapAndJunctionTreeToFile- , readVariableMapAndJunctionTreeToFile- ) where + -- * Networks+ writeNetworkToFile+ , readNetworkFromFile+ -- * Junction Tree + , writeVariableMapAndJunctionTreeToFile+ , readVariableMapAndJunctionTreeToFile+ ) where import Data.Binary import Bayes@@ -46,130 +46,130 @@ readVariableMapAndJunctionTreeToFile f = decodeFile f instance Binary Cluster where - put (Cluster s) = put s - get = get >>= return . Cluster+ put (Cluster s) = put s + get = get >>= return . Cluster instance (Ord c, Binary c, Binary f) => Binary (JTree c f) where - put (JTree r ls cm pm spm scm nvm svm sck sclm) = do - put r - put ls - put cm - put pm - put spm - put scm - put nvm - put svm - put sck - put sclm - get = do - r <- get- ls <- get - cm <- get - pm <- get - spm <- get - scm <- get - nvm <- get - svm <- get - sck <- get - sclm <- get- return $ JTree r ls cm pm spm scm nvm svm sck sclm+ put (JTree r ls cm pm spm scm nvm svm sck sclm) = do + put r + put ls + put cm + put pm + put spm + put scm + put nvm + put svm + put sck + put sclm + get = do + r <- get+ ls <- get + cm <- get + pm <- get + spm <- get + scm <- get + nvm <- get + svm <- get + sck <- get + sclm <- get+ return $ JTree r ls cm pm spm scm nvm svm sck sclm instance Binary a => Binary (NodeValue a) where - put (NodeValue v f e) = do - put v - put f - put e - get = do - v <- get - f <- get - e <- get- return $ NodeValue v f e+ put (NodeValue v f e) = do + put v + put f + put e + get = do + v <- get + f <- get + e <- get+ return $ NodeValue v f e instance Binary a => Binary (SeparatorValue a) where- put (EmptySeparator) = do - putWord8 0 - put (SeparatorValue a b) = do - putWord8 1 - put a - put b - get = do - tag <- getWord8 - case tag of - 0 -> return EmptySeparator- _ -> do - a <- get - b <- get - return $ SeparatorValue a b + put (EmptySeparator) = do + putWord8 0 + put (SeparatorValue a b) = do + putWord8 1 + put a + put b + get = do + tag <- getWord8 + case tag of + 0 -> return EmptySeparator+ _ -> do + a <- get + b <- get + return $ SeparatorValue a b instance Binary (V.Vector Double) where - put = put . V.toList - get = get >>= return . V.fromList + put = put . V.toList + get = get >>= return . V.fromList instance Binary (NV.Vector Double) where - put = put . NV.toList - get = get >>= return . NV.fromList + put = put . NV.toList + get = get >>= return . NV.fromList instance Binary DV where - put (DV v i) = do - put v - put i - get = do - v <- get - i <- get - return $ DV v i + put (DV v i) = do + put v + put i + get = do + v <- get + i <- get + return $ DV v i instance Binary (v Double) => Binary (PrivateCPT v Double) where put (Table d m v) = do - putWord8 0 - put d - put m - put v + putWord8 0 + put d + put m + put v put (Scalar v) = do - putWord8 1 - put v + putWord8 1 + put v get = do - tag <- getWord8 - case tag of - 0 -> do - d <- get - m <- get - v <- get - return $ Table d m v - _ -> get >>= return . Scalar + tag <- getWord8 + case tag of + 0 -> do + d <- get + m <- get + v <- get + return $ Table d m v + _ -> get >>= return . Scalar instance Binary Vertex where put (Vertex v) = put v get = get >>= return . Vertex instance Binary Edge where - put (Edge va vb) = do - put va - put vb - get = do - va <- get- vb <- get - return $ Edge va vb+ put (Edge va vb) = do + put va + put vb + get = do + va <- get+ vb <- get + return $ Edge va vb instance (Binary l, Binary e, Binary v) => Binary (SimpleGraph l e v) where - put (SP e v n) = do - put e - put v - put n - get = do - e <- get - v <- get - n <- get - return $ SP e v n+ put (SP e v n) = do + put e + put v + put n + get = do + e <- get + v <- get + n <- get + return $ SP e v n instance Binary DE where put (DE a b) = do - put a - put b + put a + put b get = do - a <- get - b <- get - return $ DE a b + a <- get + b <- get + return $ DE a b instance Binary UE where - put (UE a) = put a - get = get >>= return . UE+ put (UE a) = put a + get = get >>= return . UE
Bayes/Network.hs view
@@ -3,30 +3,30 @@ -} module Bayes.Network(- -- * Types - MaybeNode(..)- , NetworkMonad(..)- -- * Functions- , factorVariable- , (<--)- , getBayesianNode - , setBayesianNode- , initializeNodeWithValue- , setVariableBoundWithSize- , setVariableBound- , addVariableIfNotFound- , unamedVariable- , variable- , variableWithSize- , unNamedVariableWithSize- , runNetwork- , execNetwork- , evalNetwork+ -- * Types + MaybeNode(..)+ , NetworkMonad(..)+ -- * Functions+ , factorVariable+ , (<--)+ , getBayesianNode + , setBayesianNode+ , initializeNodeWithValue+ , setVariableBoundWithSize+ , setVariableBound+ , addVariableIfNotFound+ , unamedVariable+ , variable+ , variableWithSize+ , unNamedVariableWithSize+ , runNetwork+ , execNetwork+ , evalNetwork , runGraph , execGraph , evalGraph- , getCpt- ) where + , getCpt+ ) where import Bayes.PrivateTypes import Bayes
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c)2012, alpheccar+Copyright (c)2012-2016, alpheccar All rights reserved.
+ ModuleTest.hs view
@@ -0,0 +1,3 @@+import Bayes.Test++main = runTests
+ README.md view
@@ -0,0 +1,6 @@+[](https://hackage.haskell.org/package/hbayes)++hbayes+======++WARNING : This package is not yet using log arithmetic !
hbayes.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.5+Version: 0.5.2 -- A short (one-line) description of the package. Synopsis: Bayesian Networks@@ -35,7 +35,7 @@ Maintainer: misc@alpheccar.org -- A copyright notice.-Copyright: Copyright (c) 2012, alpheccar +Copyright: Copyright (c) 2012-2016, alpheccar Stability: experimental @@ -45,8 +45,11 @@ tested-with: GHC==7.4.1 -- Constraint on the version of Cabal needed to build this package.-Cabal-version: >=1.8+Cabal-version: >=1.10 +extra-source-files:+ README.md+ data-files: cancer.net Flag local {@@ -59,6 +62,42 @@ Default: False } +source-repository head+ type: git+ location: https://github.com/alpheccar/hbayes.git++Test-Suite hbayes-Tests+ Type: exitcode-stdio-1.0+ Main-is: ModuleTest.hs+ hs-source-dirs: .+ Build-depends: base >= 4, + hbayes,+ base < 5,+ mtl >= 2.0.1.0,+ containers >= 0.4.2.1,+ array >= 0.4.0.0,+ QuickCheck >= 2.4.2,+ pretty >= 1.1.1.0,+ boxes,+ vector,+ random,+ split,+ parsec,+ filepath,+ directory,+ binary >= 0.5,+ test-framework-quickcheck2,+ test-framework,+ test-framework-hunit,+ HUnit,+ mwc-random >= 0.12,+ statistics >= 0.10.1,+ gamma >= 0.9+ Default-language: Haskell2010+ default-extensions: CPP+ if flag(local)+ cpp-options: -DLOCAL+ Library -- Modules exported by the library. Exposed-modules:@@ -95,8 +134,9 @@ Bayes.Factor.PrivateCPT Bayes.Network + Default-language: Haskell2010 GHC-Options: -funbox-strict-fields- Extensions: CPP+ default-extensions: CPP if flag(local) cpp-options: -DLOCAL if flag(profile)