from primo.evidence import EvidenceEqual as EvEqual from primo.evidence import EvidenceInterval as EvInterval import numpy # Construct some simple BayesianNetwork. In this example it models # the linear relationship between the age of a plant and the height that # it has grown up to (+noise) bn = BayesianNetwork() cnf = ContinuousNodeFactory() # create the nodes age = cnf.createExponentialNode("Age") sun = cnf.createBetaNode("Sun") ground = cnf.createGaussNode("Ground") growth = cnf.createGaussNode("Growth") height = cnf.createBetaNode("Height") diameter = cnf.createExponentialNode("Diameter") children = cnf.createExponentialNode("Children") # add the nodes to the network bn.add_node(age) bn.add_node(sun) bn.add_node(ground) bn.add_node(growth) bn.add_node(height) bn.add_node(diameter) bn.add_node(children)
#bayesian network. At first that network is being constructed and afterwards it #is passed to an MCMC object that is used to answer several kinds of questions: #-Prior marginal #-Posterior marginal #-Probability of evidence #-Maximum a-posteriori hypothesis #Construct some simple BayesianNetwork. #topology bn = BayesianNetwork() cnf=ContinuousNodeFactory() age = cnf.createExponentialNode("Plant_age") height = cnf.createGaussNode("Plant_height") diameter = cnf.createBetaNode("Plant_diameter") bn.add_node(age) bn.add_node(height) bn.add_node(diameter) bn.add_edge(age,height) bn.add_edge(age,diameter) #parameterization #Semantics: Many young plants and the higher the age the lower the probabilty #->lambda=2.0 age_parameters=ExponentialParameters(0.0,{}) age.set_density_parameters(age_parameters) #Semantics: plants start at 0.1 meters underground and grow each year by 1 meter.
from primo.evidence import EvidenceEqual as EvEqual from primo.evidence import EvidenceInterval as EvInterval import numpy #Construct some simple BayesianNetwork. In this example it models #the linear relationship between the age of a plant and the height that #it has grown up to (+noise) bn = BayesianNetwork() cnf = ContinuousNodeFactory() #create the nodes age = cnf.createExponentialNode("Age") sun = cnf.createBetaNode("Sun") ground = cnf.createGaussNode("Ground") growth = cnf.createGaussNode("Growth") height = cnf.createBetaNode("Height") diameter = cnf.createExponentialNode("Diameter") children = cnf.createExponentialNode("Children") #add the nodes to the network bn.add_node(age) bn.add_node(sun) bn.add_node(ground) bn.add_node(growth) bn.add_node(height) bn.add_node(diameter) bn.add_node(children)