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
"Simple java program"
I have tried to code a simple java program that read a csv file, create a naive bayes model and save the output model. But the compiler give me this error:
com.rapidminer.operator.OperatorCreationException: No operator description object given for 'com.rapidminer.operator.io.CSVDataReader'
at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:583)
at rapidProcess.exampleProcess.main(exampleProcess.java:24)
But in the API the CSVDataReader is included in com.rapidminer.operator.io so I don't understand the error.
This is the very simple code. Thanks in advance.
com.rapidminer.operator.OperatorCreationException: No operator description object given for 'com.rapidminer.operator.io.CSVDataReader'
at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:583)
at rapidProcess.exampleProcess.main(exampleProcess.java:24)
But in the API the CSVDataReader is included in com.rapidminer.operator.io so I don't understand the error.
This is the very simple code. Thanks in advance.
package rapidProcess;
import com.rapidminer.RapidMiner;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorCreationException;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.io.CSVDataReader;
import com.rapidminer.operator.io.ModelWriter;
import com.rapidminer.operator.learner.bayes.NaiveBayes;
import com.rapidminer.tools.OperatorService;
import com.rapidminer.Process;
public class exampleProcess {
/**
* @param args
*/
public static void main(String[] args) {
RapidMiner.init();
try {
/* Reading Data */
Operator trainingDataReader = OperatorService.createOperator(CSVDataReader.class);
trainingDataReader.setParameter("csv_file", "train.csv");
/* Classifier */
Operator bayesClassifier = OperatorService.createOperator(NaiveBayes.class);
/* Save model */
Operator modelWriter = OperatorService.createOperator(ModelWriter.class);
modelWriter.setParameter("model_file", "prova_model");
trainingDataReader.getOutputPorts().getPortByName("output").connectTo(bayesClassifier.getInputPorts().getPortByName("training set"));
bayesClassifier.getOutputPorts().getPortByName("model").connectTo(modelWriter.getInputPorts().getPortByName("input"));
Process process = new Process();
process.getRootOperator().getSubprocess(0).addOperator(bayesClassifier);
process.run();
} catch (OperatorCreationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Tagged:
0
Answers
I experienced a similar problem some weeks ago. My own program was working fine until some update to the RapidMiner core was released. I posted this information here: http://rapid-i.com/rapidforum/index.php/topic,294.msg13414.html#msg13414
But until now the problem was not fixed, I just noticed this when testing my program again after reading your post. I would also appreciate any other solution than switching back to the old revision.
Best regards
Matthias
the CSVDataReader has (currently) been replaced with the CSVExampleSource class. So you'll need to use this code fragment: Regards,
Marco
can you provide a similar solution as simple as that for the "Get Page" operator (see http://rapid-i.com/rapidforum/index.php/topic,294.msg13414.html#msg13414)? I thought this error was raised by some unwanted modifications (that's why I just posted this as a remark in the linked topic) but I assume you renamed some classes, as your reply indicates. But I could not find anything suitable for the problem in my case. Any ideas?
Best regards
Matthias
when you init RapidMiner you have to set an ExecutionMode. Depending on this ExecutionMode, certain things are not available. I suggest using this to init RapidMiner if you need to work with plugin operators: So much for the quick&dirty fix. However other ExecutionMode settings should work as well, so maybe there are some settings which one needs to know about.. I will have to ask around for this though..
Regards,
Marco
thanks for picking this up.
I tried different execution modes without any effect (didn't notice differences between UI, COMMAND_LINE or the EMBEDDED ones for my simple test program). Before updating to revision 313 everything worked fine (as reported in the linked topic), and when switching back to 312 it still does. I took a short look at the code changes but am not familiar enough with the classes to identify the critical change. It would be great if you could figure this out someday
In order to get the plugin operators working I had to point to a directory where I placed a copy of the jar libraries. I don't know if it's possible to use the libs contained in the RM lib folder, but I didn't manage to use them by default. So I played around with the initialization properties I found in the wiki until it worked: But don't ask me if this all makes sense
Best regards
Matthias
I poked around a bit: setting the ExecutionMode to COMMAND_LINE should work. Using for example EMBEDDED_WITHOUT_UI will not work for plugin operators because otherwise RapidMiner would want to install them which would make no sense. However you can place the plugin jar files in the lib/plugin directory, then it should work.
Regards,
Marco
thanks for this update. I am currently moving away from generating operators from Java code and using predefined general processes instead. As you are recently posting in some other topics, creating a whole process via the API is not that comfortable at all.
Since I don't need dynamically built processes but just have to cover some fixed application patterns, I am fine with predefined XML declarations. Otherwise, I will play Phil's "Going Back" album while switching back to the old revision for now.
The only thing I did not test until now is how to connect two or more of those process patterns. I have to connect data collection with data analysis for example. For both tasks exist pools of 3-5 possible process patterns (processes completly designed with the GUI). After connecting them the only task remaining will be setting specific parameters for the relevant operators from Java, which should not cause so much troubles. If you have some hints on how to possibly connect multiple process files into one, I would be glad. If this is not possible with reasonable efforts, I will probably need to keep them as mutliple processes and define a data flow between them.
Best regards
Matthias
1) I had to update my previous post.
2) You can create the individual processes in RapidMiner, and then create a main process to execute them one after another via the Execute Process operator. You just need to connect the input/output ports accordingly. That way, you can just execute the main process which in return executes the specified sub processes.
Regards,
Marco
it seems I won't get the process working again I changed the ExecutionMode and tried possible variations of the system properties. Without any success. I removed all of the other operators except "Get Page" and still receive the same error message.
This is the entire code I am using: I don't know if something else is wrong, but it was working in the older revision without any problems...
Thank you for the simple solution of combining multiple process files by a new process using "Execute Process". This easiest way did not come to my mind... But there seems to be a major limitation for this solution. I will certainly not be able to set parameters for the operators from the embedded processes. But this is an important step before executing the comined process. Do you have any suggestions on this?
Best regards
Matthias
Edit: After thinking the whole thing over again, I assume it might become a bit untidy, but it would be a simple approach to use the suggested master process combining all process parts by using "Execute Process" operatores and set the parameters via macros. After setting the relevant parameters with some predefined macro names I will just have to deliver them with their values to the several process executions. Thanks again for providing this simple solution.
do you have the web plugin jar in the appropriate folder (aka lib/plugins)? Otherwise RapidMiner will not be able to find it.
Regards,
Marco
omg - this was one thing I did not try. I tried to make the program use the RapidMiner lib files (RapidMiner_Vega\lib\plugins) or simply include the extension projects on the build path without success. The reference to RapidMiner worked fine, but the extensions had to be included via the respective jar files. Then I found the property rapidminer.init.plugins.location and specified the path to the lib files, that I copied from the above location to a local folder for my eclipse project. Then the extensions were found and everything worked. Then revision 313 was released and the program did not work anymore (without changing it in the meantime).
Now I moved the lib files from the local folder in my process from lib (as it was referenced in the example code above) to lib/plugins and suddenly everything is working again. The specified path for the plugin location using the property rapidminer.init.plugins.location seems to be ignored since 313 and the fixed location lib/plugins is used instead!? This idea would never have come to my mind. Is this some default location for Java projects that I missed all the time or was the choice of a different location removed with revision 313? However, the easier the solution the longer you have to search for it... Thanks a lot.
But perhaps you should investigate why this behaviour suddenly changed and if it was really intended...
Many thanks and best regards
Matthias
I have to init RapidMiner using RapidMiner.init() in order to query the predefined database connection names. This always takes some seconds, so I tried to speed this up by disabling the extensions (and all of the exceptions thrown for IE plugin during initialization). I tried the following: without any success. Did the properties names change? I didn't check if setting the lib path is working again, but actually I don't think so...
Regards
Matthias
it's not a System property, it's a RapidMiner parameter.
You may want to have a look at the ParameterService class: This fragment is called by RapidMiner to know if plugins should be initialized.
Regards,
Marco
thank you, I will have a look at it.
The wiki says And things worked this way before the mentioned revision was released. If this isn't possible any longer, you should perhaps update the wiki page ( http://rapid-i.com/wiki/index.php?title=Integrating_RapidMiner_into_your_application ).
Update:
Setting the property doesn't seem to change anything. I tried with true and false, and the result is the same. All these exceptions (see below) from my beloved IE plugin shouldn't show up, if plugins are not initialized, right? Regards
Matthias
After a quick glance at the init() method, it seems like RapidMiner will override any parameters you set prior to init() with the settings from the settings file. So you will need to either set the property "rapidminer.init.plugins=false" in the config file found in the .RapidMiner5 folder (located in the user folder), or you could try and call This should load all settings first, then you can edit them, and then you can init RM.
Regards,
Marco
Thanks a lot, this works fine.
Best regards
Matthias