Integrating Rapidminer in my web application
Nitasha
New Altair Community Member
Hello,
I am creating a small web application that provides recommendation using RapidMiner as a data mining engine. I added all the jars provided in the lib directory of RapidMiner 4.2 in my project.
I don't need all the operators so I reduced the number of operators, and created a myoperator.xml file.
Now, when I try to initialize the Rapidminer using myoperator.xml file, Rapidminer loads the default operator.xml.
Also, what is rapidminerrc file and why does rapidminer looks for it in my home directory. Do I need this file in my project?
Please help.
thanks,
Nitasha
I am creating a small web application that provides recommendation using RapidMiner as a data mining engine. I added all the jars provided in the lib directory of RapidMiner 4.2 in my project.
I don't need all the operators so I reduced the number of operators, and created a myoperator.xml file.
Now, when I try to initialize the Rapidminer using myoperator.xml file, Rapidminer loads the default operator.xml.
Also, what is rapidminerrc file and why does rapidminer looks for it in my home directory. Do I need this file in my project?
Please help.
thanks,
Nitasha
0
Answers
-
Hi,
Please send the code snippet for the initialization, a description of your project setup (which libraries are used where), and the used RapidMiner version. Then we will certainly be able to help.
I don't need all the operators so I reduced the number of operators, and created a myoperator.xml file.
Now, when I try to initialize the Rapidminer using myoperator.xml file, Rapidminer loads the default operator.xml.
The rc files are general setup files containing system wide settings for the properties which you can set in the "Tools" - "Properties" dialogs. You will probably not need them in your project if the default settings are fine.
Also, what is rapidminerrc file and why does rapidminer looks for it in my home directory. Do I need this file in my project?
Cheers,
Ingo0 -
Hi Ingo,
Thanks, for the reply.
Following are the details:
RapidMiner Version: 4.2
All the Lib files from RapidMiner except Weka are added in the my Web-App under WEB-INF/lib directory
Code Snippet for RapidMiner Initialization
final InputStream operatorsXMLStream = RapidMinerSetup.class.getResourceAsStream("/myoperators.xml");
RapidMiner.init(operatorsXMLStream,true,false, true,true);
Following is the output I get
G Jul 31, 2008 11:08:16 AM: Property rapidminer.home is not set. Guessing.
G Jul 31, 2008 11:08:16 AM: Trying base directory of classes (build) '/Users/nitasha/Documents/workspace/MyApp/target'...gotcha!
G Jul 31, 2008 11:08:16 AM: ----------------------------------------------------
G Jul 31, 2008 11:08:16 AM: Initialization Settings
G Jul 31, 2008 11:08:16 AM: ----------------------------------------------------
G Jul 31, 2008 11:08:16 AM: Default system encoding for IO: UTF-8
G Jul 31, 2008 11:08:16 AM: Load specific operators...
G Jul 31, 2008 11:08:16 AM: Load Weka operators: weka not found
G Jul 31, 2008 11:08:16 AM: Load JDBC drivers from lib directory: false
G Jul 31, 2008 11:08:16 AM: Load JDBC drivers from classpath: true
G Jul 31, 2008 11:08:16 AM: Load plugins: true
G Jul 31, 2008 11:08:16 AM: Load plugins from '/Users/nitasha/Documents/workspace/MyApp/target/lib/plugins'
G Jul 31, 2008 11:08:16 AM: ----------------------------------------------------
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/Documents/workspace/MyApp/target/etc/rapidminerrc'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/Documents/workspace/MyApp/target/etc/rapidminerrc.Mac OS X'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/.rapidminer/4_2_0_rapidminerrc'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/.rapidminer/4_2_0_rapidminerrc.Mac OS X'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/Documents/workspace/MyApp/rapidminerrc'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rcfile '/Users/nitasha/Documents/workspace/MyApp/rapidminerrc.Mac OS X'...skipped
G Jul 31, 2008 11:08:16 AM: Trying rapidminer.rcfile. Property not specified...skipped
G Jul 31, 2008 11:08:16 AM: Loading operators from 'operators.xml'.
G Jul 31, 2008 11:08:31 AM: Loading JDBC driver information from 'resources:jdbc_properties.xml'
As seen in the second last line, it loads the operators.xml file instead of myoperators.xml
Thanks,
Nitasha
0 -
Hi Nitasha,
this is what I have done:
and it perfectly works. No other operators than the OperatorChain was available after this initialization. Please note, however, that RM always states
String myOperatorsString = "<operators name=\"myOperators\"><operator name=\"OperatorChain\" class=\"com.rapidminer.operator.SimpleOperatorChain\" /></operators>";
ByteArrayInputStream operatorsIn = new ByteArrayInputStream(myOperatorsString.getBytes());
RapidMiner.init(operatorsIn, false, false, false, false);
even for user specfied streams. So probably it also worked for you already ;D
G Jul 31, 2008 11:08:16 AM: Loading operators from 'operators.xml'.
Cheers,
Ingo
0 -
Hi,
Thanks ingo... Indeed it does work.
However now I face a different problem. I added a new operator in my project, and passed an additionalXmlstream to RapidMiner initialization.
I added my operator as shown below:
<operators>
<!-- My own Operators -->
<operator
name = "RMDatabaseOperator"
class = "com.myapps.rapidminer.RMDatabaseOperator"
description = "Uses DataSource to connect to the Database."
group = "Myops"/>
</operators>
RMDatabaseOperator extends ResultSetExampleSource, and then wrote the methods to do the connection and database query.
Default constructor looks like this:
public RMDatabaseOperator(final OperatorDescription description) {
super(description);
}
Code snippet of my main class ProcessCreator:
final InputStream additionalOperatorsXMLStream = RapidMinerSetup.class.getResourceAsStream("/operators1.xml");
RapidMiner.init(null, additionalOperatorsXMLStream, null, true, false, true, true);
//creating operator
final Operator DbOperator = OperatorService.createOperator(RMDatabaseOperator.class);
Following is the Exception:
com.rapidminer.operator.OperatorCreationException: No operator description object given for 'com.myapps.rapidminer.RMDatabaseOperator'
at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:565)
at com.myapps.rapidminer.ProcessCreator.createProcess(ProcessCreator.java:15)
at com.myapps.rapidminer.ProcessCreator.main(ProcessCreator.java:31)
P Jul 31, 2008 2:23:29 PM: Initialising process setup
P Jul 31, 2008 2:23:29 PM: [NOTE] No filename given for result file, using stdout for logging results!
P Jul 31, 2008 2:23:29 PM: Checking properties...
P Jul 31, 2008 2:23:29 PM: Properties are ok.
P Jul 31, 2008 2:23:29 PM: Checking process setup...
P Jul 31, 2008 2:23:29 PM: Inner operators are ok.
P Jul 31, 2008 2:23:29 PM: Checking i/o classes...
P Jul 31, 2008 2:23:29 PM: i/o classes are ok.
P Jul 31, 2008 2:23:29 PM: Process ok.
P Jul 31, 2008 2:23:29 PM: Process initialised
P Jul 31, 2008 2:23:29 PM: [NOTE] Process starts
P Jul 31, 2008 2:23:29 PM: Process:
Root[0] (Process)
P Jul 31, 2008 2:23:29 PM: [NOTE] Process finished after 0 seconds
P Jul 31, 2008 2:23:29 PM: Process:
Root[1] (Process)
P Jul 31, 2008 2:23:29 PM: Produced output:
IOContainer (0 objects):
P Jul 31, 2008 2:23:29 PM: [NOTE] Process finished successfully
Could you please help?
Thanks,
Nitasha
0 -
Hi,
does this also happen for
? It could be a class loader problem.
final Operator DbOperator = OperatorService.createOperator("RMDatabaseOperator");
Cheers,
Ingo0