问题
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 linked to the Knowledge node, which is a hidden node representing the latent variable LearnRate
and needs to be learned during the process of game-play. This node is in turn connected to the Question node which has two states correct or incorrect, depending on whether the player answers the question correctly or incorrectly. Depending on the status of the prior node and question node, learn rate is calculated and is used as a prior for the next level, once the orevious levels gets cleared.
I have the following piece of code for creating the network in C# using the Bayes server library. However, I need to set the initial value of the prior and I can't find a way to do it. There is no method in the Variable
class which lets me assign a value to it. How do I go about it?
void initializeNetworkForLevel(int numberOfDistractors, int levelId)
{
beliefnet = new BayesServer.Network();
// add an intial knowledge node
priorKnowledge = new Variable("PriorKnowledge", VariableValueType.Continuous, VariableKind.Probability);
// initialize the priorKnowledge value to 0.5 if level = 1, else set it to learn rate
priorKnowledgeNode = new Node("Prior", priorKnowledge);
beliefnet.Nodes.Add(priorKnowledgeNode);
// add a knowledge node which is a latent variable (parameter to be learned from observed values
learnRate = new Variable("LearnRate", VariableValueType.Continuous, VariableKind.Probability);
knowledgeNode = new Node("Knowledge", learnRate);
beliefnet.Nodes.Add(knowledgeNode);
// add a link from prior node to knowledge node
beliefnet.Links.Add(new Link(priorKnowledgeNode, knowledgeNode));
// add a question node, which denotes the oberved variable whether the question is answered correctly or not
// this node has two states, namely correct or incorrect
State correct = new State("Correct");
State inCorrect = new State("Inorrect");
questionNode = new Node("Question", correct, inCorrect);
beliefnet.Nodes.Add(questionNode);
// add a link from knowledge node to question node
beliefnet.Links.Add(new Link(knowledgeNode, questionNode));
}
来源:https://stackoverflow.com/questions/53093590/how-to-specify-initial-probability-values-for-variables-in-a-dynamic-bayesian-ne