CalculateOverallProbability() public method

public CalculateOverallProbability ( WordProbability wps ) : double
wps WordProbability
return double
コード例 #1
0
        public void TestCalculateOverallProbability()
        {
            var prob = 0.3d;
            var wp1 = new WordProbability("myWord1", prob);
            var wp2 = new WordProbability("myWord2", prob);
            var wp3 = new WordProbability("myWord3", prob);

            var wps = new[] { wp1, wp2, wp3 };
            var errorMargin = 0.0001d;

            var xy = (prob * prob * prob);
            var z = (1-prob)*(1-prob)*(1-prob);

            var result = xy/(xy + z);

            var classifier = new BayesianClassifier();

            Assert.AreEqual(result, classifier.CalculateOverallProbability(wps), errorMargin);
        }
コード例 #2
0
        public void TestCalculateOverallProbability()
        {
            double prob = 0.3d;
            WordProbability wp1 = new WordProbability("myWord1", prob);
            WordProbability wp2 = new WordProbability("myWord2", prob);
            WordProbability wp3 = new WordProbability("myWord3", prob);

            WordProbability[] wps = new WordProbability[] { wp1, wp2, wp3 };
            double errorMargin = 0.0001d;

            double xy = (prob * prob * prob);
            double z = (1-prob)*(1-prob)*(1-prob);

            double result = xy/(xy + z);

            BayesianClassifier classifier = new BayesianClassifier();

            Assert.AreEqual(result, classifier.CalculateOverallProbability(wps), errorMargin);
        }