AIMA.Core.Learning.Inductive.DecisionList.predict C# (CSharp) Method

predict() public method

public predict ( Example example ) : String
example AIMA.Core.Learning.Framework.Example
return String
        public String predict(Example example)
        {
            if (tests.Count == 0)
            {
                return negative;
            }
            foreach (DLTest test in tests)
            {
                if (test.matches(example))
                {
                    return testOutcomes[test];
                }
            }
            return negative;
        }

Usage Example

Example #1
0
        public void testDecisionListWithSingleTestReturnsTestValueIfTestSuccessful()
        {
            DecisionList dlist = new DecisionList("Yes", "No");
            DataSet ds = DataSetFactory.getRestaurantDataSet();

            DLTest test = new DLTest();
            test.add("type", "French");

            dlist.add(test, "test1success");

            Assert.AreEqual("test1success", dlist.predict(ds.getExample(0)));
        }
All Usage Examples Of AIMA.Core.Learning.Inductive.DecisionList::predict