"Get output ExampleSet error!"
hotae
New Altair Community Member
Hi,
I want to import a csv file as a ExampleSet using CSVExampleSource, so I code sa:
Any one tell me how to do?
Thanks!
I want to import a csv file as a ExampleSet using CSVExampleSource, so I code sa:
RapidMiner.init();But I got the following error:
Operator trainingDataReader = OperatorService.createOperator(CSVExampleSource.class);
trainingDataReader.setParameter(CSVExampleSource.PARAMETER_CSV_FILE, "C:/Documents and Settings/tmd/data/data_forPrediction.csv");
trainingDataReader.setParameter(CSVExampleSource.PARAMETER_COLUMN_SEPARATORS, "\t");
trainingDataReader.setParameter(CSVExampleSource.PARAMETER_TRIM_LINES, "true");
trainingDataReader.setParameter(CSVExampleSource.PARAMETER_FIRST_ROW_AS_NAMES, "true");
Process process = new Process();
//add operators to process
process.getRootOperator().getSubprocess(0).addOperator(trainingDataReader);
IOContainer ioResult = process.run();
ExampleSet exampleSet = (ExampleSet) ioResult.getElementAt(0);
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0It seems nothing output by process.run();
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at com.rapidminer.operator.IOContainer.getElementAt(IOContainer.java:112)
Any one tell me how to do?
Thanks!
0
Answers
-
It seems you forget to connect the output to the Process' port. I guess after fixing that you will be ok.0
-
Could you give me a hint to set it? I don't know how to connect the output to the process's portaborg wrote:
It seems you forget to connect the output to the Process' port. I guess after fixing that you will be ok.
Thank you!0 -
Sorry, I have no out ot the box working example. Something along the following lines might help (not tested):
final ProcessRootOperator rootOp = process.getRootOperator();
final ExecutionUnit executionUnit = rootOp.getSubprocess(0);
int i = 0;
for (final OutputPort outPort : newOp.getOutputPorts().getAllPorts()) {
final InputPort inputPort = executionUnit.getInnerSinks().getPortByIndex(i++);
outPort.connectTo(inputPort);
}0 -
It's works! Thanks!0