bayesian-networks

Sample from a Bayesian network in pomegranate

为君一笑 提交于 2020-02-23 06:44:15
问题 I constructed a Bayesian network using from_samples() in pomegranate. I'm able to get maximally likely predictions from the model using model.predict() . I wanted to know if there is a way to sample from this Bayesian network conditionally(or unconditionally)? i.e. is there a get random samples from the network and not the maximally likely predictions? I looked at model.sample() , but it was raising NotImplementedError . Also if this is not possible to do using pomegranate , what other

Error in bn.fit predict function in bnlear R

情到浓时终转凉″ 提交于 2020-01-15 12:16:05
问题 I have learned and fitted Bayesian Network in bnlearn R package and I wish to predict it's "event" node value. fl="data/discrete_kdd_10.txt" h=TRUE dtbl1 = read.csv(file=fl, head=h, sep=",") net=hc(dtbl1) fitted=bn.fit(net,dtbl1) I want to predict the value of "event" node based on the evidence stored in another file with the same structure as the file used for learning. fileName="data/dcmp.txt" dtbl2 = read.csv(file=fileName, head=h, sep=",") predict(fitted,"event",dtbl2) However, predict

Function restriction by fixing an argument

纵饮孤独 提交于 2020-01-13 11:45:10
问题 How should I make function with lesser dimensionality than the original one by fixing an argument of it: For example I want to make successor function out of sum function as follows: def add(x,y): return x+y Now I am looking for something like this: g=f(~,1) which would be the successor function, i.e. g(x)=x+1 . 回答1: You can write your own function: def g(y): return f(2, y) Or more concisely: g = lambda y: f(2, y) There's also functools.partial : import functools def f(x, y): return x + y g =

Implement Bayes Net

微笑、不失礼 提交于 2020-01-12 22:32:13
问题 Is there any c or java example implementing Bayesian Net ? I want to solve some things but Do not where to start?. 回答1: I have been using JavaBayes with great success for my master thesis final project. Check it out under http://www.cs.cmu.edu/~javabayes/ It has a great set of examples, very decent documentation, a graphical designer and very useful API. I remember I did a little research regarding available Bayesian Networks implementations in Java and I was pleasantly surprised when I found

Implement Bayes Net

有些话、适合烂在心里 提交于 2020-01-12 22:32:11
问题 Is there any c or java example implementing Bayesian Net ? I want to solve some things but Do not where to start?. 回答1: I have been using JavaBayes with great success for my master thesis final project. Check it out under http://www.cs.cmu.edu/~javabayes/ It has a great set of examples, very decent documentation, a graphical designer and very useful API. I remember I did a little research regarding available Bayesian Networks implementations in Java and I was pleasantly surprised when I found

pymc warning: value is neither numerical nor array with floating-point dtype

对着背影说爱祢 提交于 2020-01-02 02:21:31
问题 I have a Bayes net (DAG) model which I created using pymc 2.3. All the variables in it are Bernoulli random variables. When I call the MAP.fit() method on it before sampling I get the following warning for all of my random variables: value is neither numerical nor array with floating-point dtype. Recommend fitting method fmin (default) From the github repo of pymc, it seems that this warning is printed if the underlying type of the stochastic variable is not a float. For Bernoulli RV the type

Weka: why getMargin returns all zeros?

和自甴很熟 提交于 2019-12-25 00:23:13
问题 I am using Weka Java API. I trained a Bayesnet on an Instances object (data set) data . /** * Initialization */ Instances data = ...; BayesNet bn = new EditableBayesNet(data); SearchAlgorithm learner = new TAN(); SimpleEstimator estimator = new SimpleEstimator(); /** * Training */ bn.initStructure(); learner.buildStructure(bn, data); estimator.estimateCPTs(bn); getMargin returns marginal distibution for a node. Ideally, assuming node A has 3 possible values, and its node index is 0. Then, bn

How to specify initial probability values for variables in a dynamic Bayesian network using Bayes server

回眸只為那壹抹淺笑 提交于 2019-12-24 08:25:38
问题 I am trying to create a dynamic Bayesian network for parameter learning using the Bayes server in C# in my Unity game. The implementation is based on this article. A brief explanation of the model shown in the figure below: When a player starts playing the level I assign them an initial probability of 0.5 that they already know the stuff that they are learning which is represented as Prior node in the network shown with the associated variable called as priorKnowledge . This prior node is