/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// We will assume you have a netica network // assigned to the private variable: NeticaNetwork // and that you will properly assign the two variables // listed below in the correct locations. // // place in relative locations within your code // BNet NeticaNetwork = App.ReadBNet(pathToNeta); public void EnterLikelihood(string nodeName, float[] likelihoods) { // I have a method which normalizes node and state names // to insert _ instead of " ". Netica translates on its own // " " to _ so we have to match that in case the user doesn't nodeName = Normalize(nodeName); // Now we can insert our vector into the netica network // // This inserts the float which contains all of the likelihoods // for this node. For example, if there are 6 states there // need to be 6 likelihoods in the float[]. // // float[0] = 0.0f // float[1] = 0.0f // float[2] = 0.0f // float[3] = 1.0f // float[4] = 0.0f // float[5] = 0.0f // // The values of course can be anywhere between 0.0 - 1.0 // NeticaNetwork.Node(nodeName).EnterLikelihood(likelihoods); }