Examples of DLTest


Examples of aima.core.learning.inductive.DLTest

    if (ds.size() == 0) {
      return new DecisionList(positive, negative);
    }
    List<DLTest> possibleTests = testFactory
        .createDLTestsWithAttributeCount(ds, 1);
    DLTest test = getValidTest(possibleTests, ds);
    if (test == null) {
      return new DecisionList(null, FAILURE);
    }
    // at this point there is a test that classifies some subset of examples
    // with the same target value
    DataSet matched = test.matchedExamples(ds);
    DecisionList list = new DecisionList(positive, negative);
    list.add(test, matched.getExample(0).targetValue());
    return list.mergeWith(decisionListLearning(test.unmatchedExamples(ds)));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

    if (ds.size() == 0) {
      return new DecisionList(positive, negative);
    }
    List<DLTest> possibleTests = testFactory
        .createDLTestsWithAttributeCount(ds, 1);
    DLTest test = getValidTest(possibleTests, ds);
    if (test == null) {
      return new DecisionList(null, FAILURE);
    }
    // at this point there is a test that classifies some subset of examples
    // with the same target value
    DataSet matched = test.matchedExamples(ds);
    DecisionList list = new DecisionList(positive, negative);
    list.add(test, matched.getExample(0).targetValue());
    return list.mergeWith(decisionListLearning(test.unmatchedExamples(ds)));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  @Test
  public void testDLTestMatchSucceedsWithMatchedExample() throws Exception {
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    Example e = ds.getExample(0);
    DLTest test = new DLTest();
    test.add("type", "French");
    Assert.assertTrue(test.matches(e));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  @Test
  public void testDLTestMatchFailsOnMismatchedExample() throws Exception {
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    Example e = ds.getExample(0);
    DLTest test = new DLTest();
    test.add("type", "Thai");
    Assert.assertFalse(test.matches(e));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  @Test
  public void testDLTestMatchesEvenOnMismatchedTargetAttributeValue()
      throws Exception {
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    Example e = ds.getExample(0);
    DLTest test = new DLTest();
    test.add("type", "French");
    Assert.assertTrue(test.matches(e));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  @Test
  public void testDLTestReturnsMatchedAndUnmatchedExamplesCorrectly()
      throws Exception {
    DataSet ds = DataSetFactory.getRestaurantDataSet();
    DLTest test = new DLTest();
    test.add("type", "Burger");

    DataSet matched = test.matchedExamples(ds);
    Assert.assertEquals(4, matched.size());

    DataSet unmatched = test.unmatchedExamples(ds);
    Assert.assertEquals(8, unmatched.size());
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  public void testDecisionListWithSingleTestReturnsTestValueIfTestSuccessful()
      throws Exception {
    DecisionList dlist = new DecisionList("Yes", "No");
    DataSet ds = DataSetFactory.getRestaurantDataSet();

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

    dlist.add(test, "test1success");

    Assert.assertEquals("test1success", dlist.predict(ds.getExample(0)));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  public void testDecisionListFallsThruToNextTestIfOneDoesntMatch()
      throws Exception {
    DecisionList dlist = new DecisionList("Yes", "No");
    DataSet ds = DataSetFactory.getRestaurantDataSet();

    DLTest test1 = new DLTest();
    test1.add("type", "Thai"); // doesn't match first example
    dlist.add(test1, "test1success");

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

    Assert.assertEquals("test2success", dlist.predict(ds.getExample(0)));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  public void testDecisionListFallsThruToDefaultIfNoTestMatches()
      throws Exception {
    DecisionList dlist = new DecisionList("Yes", "No");
    DataSet ds = DataSetFactory.getRestaurantDataSet();

    DLTest test1 = new DLTest();
    test1.add("type", "Thai"); // doesn't match first example
    dlist.add(test1, "test1success");

    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)));
  }
View Full Code Here

Examples of aima.core.learning.inductive.DLTest

  @Test
  public void testDecisionListHandlesEmptyDataSet() throws Exception {
    // tests first base case of recursion
    DecisionList dlist = new DecisionList("Yes", "No");

    DLTest test1 = new DLTest();
    test1.add("type", "Thai"); // doesn't match first example
    dlist.add(test1, "test1success");
  }
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.