public AdaptiveMartiBoost(String trainData, String holdoutData, int levels) throws Exception { this.numLevels = levels; Instances trainInstances = WekaUtil.getInstances(trainData); Instances holdoutInstances = WekaUtil.getInstances(holdoutData); AdaptiveMartiNodeFactory.setInstances(trainInstances); rootLevel = new AdaptiveMartiLevel(0); rootLevel.addNode(new AdaptiveMartiNode(trainInstances, holdoutInstances, rootLevel, 0)); // rootLevel.build(); // root.display(); gb_matrix = new ConfusionMatrix(); LOGGER.log(Level.INFO, "Initial global conf matrix :"); gb_matrix.display(); }
public void evaluateTestData(String testFile) throws Exception { rootLevel.getNodes().get(0).getInData().setTestInstances(WekaUtil.getInstances(testFile)); AdaptiveMartiLevel currentLevel = rootLevel; while (currentLevel.getLevelNumber() < numLevels) { System.out.println("Level " + currentLevel.getLevelNumber()); if (currentLevel.getLevelNumber() == numLevels - 1) currentLevel.setFinalLevel(true); currentLevel.classifyRouteTestInstances(gb_matrix); currentLevel = currentLevel.getNextLevel(); } gb_matrix.display(); }