BuildClassifierActivity.CLASSIFIER_CLASS_NAME,
"weka.classifiers.trees.J48");
activity.configureActivity(properties);
List<Object> input = buildInputTable();
MockInputPipe dataInput = new MockInputPipe(input.toArray());
activity.addInput(BuildClassifierActivity.INPUT_DATA, dataInput);
MockInputPipe classIndexInput = new MockInputPipe("play");
activity.addInput(BuildClassifierActivity.INPUT_CLASS_INDEX, classIndexInput);
MockInputPipe nominalColumnsInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
"outlook", "windy", "play",
ControlBlock.LIST_END
});
activity.addInput(BuildClassifierActivity.INPUT_COLUMN_INDICES, nominalColumnsInput);
MockInputPipe nominalValuesInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
ControlBlock.LIST_BEGIN, "sunny", "overcast", "rain", ControlBlock.LIST_END,
ControlBlock.LIST_BEGIN, "true", "false", ControlBlock.LIST_END,
ControlBlock.LIST_BEGIN, "yes", "no", ControlBlock.LIST_END,
ControlBlock.LIST_END
});
activity.addInput(BuildClassifierActivity.INPUT_NOMINAL_VALUES, nominalValuesInput);
MockOutputPipe output = new MockOutputPipe(new Object[] {});
activity.addOutput(BuildClassifierActivity.CLASSIFIER_OUTPUT, output);
activity.process();
TupleClassifier classifier = (TupleClassifier)output.getActualBlocks().get(0);
// System.out.println(classifier);
ClassifyActivity classify = new ClassifyActivity();
MockInputPipe inputClassifier = new MockInputPipe(classifier);
classify.addInput(ClassifyActivity.INPUT_CLASSIFIER, inputClassifier);
MockInputPipe inputData = new MockInputPipe(buildInputTable().toArray());
classify.addInput(ClassifyActivity.INPUT_DATA, inputData);
MockInputPipe inputResultColumnName = new MockInputPipe("myResult");
classify.addInput(ClassifyActivity.INPUT_RESULT_COLUMN_NAME, inputResultColumnName);
MockOutputPipe outputClassify = new MockOutputPipe(new Object[] {});
classify.addOutput(ClassifyActivity.OUTPUT, outputClassify);
classify.process();