Package aima.core.learning.learners

Examples of aima.core.learning.learners.DecisionListLearner.train()


          .println("DecisionList Demo - Inducing a DecisionList from the Restaurant DataSet\n ");
      System.out.println(Util.ntimes("*", 100));
      DataSet ds = DataSetFactory.getRestaurantDataSet();
      DecisionListLearner learner = new DecisionListLearner("Yes", "No",
          new DLTestFactory());
      learner.train(ds);
      System.out.println("The Induced DecisionList is");
      System.out.println(learner.getDecisionList());
      int[] result = learner.test(ds);

      System.out
View Full Code Here


    // 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.assertEquals("No", learner.predict(ds.getExample(0)));
    Assert.assertEquals("No", learner.predict(ds.getExample(1)));
    Assert.assertEquals("No", learner.predict(ds.getExample(2)));
  }
View Full Code Here

      throws Exception {
    // tests second base case of DL Learner
    DecisionListLearner learner = new DecisionListLearner("Yes", "No",
        new MockDLTestFactory(new ArrayList<DLTest>()));
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    learner.train(ds);
    Assert.assertEquals(DecisionListLearner.FAILURE,
        learner.predict(ds.getExample(0)));
  }

  @Test
View Full Code Here

  @Test
  public void testDecisionListTestRunOnRestaurantDataSet() throws Exception {
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    DecisionListLearner learner = new DecisionListLearner("Yes", "No",
        new DLTestFactory());
    learner.train(ds);

    int[] result = learner.test(ds);
    Assert.assertEquals(12, result[0]);
    Assert.assertEquals(0, result[1]);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.