Example #1
0
        public float GetPrediction(Entry item)
        {
            foreach (var token in item)
            {
                int positiveCount = _positive.GetTokenCount(token);
                int negativeCount = _negative.GetTokenCount(token);

                float probability = CalcProbability(positiveCount, _positive.EntryCount, negativeCount, _negative.EntryCount);
            }

            float prediction = CombineProbability();

            return(prediction);
        }
Example #2
0
        public static float GetPrediction(Entry item, Index first, Index second)
        {
            float I = 0;

            float invI = 0;

            foreach (var token in item)
            {
                var firstCount  = first.GetTokenCount(token);
                var secondCount = second.GetTokenCount(token);

                var probability = CalcProbability(firstCount, first.EntryCount, secondCount, second.EntryCount);
                LogProbability(probability, ref I, ref invI);

                Debug.WriteLine($@"{token}: [{probability}] ({firstCount}-{first.EntryCount}), ({secondCount}-{second.EntryCount})");
            }

            return(I / (I + invI));
        }
Example #3
0
        public float GetPrediction(Entry item, Index first, Index second)
        {
            foreach (string token in item)
            {
                int firstCount = first.GetTokenCount(token);
                int secondCount = second.GetTokenCount(token);

                float probability = CalcProbability(firstCount, first.EntryCount, secondCount, second.EntryCount);

                Console.WriteLine("{0}: [{1}] ({2}-{3}), ({4}-{5})",
                    token,
                    probability,
                    firstCount,
                    first.EntryCount,
                    secondCount,
                    second.EntryCount);
            }

            float prediction = CombineProbability();
            return prediction;
        }
Example #4
0
        public float GetPrediction(Entry item, Index first, Index second)
        {
            foreach (string token in item)
            {
                int firstCount  = first.GetTokenCount(token);
                int secondCount = second.GetTokenCount(token);

                float probability = CalcProbability(firstCount, first.EntryCount, secondCount, second.EntryCount);

                Console.WriteLine("{0}: [{1}] ({2}-{3}), ({4}-{5})",
                                  token,
                                  probability,
                                  firstCount,
                                  first.EntryCount,
                                  secondCount,
                                  second.EntryCount);
            }

            float prediction = CombineProbability();

            return(prediction);
        }