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
RapidMiner/Netbeans problem.
Hi,
I am working on text classification project, I was trying to integrate the model I built in Rapidminer GUI but I have problems in the code which I couldn't solve to move on!
- I'm using rapid miner 5.3.015
- I added all rapid miner jars to the netbean project
- I am beginner user.
- here is my xml file:
Following the API documentation:
So, I couldn't figure where is the problem exactly!
Another trial following this thread: http://rapid-i.com/rapidforum/index.php/topic,3862.msg14364.html#msg14364
So, any idea how to solve this problem?
Thanks in advance
I am working on text classification project, I was trying to integrate the model I built in Rapidminer GUI but I have problems in the code which I couldn't solve to move on!
- I'm using rapid miner 5.3.015
- I added all rapid miner jars to the netbean project
- I am beginner user.
- here is my xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>and here is my initial trials:
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="text:process_document_from_file" compatibility="5.3.002" expanded="true" height="76" name="Process Documents from Files (3)" width="90" x="179" y="75">
<list key="text_directories">
<parameter key="Tourist" value="W:\NormalizedFiles\TouristAndTravel"/>
<parameter key="Science" value="W:\NormalizedFiles\Science"/>
</list>
<process expanded="true">
<operator activated="true" class="text:tokenize" compatibility="5.3.002" expanded="true" height="60" name="Tokenize (3)" width="90" x="45" y="30"/>
<operator activated="true" class="text:filter_stopwords_arabic" compatibility="5.3.002" expanded="true" height="60" name="Filter Stopwords (3)" width="90" x="180" y="30"/>
<operator activated="true" class="text:stem_arabic" compatibility="5.3.002" expanded="true" height="60" name="Stem (3)" width="90" x="409" y="30"/>
<connect from_port="document" to_op="Tokenize (3)" to_port="document"/>
<connect from_op="Tokenize (3)" from_port="document" to_op="Filter Stopwords (3)" to_port="document"/>
<connect from_op="Filter Stopwords (3)" from_port="document" to_op="Stem (3)" to_port="document"/>
<connect from_op="Stem (3)" from_port="document" to_port="document 1"/>
<portSpacing port="source_document" spacing="0"/>
<portSpacing port="sink_document 1" spacing="0"/>
<portSpacing port="sink_document 2" spacing="0"/>
</process>
</operator>
<operator activated="true" class="parallel:x_validation_parallel" compatibility="5.3.000" expanded="true" height="112" name="KNNValidation" width="90" x="449" y="30">
<process expanded="true">
<operator activated="true" class="k_nn" compatibility="5.3.015" expanded="true" height="76" name="k-NN" width="90" x="102" y="30"/>
<connect from_port="training" to_op="k-NN" to_port="training set"/>
<connect from_op="k-NN" from_port="model" to_port="model"/>
<portSpacing port="source_training" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
<portSpacing port="sink_through 1" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="apply_model" compatibility="5.3.015" expanded="true" height="76" name="Apply Model (2)" width="90" x="45" y="30">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance" compatibility="5.3.015" expanded="true" height="76" name="Performance (2)" width="90" x="187" y="30"/>
<connect from_port="model" to_op="Apply Model (2)" to_port="model"/>
<connect from_port="test set" to_op="Apply Model (2)" to_port="unlabelled data"/>
<connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance (2)" to_port="labelled data"/>
<connect from_op="Performance (2)" from_port="performance" to_port="averagable 1"/>
<portSpacing port="source_model" spacing="0"/>
<portSpacing port="source_test set" spacing="0"/>
<portSpacing port="source_through 1" spacing="0"/>
<portSpacing port="sink_averagable 1" spacing="0"/>
<portSpacing port="sink_averagable 2" spacing="0"/>
</process>
</operator>
<connect from_port="input 1" to_op="Process Documents from Files (3)" to_port="word list"/>
<connect from_op="Process Documents from Files (3)" from_port="example set" to_op="KNNValidation" to_port="training"/>
<connect from_op="KNNValidation" from_port="model" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Following the API documentation:
public static void main(String[] args) {In this code there is no editor errors but it showed me this error: com.rapidminer.parameter.UndefinedParameterError: A value for the parameter 'operatorName' must be specified!
try {
RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
RapidMiner.init();
Process process = new Process(new File("W:/RapidMinerRepository/textKNNClassifier.rmp"));
process.run();
} catch (IOException | XMLException | OperatorException ex) {
ex.printStackTrace();
}
}
So, I couldn't figure where is the problem exactly!
Another trial following this thread: http://rapid-i.com/rapidforum/index.php/topic,3862.msg14364.html#msg14364
public static void main(String[] args) throws MalformedRepositoryLocationException, RepositoryException {errors shown by netbean editor are for words creating Process object and calling run() method
// this initializes RapidMiner with your repositories available
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();
// loads the process from the repository
RepositoryLocation pLoc = new RepositoryLocation("W:/RapidMinerRepository/textKNNClassifier.rmp");
ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
String processXML = pEntry.retrieveXML();
Process myProcess = new Process(processXML); //error
// execute the process and get the resulting objects
IOContainer ioInput = new IOContainer(new IOObject[] {myIOObject});
myProcess.run(); //error
}
So, any idea how to solve this problem?
Thanks in advance
Tagged:
0
Answers
in the thread you mention, Marco has given you an example on how to load the process via the RepositoryLocation. In your third code block you are using it incorrectly since you are not referncing a repository entry (starting with "//"), but a file.
For the second code block it would make sense to paste the stack trace. Looks like the parameter "operatorName" is not set in the process, but that parameter does not follow naming conventions, so I suspect a copy paste problem.
Cheers,
Simon
a couple of things:
1) new RepositoryLocation("W:/RapidMinerRepository/textKNNClassifier.rmp"); will not work because a repository location is NOT your filesystem, but rather the internal RapidMiner repository. So it should look more like new RepositoryLocation("//Local Repository/textKNNCLassifier").
2) You probably imported java.lang.Process by accident instead of com.rapidminer.Process in your second example.
3) The error you posted is not complete so helping you there is a bit difficult, however most of the time it simply means you did not specifiy a mandatory parameter for one of the operators.
Regards,
Marco
- So, the first problem is with the path of the repository.
Do you mean it should be inside the workspace>java project?
Sorry but i need more explanation about the difference between "my filesystem" and "internal RapidMiner repository"
- I've double checked the imported lines, but It seems I imported com.rapidminer.Process not java.lang.Process.
- My main problem is how could I figure out what are the operator that I miss naming them or one of their parameters.
here is the code again with the error (I deleted couple of repeated lines since the post is limited to 20000 chars).
Thank you Simon & Marco
I appreciate your help.
Regards,
- When you start the RapidMiner GUI and use store processes or results, you will use a so called repository. The default one is called "Local Repository". These default one is simply located in a folder on your disk, however they can also come from RapidMiner Server etc. That is why RapidMiner Studio makes use of the repository, so no matter where the data is actually stored, there is only a single representation of the storage. You can ask the RepositoryManager class to get existing repositories or create new ones. To access a process called "My Process" in the subfolder "my folder" in your default repository, you would reference it like this: - You can add a breakpoint to the line where the UndefinedParameterError is thrown and check the stacktrace for the operator which caused it.
Regards,
Marco
The idea of repositories is clear, Thanks.
I tried to debug the code and I think (based on my understanding) the problem is with calling init() method.
line 98 in my code is: However, I tried to follow this example provided here: https://rapid-i.com/rapidforum/index.php?topic=2976.0
and the same error has shown again. So, what is the problem in this case? how to know exactly what is operator that I miss naming it?
Thanks,
I have never seen such an error when calling RapidMiner.init(). It looks like com.rapidminer.operator.preprocessing.ie.features.tools.RelationPreprocessOperatorImpl is the cause - however I don't know that class, where does it come from? It definetly is not a standard RapidMiner Studio operator.
Regards,
Marco
How to know from where this strange operator class come?
I don't know, you could try finding out the classloader for the class (i.e. if it is an extension classloader) and go from there..
Regards,
Marco