Examples of predict()


Examples of aima.core.learning.framework.Learner.predict()

  }

  private ConstantDecisonTree majorityValue(DataSet ds) {
    Learner learner = new MajorityLearner();
    learner.train(ds);
    return new ConstantDecisonTree(learner.predict(ds.getExample(0)));
  }

  private String chooseAttribute(DataSet ds, List<String> attributeNames) {
    double greatestGain = 0.0;
    String attributeWithGreatestGain = attributeNames.get(0);
View Full Code Here

Examples of aima.core.learning.framework.Learner.predict()

  }

  private ConstantDecisonTree majorityValue(DataSet ds) {
    Learner learner = new MajorityLearner();
    learner.train(ds);
    return new ConstantDecisonTree(learner.predict(ds.getExample(0)));
  }

  private String chooseAttribute(DataSet ds, List<String> attributeNames) {
    double greatestGain = 0.0;
    String attributeWithGreatestGain = attributeNames.get(0);
View Full Code Here

Examples of aima.core.learning.inductive.DecisionList.predict()

  @Test
  public void testDecisonListWithNoTestsReturnsDefaultValue()
      throws Exception {
    DecisionList dlist = new DecisionList("Yes", "No");
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    Assert.assertEquals("No", dlist.predict(ds.getExample(0)));
  }

  @Test
  public void testDecisionListWithSingleTestReturnsTestValueIfTestSuccessful()
      throws Exception {
View Full Code Here

Examples of aima.core.learning.inductive.DecisionList.predict()

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

    dlist.add(test, "test1success");

    Assert.assertEquals("test1success", dlist.predict(ds.getExample(0)));
  }

  @Test
  public void testDecisionListFallsThruToNextTestIfOneDoesntMatch()
      throws Exception {
View Full Code Here

Examples of aima.core.learning.inductive.DecisionList.predict()

    DLTest test2 = new DLTest();
    test2.add("type", "French");
    dlist.add(test2, "test2success");// matches first example

    Assert.assertEquals("test2success", dlist.predict(ds.getExample(0)));
  }

  @Test
  public void testDecisionListFallsThruToDefaultIfNoTestMatches()
      throws Exception {
View Full Code Here

Examples of aima.core.learning.inductive.DecisionList.predict()

    DLTest test2 = new DLTest();
    test2.add("type", "Burger");
    dlist.add(test2, "test2success");// doesn't match first example

    Assert.assertEquals("No", dlist.predict(ds.getExample(0)));
  }

  @Test
  public void testDecisionListHandlesEmptyDataSet() throws Exception {
    // tests first base case of recursion
View Full Code Here

Examples of aima.core.learning.inductive.DecisionList.predict()

    DLTest test2 = new DLTest();
    test2.add("type", "French");
    dlist2.add(test2, "test2success");// matches first example

    DecisionList dlist3 = dlist1.mergeWith(dlist2);
    Assert.assertEquals("test2success", dlist3.predict(ds.getExample(0)));
  }
}
View Full Code Here

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

    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)));
  }

  @Test
View Full Code Here

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

        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)));
  }

  @Test
  public void testDecisionListLearnerReturnsFailureWhenTestsEmpty()
View Full Code Here

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

    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)));
  }

  @Test
  public void testDecisionListLearnerReturnsFailureWhenTestsEmpty()
      throws Exception {
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.