BuildClassifierMultiInputActivity.CLASSIFIER_CLASS_NAME,
"weka.classifiers.trees.J48");
activity.configureActivity(properties);
List<Object> input = buildInputTable();
MockInputPipe dataInput = new MockInputPipe(input.toArray());
activity.addInput(BuildClassifierMultiInputActivity.INPUT_DATA, dataInput);
MockInputPipe classIndexInput = new MockInputPipe(new Object[] {4});
activity.addInput(BuildClassifierMultiInputActivity.INPUT_CLASS_INDEX, classIndexInput);
MockInputPipe nominalColumnsInput = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN, "outlook", "windy", "play", ControlBlock.LIST_END });
activity.addInput(BuildClassifierMultiInputActivity.INPUT_COLUMN_INDICES, nominalColumnsInput);
MockInputPipe nominalValuesInput0 = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN, "sunny", "overcast", "rain", ControlBlock.LIST_END
});
MockInputPipe nominalValuesInput1 = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN, "true", "false", ControlBlock.LIST_END
});
MockInputPipe nominalValuesInput4 = new MockInputPipe(new Object[] {
ControlBlock.LIST_BEGIN, "yes", "no", ControlBlock.LIST_END
});
activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput0);
activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput1);
activity.addInput(BuildClassifierMultiInputActivity.INPUT_NOMINAL_VALUES, nominalValuesInput4);
MockOutputPipe output = new MockOutputPipe(new Object[] {});
activity.addOutput(BuildClassifierMultiInputActivity.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);
MockOutputPipe outputClassify = new MockOutputPipe(new Object[] {});
classify.addOutput(ClassifyActivity.OUTPUT, outputClassify);
classify.process();