Package aima.core.learning.framework

Examples of aima.core.learning.framework.DataSet


    DecisionTree tree = new DecisionTree(chosenAttribute);
    ConstantDecisonTree m = majorityValue(ds);

    List<String> values = ds.getPossibleAttributeValues(chosenAttribute);
    for (String v : values) {
      DataSet filtered = ds.matchingDataSet(chosenAttribute, v);
      List<String> newAttribs = Util.removeFrom(attributeNames,
          chosenAttribute);
      DecisionTree subTree = decisionTreeLearning(filtered, newAttribs, m);
      tree.addNode(v, subTree);
View Full Code Here


    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

    return list.mergeWith(decisionListLearning(test.unmatchedExamples(ds)));
  }

  private DLTest getValidTest(List<DLTest> possibleTests, DataSet ds) {
    for (DLTest test : possibleTests) {
      DataSet matched = test.matchedExamples(ds);
      if (!(matched.size() == 0)) {
        if (allExamplesHaveSameTargetValue(matched)) {
          return test;
        }
      }
View Full Code Here

    return true;
    // return e.targetValue().equals(targetValue);
  }

  public DataSet matchedExamples(DataSet ds) {
    DataSet matched = ds.emptyDataSet();
    for (Example e : ds.examples) {
      if (matches(e)) {
        matched.add(e);
      }
    }
    return matched;
  }
View Full Code Here

    }
    return matched;
  }

  public DataSet unmatchedExamples(DataSet ds) {
    DataSet unmatched = ds.emptyDataSet();
    for (Example e : ds.examples) {
      if (!(matches(e))) {
        unmatched.add(e);
      }
    }
    return unmatched;
  }
View Full Code Here

    DecisionTree tree = new DecisionTree(chosenAttribute);
    ConstantDecisonTree m = majorityValue(ds);

    List<String> values = ds.getPossibleAttributeValues(chosenAttribute);
    for (String v : values) {
      DataSet filtered = ds.matchingDataSet(chosenAttribute, v);
      List<String> newAttribs = Util.removeFrom(attributeNames,
          chosenAttribute);
      DecisionTree subTree = decisionTreeLearning(filtered, newAttribs, m);
      tree.addNode(v, subTree);
View Full Code Here

    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

    return list.mergeWith(decisionListLearning(test.unmatchedExamples(ds)));
  }

  private DLTest getValidTest(List<DLTest> possibleTests, DataSet ds) {
    for (DLTest test : possibleTests) {
      DataSet matched = test.matchedExamples(ds);
      if (!(matched.size() == 0)) {
        if (allExamplesHaveSameTargetValue(matched)) {
          return test;
        }
      }
View Full Code Here

    System.out.println(Util.ntimes("*", 100));
    System.out
        .println("\nDecisionTree Demo - Inducing a DecisionList from the Restaurant DataSet\n ");
    System.out.println(Util.ntimes("*", 100));
    try {
      DataSet ds = DataSetFactory.getRestaurantDataSet();
      DecisionTreeLearner learner = new DecisionTreeLearner();
      learner.train(ds);
      System.out.println("The Induced Decision Tree is ");
      System.out.println(learner.getDecisionTree());
      int[] result = learner.test(ds);
View Full Code Here

    try {
      System.out.println(Util.ntimes("*", 100));
      System.out
          .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());
View Full Code Here

TOP

Related Classes of aima.core.learning.framework.DataSet

Copyright © 2018 www.massapicom. 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.