The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

"Get output ExampleSet error!"

hotaehotae Member Posts: 3 Contributor I
edited June 2019 in Help
Hi,
I want to import a csv file as a ExampleSet using CSVExampleSource, so I code sa:
RapidMiner.init();
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);
But I got the following error:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
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)
It seems nothing output by process.run();
Any one tell me how to do?
Thanks!
Tagged:

Answers

  • aborgaborg Member Posts: 66 Contributor II
    It seems you forget to connect the output to the Process' port. I guess after fixing that you will be ok.
  • hotaehotae Member Posts: 3 Contributor I
    aborg wrote:

    It seems you forget to connect the output to the Process' port. I guess after fixing that you will be ok.
    Could you give me a hint to set it? I don't know how to connect the output to the process's port

    Thank you!
  • aborgaborg Member Posts: 66 Contributor II
    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);
    }
  • hotaehotae Member Posts: 3 Contributor I
    It's works! Thanks!
Sign In or Register to comment.