Exemplo n.º 1
0
        public string Predict(Example e)
        {
            string prediction = "~" + e.TargetValue();

            if (null != currentBestHypothesis)
            {
                var etp = new FOLExample(folDSDomain, e, 0);
                kb.Clear();
                kb.tell(etp.GetDescription());
                kb.tell(currentBestHypothesis.GetHypothesis());
                IInferenceResult ir = kb.Ask(etp.GetClassification());
                if (ir.IsTrue())
                {
                    if (trueGoalValue.Equals(e.TargetValue()))
                    {
                        prediction = e.TargetValue();
                    }
                }
                else if (ir.IsPossiblyFalse() || ir.IsUnknownDueToTimeout())
                {
                    if (!trueGoalValue.Equals(e.TargetValue()))
                    {
                        prediction = e.TargetValue();
                    }
                }
            }

            return(prediction);
        }