Beispiel #1
0
        public CategorizationResult Categorize(Entry item, Index first, Index second)
        {
            float prediction = GetPrediction(item, first, second);

            if (prediction <= .5f - this.Tolerance)
                return CategorizationResult.Second;

            if (prediction >= .5 + this.Tolerance)
                return CategorizationResult.First;

            return CategorizationResult.Undetermined;
        }
Beispiel #2
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;
        }