示例#1
0
        public void testDecisionListLearnerReturnsNegativeDLWhenDataSetEmpty()


        {
            // tests first base case of DL Learner
            DecisionListLearner learner = new DecisionListLearner("Yes", "No",
                                                                  new MockDLTestFactory(null));
            DataSet ds    = DataSetFactory.getRestaurantDataSet();
            DataSet empty = ds.emptyDataSet();

            learner.Train(empty);
            Assert.AreEqual("No", learner.Predict(ds.getExample(0)));
            Assert.AreEqual("No", learner.Predict(ds.getExample(1)));
            Assert.AreEqual("No", learner.Predict(ds.getExample(2)));
        }
示例#2
0
        public void testDecisionListLearnerReturnsFailureWhenTestsEmpty()


        {
            // tests second base case of DL Learner
            DecisionListLearner learner = new DecisionListLearner("Yes", "No", new MockDLTestFactory(CollectionFactory.CreateQueue <aima.net.learning.inductive.DecisionListTest>()));
            DataSet             ds      = DataSetFactory.getRestaurantDataSet();

            learner.Train(ds);
            Assert.AreEqual(DecisionListLearner.FAILURE,
                            learner.Predict(ds.getExample(0)));
        }