/// <summary> /// Returns the probability of bacterimia in a patient /// </summary> /// <param name="dom">The Cpn network domain</param> /// <returns>The probability of bacterimia</returns> public float GetBactermiaProbability(Domain dom) { //Find bacteremia nodes in CPN DiscreteChanceNode dSepsisNode = (DiscreteChanceNode)dom.GetNodeByName("Bacteremia_total"); DiscreteChanceNode dSepsisNode1 = (DiscreteChanceNode)dom.GetNodeByName("Bacteremia_total_1"); DiscreteChanceNode dSepsisNode2 = (DiscreteChanceNode)dom.GetNodeByName("Bacteremia_total_2"); List<float> results = new List<float>(); results.Add(dSepsisNode.GetBelief((uint)1)); results.Add(dSepsisNode1.GetBelief((uint)1)); results.Add(dSepsisNode2.GetBelief((uint)1)); float finalResult = 0f; foreach (float res in results) { if (res > finalResult) { finalResult = res; } } return finalResult; }
public SepsisResult GetBeliefsOnSepsisNode(Domain dom) { SepsisResult result = new SepsisResult(); //Find sepsis node in CPN DiscreteChanceNode dSepsisNode = (DiscreteChanceNode)dom.GetNodeByName("Sepsis_pu_em_gg_us_pn"); //Read all states on sepsis node result.No = dSepsisNode.GetBelief((uint)0); result.Mild = dSepsisNode.GetBelief((uint)1); result.Moderate = dSepsisNode.GetBelief((uint)2); result.Severe = dSepsisNode.GetBelief((uint)3); result.Critical = dSepsisNode.GetBelief((uint)4); result.Bacterimia = GetBactermiaProbability(dom); dom.RetractFindings(); return result; }
/// <summary> /// Special case for age. Initializes age /// </summary> /// <param name="nodeID"></param> /// <param name="age"></param> /// <param name="dNode"></param> /// <param name="lookupList"></param> public void DiscreteRangeNodeInitializeStatesAge(int age, Domain dom, List<aDiscreteNodeRange> lookupList) { //Find the discrete node "age" in CPN DiscreteChanceNode dNode = (DiscreteChanceNode)dom.GetNodeByName("age"); string nodeID = "age"; //Find state to initialize string nodeState = GetStateToInitDNodeRange(nodeID, age, lookupList); //If value is null, don't initialize anything on the current node if (nodeState == null) { throw new Exception(); } //Enter findings (evidence) in discrete node DiscreteNodeEnterFindings(dNode, nodeState); }