Represents a single Arc in Bayes Net
Example #1
0
 /// <summary>
 /// Debug Process, make sure values line up with LISP code
 /// </summary>
 /// <param name="voNode">Node we are updating</param>
 /// <param name="voArc">current arc</param>
 /// <param name="voArcNode">the arc node</param>
 /// <param name="vsProgress">message</param>
 public void DebugProgress(BeliefNode voNode, Arc voArc, BeliefNode voArcNode,string vsProgress)
 {
     Console.Out.WriteLine(string.Format("{0} update of {1} along arc ({2} {3} {4}) with prior odds {5}", vsProgress, voNode.Name, voArc.Name, voArc.Sufficiency, voArc.Neccessity, voNode.PriorOdds));
     Console.Out.WriteLine(string.Format("The prior and current prob of E are {0}, {1}", voArcNode.PriorProbability, voArcNode.CurrentProbability));
 }
Example #2
0
        /// <summary>
        /// Returnes Updates for the Probability 
        /// </summary>
        /// <param name="voBeliefNode">The BeliefNode</param>
        /// <param name="voArc">Arc to Evaluate</param>
        /// <returns>Updated Probability</returns>
        public float UpdateProbability(BeliefNode voBeliefNode, Arc voArc)
        {
            BeliefNode arcNode = moNodes.GetBelief(voArc.Name);
            float fUpdatedValue = 0.0f;
            if (arcNode.CurrentProbability > arcNode.PriorProbability)
            {
                DebugProgress(voBeliefNode,voArc,arcNode,"Supporting arc");
                fUpdatedValue = (float)(voBeliefNode.PriorProbability +
                    ((Utility.CalculateProbability(voArc.Sufficiency * voBeliefNode.PriorOdds) - voBeliefNode.PriorProbability)
                    /
                    (1.0 - arcNode.PriorProbability) * (arcNode.CurrentProbability - arcNode.PriorProbability)));

            }
            else
            {
                DebugProgress(voBeliefNode, voArc, arcNode, "Inhibiting arc");
                fUpdatedValue =
                    ((Utility.CalculateProbability(voArc.Neccessity * voBeliefNode.PriorOdds)) +
                    (voBeliefNode.PriorProbability - Utility.CalculateProbability(voArc.Neccessity * voBeliefNode.PriorOdds))
                    /
                    arcNode.PriorProbability
                    *
                    arcNode.CurrentProbability);
            }
            return fUpdatedValue;
        }
Example #3
0
 /// <summary>
 /// Calcualtes the Effective Arc Lambda
 /// </summary>
 /// <param name="voArc">Single Arc</param>
 /// <returns>Calculate Lambda</returns>
 public float CalculateEffectiveArcLambda(BeliefNode voBeliefNode, Arc voArc)
 {
     return Utility.CalculateOdds(UpdateProbability(voBeliefNode, voArc)) / voBeliefNode.PriorOdds;
 }