Last active
December 14, 2015 03:59
-
-
Save cabrel/5025521 to your computer and use it in GitHub Desktop.
Programatically Entering Netica Likelihoods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
// | |
Application App = new Application(); | |
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment