Package org.apache.mahout.classifier.df.data

Examples of org.apache.mahout.classifier.df.data.Data


    Data[] datas = generateTrainingDataA();
    // Build Forest
    DecisionForest forest = buildForest(datas);
    // Test data
    Dataset dataset = datas[0].getDataset();
    Data testData = DataLoader.loadData(dataset, TEST_DATA);

    double noValue = dataset.valueOf(4, "no");
    double yesValue = dataset.valueOf(4, "yes");
    assertEquals(noValue, forest.classify(testData.getDataset(), rng, testData.get(0)), EPSILON);
    // This one is tie-broken -- 1 is OK too
    //assertEquals(yesValue, forest.classify(testData.getDataset(), rng, testData.get(1)), EPSILON);
    assertEquals(noValue, forest.classify(testData.getDataset(), rng, testData.get(2)), EPSILON);
  }
View Full Code Here


    for (int i = 0; i < data.size(); i++) {
      if (data.get(i).get(0) != 0.0d) {
        instances.add(data.get(i));
      }
    }
    Data lessData = new Data(data.getDataset(), instances);
   
    // build tree
    DecisionTreeBuilder builder = new DecisionTreeBuilder();
    builder.setM(data.getDataset().nbAttributes() - 1);
    builder.setMinSplitNum(0);
View Full Code Here

    Data[] datas = generateTrainingDataA();
    // Build Forest
    DecisionForest forest = buildForest(datas);
    // Test data
    Dataset dataset = datas[0].getDataset();
    Data testData = DataLoader.loadData(dataset, TEST_DATA);

    double[][] predictions = new double[testData.size()][];
    forest.classify(testData, predictions);
    double noValue = dataset.valueOf(4, "no");
    double yesValue = dataset.valueOf(4, "yes");
    assertArrayEquals(new double[][]{{noValue, Double.NaN, Double.NaN},
        {noValue, yesValue, Double.NaN}, {noValue, noValue, Double.NaN}}, predictions);
View Full Code Here

            "|   humidity >= 77.5 : no").equals(visualization));
  }
 
  @Test
  public void testEmpty() throws Exception {
    Data emptyData = new Data(data.getDataset());
   
    // build tree
    DecisionTreeBuilder builder = new DecisionTreeBuilder();
    Node tree = builder.build(rng, emptyData);
View Full Code Here

TOP

Related Classes of org.apache.mahout.classifier.df.data.Data

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.