Programatically Entering Netica Likelihoods


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // We will assume you have a netica network
  2. // assigned to the private variable: NeticaNetwork
  3. // and that you will properly assign the two variables
  4. // listed below in the correct locations.
  5.  
  6. //
  7. // place in relative locations within your code
  8. //
  9. Application App = new Application();
  10. BNet NeticaNetwork = App.ReadBNet(pathToNeta);
  11.  
  12. public void EnterLikelihood(string nodeName, float[] likelihoods)
  13. {
  14. // I have a method which normalizes node and state names
  15. // to insert _ instead of " ". Netica translates on its own
  16. // " " to _ so we have to match that in case the user doesn't
  17. nodeName = Normalize(nodeName);
  18.  
  19. // Now we can insert our vector into the netica network
  20. //
  21. // This inserts the float which contains all of the likelihoods
  22. // for this node. For example, if there are 6 states there
  23. // need to be 6 likelihoods in the float[].
  24. //
  25. // float[0] = 0.0f
  26. // float[1] = 0.0f
  27. // float[2] = 0.0f
  28. // float[3] = 1.0f
  29. // float[4] = 0.0f
  30. // float[5] = 0.0f
  31. //
  32. // The values of course can be anywhere between 0.0 - 1.0
  33. //
  34. NeticaNetwork.Node(nodeName).EnterLikelihood(likelihoods);
  35. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.