train() public method

public train ( DataSet ds ) : void
ds AIMA.Core.Learning.Framework.DataSet
return void
        private ConstantDecisonTree majorityValue(DataSet ds)
        {
            Learner learner = new MajorityLearner();

            learner.train(ds);
            return(new ConstantDecisonTree(learner.predict(ds.getExample(0))));
        }
Beispiel #2
0
 public void testMajorityLearner()
 {
     MajorityLearner learner = new MajorityLearner();
     DataSet ds = DataSetFactory.getRestaurantDataSet();
     learner.train(ds);
     int[] result = learner.test(ds);
     Assert.AreEqual(6, result[0]);
     Assert.AreEqual(6, result[1]);
 }
 private ConstantDecisonTree majorityValue(DataSet ds)
 {
     Learner learner = new MajorityLearner();
     learner.train(ds);
     return new ConstantDecisonTree(learner.predict(ds.getExample(0)));
 }