properties.put(
BuildClassifierActivity.CLASSIFIER_CLASS_NAME,
"weka.classifiers.trees.M5P");
activity.configureActivity(properties);
MockInputPipe dataInput = new MockInputPipe(table.toArray());
activity.addInput(BuildClassifierActivity.INPUT_DATA, dataInput);
MockInputPipe classIndexInput = new MockInputPipe(new Object[] {0});
activity.addInput(BuildClassifierActivity.INPUT_CLASS_INDEX, classIndexInput);
MockInputPipe optionsInput = new MockInputPipe(new Object[] {" "});
activity.addInput(BuildClassifierActivity.INPUT_OPTIONS, optionsInput);
MockInputPipe nominalColumnsInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
ControlBlock.LIST_END
});
activity.addInput(BuildClassifierActivity.INPUT_COLUMN_INDICES, nominalColumnsInput);
MockInputPipe nominalValuesInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN,
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);
ClassifyActivity classify = new ClassifyActivity();
MockInputPipe inputClassifier = new MockInputPipe(classifier);
classify.addInput(ClassifyActivity.INPUT_CLASSIFIER, inputClassifier);
MockInputPipe inputData = new MockInputPipe(table.toArray());
classify.addInput(ClassifyActivity.INPUT_DATA, inputData);
MockOutputPipe outputClassify = new MockOutputPipe(new Object[] {});
classify.addOutput(ClassifyActivity.OUTPUT, outputClassify);
classify.process();