Skip to content

Instantly share code, notes, and snippets.

@cabrel
Last active December 14, 2015 03:59
Show Gist options
  • Save cabrel/5025521 to your computer and use it in GitHub Desktop.
Save cabrel/5025521 to your computer and use it in GitHub Desktop.
Programatically Entering Netica Likelihoods
// 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