Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
"Rapid miner with java"
learner
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
Find more posts tagged with
AI Studio
Java
Developer
Accepted answers
All comments
aborg
Maybe
this thread
will help?
learner
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.
aborg
Do you have two outputs? The getElementAt using 0-based indexing. To go through the table you should use the iterator of the exampleset.
learner
Cpuld u please give an example, of how to get ExampleSet from the process and iterate through it.
aborg
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.
Marco_Boeck
Hi,
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.
ioResult.getElementAt(0);
Regards,
Marco
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups