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
"Rapid miner with java"
I have the following process built in rapidminer using applymodel:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true" height="424" width="758">
<operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve TrainingData" width="90" x="112" y="75">
<parameter key="repository_entry" value="//Local Repository/data/TrainingData"/>
</operator>
<operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve UserInput" width="90" x="112" y="210">
<parameter key="repository_entry" value="//Local Repository/data/UserInput"/>
</operator>
<operator activated="true" class="default_model" compatibility="5.3.000" expanded="true" height="76" name="Default Model" width="90" x="313" y="75">
<parameter key="method" value="median"/>
<parameter key="constant" value="0.0"/>
<parameter key="attribute_name" value=""/>
</operator>
<operator activated="true" class="apply_model" compatibility="5.3.000" expanded="true" height="76" name="Apply Model" width="90" x="313" y="210">
<list key="application_parameters"/>
<parameter key="create_view" value="false"/>
</operator>
<connect from_op="Retrieve TrainingData" from_port="output" to_op="Default Model" to_port="training set"/>
<connect from_op="Retrieve UserInput" from_port="output" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Default Model" from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_op="Apply Model" from_port="labelled data" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
I want to use this process in java.Below is the code :
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();
try {
File processFile = new File("\\Local Repository\processes\TrainingDataProcess.rmp");
Process process = new Process(processFile);
IOContainer ioResult = process.run();
if (ioResult.getElementAt(0) instanceof ExampleSet) {
ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
System.out.println("Success readresultSet: "+resultSet);
}
} catch (Exception e) {
RapidMiner.quit(RapidMiner.ExitMode.ERROR);
when I run the program, get back the header information but not the actual result set. am I missing something. Thank you for the help in advance
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true" height="424" width="758">
<operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve TrainingData" width="90" x="112" y="75">
<parameter key="repository_entry" value="//Local Repository/data/TrainingData"/>
</operator>
<operator activated="true" class="retrieve" compatibility="5.3.000" expanded="true" height="60" name="Retrieve UserInput" width="90" x="112" y="210">
<parameter key="repository_entry" value="//Local Repository/data/UserInput"/>
</operator>
<operator activated="true" class="default_model" compatibility="5.3.000" expanded="true" height="76" name="Default Model" width="90" x="313" y="75">
<parameter key="method" value="median"/>
<parameter key="constant" value="0.0"/>
<parameter key="attribute_name" value=""/>
</operator>
<operator activated="true" class="apply_model" compatibility="5.3.000" expanded="true" height="76" name="Apply Model" width="90" x="313" y="210">
<list key="application_parameters"/>
<parameter key="create_view" value="false"/>
</operator>
<connect from_op="Retrieve TrainingData" from_port="output" to_op="Default Model" to_port="training set"/>
<connect from_op="Retrieve UserInput" from_port="output" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Default Model" from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_op="Apply Model" from_port="labelled data" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
I want to use this process in java.Below is the code :
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();
try {
File processFile = new File("\\Local Repository\processes\TrainingDataProcess.rmp");
Process process = new Process(processFile);
IOContainer ioResult = process.run();
if (ioResult.getElementAt(0) instanceof ExampleSet) {
ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
System.out.println("Success readresultSet: "+resultSet);
}
} catch (Exception e) {
RapidMiner.quit(RapidMiner.ExitMode.ERROR);
when I run the program, get back the header information but not the actual result set. am I missing something. Thank you for the help in advance
0
Answers
' if I tried doing ExampleSet es = (ExampleSet) ioResult.getElementAt(1);
Any help is appreciated.
So if you have it, this message gives an example how to iterate through it.
you can only retrieve the number of result IOObjects your process delivers. In the process you posted there is only one connection to a process result port (bubble on the right side of the canvas). Therefore your IOContainer only contains one item. Regards,
Marco