Package aima.core.learning.inductive

Examples of aima.core.learning.inductive.ConstantDecisonTree


   */
  @Override
  public void train(DataSet ds) {
    List<String> attributes = ds.getNonTargetAttributes();
    this.tree = decisionTreeLearning(ds, attributes,
        new ConstantDecisonTree(defaultValue));
  }
View Full Code Here


      List<String> attributeNames, ConstantDecisonTree defaultTree) {
    if (ds.size() == 0) {
      return defaultTree;
    }
    if (allExamplesHaveSameClassification(ds)) {
      return new ConstantDecisonTree(ds.getExample(0).targetValue());
    }
    if (attributeNames.size() == 0) {
      return majorityValue(ds);
    }
    String chosenAttribute = chooseAttribute(ds, attributeNames);

    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,
View Full Code Here

  }

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

  }

  public void train(DataSet ds) {
    List<String> attributes = ds.getNonTargetAttributes();
    this.tree = decisionTreeLearning(ds, attributes,
        new ConstantDecisonTree(defaultValue));
  }
View Full Code Here

      List<String> attributeNames, ConstantDecisonTree defaultTree) {
    if (ds.size() == 0) {
      return defaultTree;
    }
    if (allExamplesHaveSameClassification(ds)) {
      return new ConstantDecisonTree(ds.getExample(0).targetValue());
    }
    if (attributeNames.size() == 0) {
      return majorityValue(ds);
    }
    String chosenAttribute = chooseAttribute(ds, attributeNames);

    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,
View Full Code Here

  }

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

TOP

Related Classes of aima.core.learning.inductive.ConstantDecisonTree

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.