Return to Snippet

Revision: 31501
at September 8, 2010 15:48 by cabrel


Updated Code
// 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);
}

Revision: 31500
at September 8, 2010 04:02 by cabrel


Initial Code
// 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);
}

Initial URL

                                

Initial Description

                                

Initial Title
Programatically Entering Netica Likelihoods

Initial Tags
c

Initial Language
C#