"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
Find more posts tagged with
Sort by:
1 - 6 of
61

Maybe this thread will help?
Thank you for the help. But Still doesnt work. when I run the process in Rapidminer, I get back 4 records. But when I run in java see only header information also says ' java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
' if I tried doing ExampleSet es = (ExampleSet) ioResult.getElementAt(1);
Any help is appreciated.
' if I tried doing ExampleSet es = (ExampleSet) ioResult.getElementAt(1);
Any help is appreciated.
I thought you already had the ExampleSet. (You mentioned only the header was printed.)
So if you have it, this message gives an example how to iterate through it.
So if you have it, this message gives an example how to iterate through it.