Pages: [1]
  Print  
Author Topic: Problem: Extending Rapidminer (a new operator)  (Read 647 times)
Q-Dog
Newbie
*
Posts: 32


« on: January 05, 2012, 06:33:21 PM »

Hi folks,

first of all thanks a lot for such a great piece of software!

Unfortunately, I've got a bit of a problem extending RapidMiner, more precisely the first example from the tutorial (ExampleSetWriter).

What I've done so far:
- Checked out the project RapidMiner_Vega with Eclipse
- Added a new package and class: ExampleSetWriter in my.new.operators (just like written in the tutorial)
- created a .xml file called operators.xml (just like written in the tutorial)
- Added "-Drapidminer.operators.additional=resources/com/rapidminer/resources/operators.xml" in the VM arguments (the operators.xml is located in ...\workspace\RapidMiner_Vega\resources\com\rapidminer\resources\operators.xml)
- Started the RapidMinerGUI

But I just can't find the new operator.

What did I do wrong?

Thanks in advance,
Cheers Q-Dog
Logged
Marco Boeck
Administrator
Sr. Member
*****
Posts: 264


WWW
« Reply #1 on: January 11, 2012, 03:29:53 PM »

Hi,

it seems you've mixed something up Wink
You seem to have modified the original RapidMiner source instead of creating a plugin for RapidMiner.
If you want to add functionality to RapidMiner, you can do so by either adding the operator directly in the RapidMiner sourcode - but these additions are only for your personal use as you can never share your additions with anyone because you've modified the original RapidMiner files.
The second way (described in the "How to extend RapidMiner 5.0" white paper, use the pre-created tutorial project) is to create a new java project via Eclipse, and add it to RapidMiner as an extension (extension_xyz.jar). This can be shared with anyone, so the new stuff you create is not limited to your personal use.
If you have any specific questions or problems concerning the aforementioned white paper, feel free to ask Smiley

Regards,
Marco
« Last Edit: January 11, 2012, 03:31:42 PM by Marco Boeck » Logged

Did you try our new Marketplace? Upload or download new Extensions, add comments, and organize your operators. Have a look at  http://marketplace.rapid-i.com
Q-Dog
Newbie
*
Posts: 32


« Reply #2 on: January 18, 2012, 07:20:21 PM »

Yes, this is what I meant indeed.

I also tried to write a simple .jar plugin and put it into the lib/plugins directory. In RapidMiner 4.6 it worked like a charm, but unfortunately not in RapidMiner 5.1.
Has there been a change in creating a plugin?

Again, what I did:
- Create the ExampleSetWriter.java from the tutorial
Code:
package com.rapidminer.operator.my;

import com.rapidminer.example.*;
import com.rapidminer.operator .*;
import com.rapidminer.parameter.*;
import java.io.*;
import java.util.List ;

public class ExampleSetWriter extends Operator {

public ExampleSetWriter(OperatorDescription description) {
super(description);
}

@Override
public IOObject[] apply() throws OperatorException {
File file = getParameterAsFile("example_set_file");
ExampleSet eSet = getInput(ExampleSet.class);
try {
PrintWriter out = new PrintWriter(new FileWriter(file));
for (Example example : eSet) {
out.println(example);
}
out.close();
} catch (IOException e) {
throw new UserError(this, 303, file, e.getMessage());
}
return new IOObject[] {eSet};
}

@Override
public Class<?>[] getInputClasses() {
return new Class[] {ExampleSet.class};
}

@Override
public Class<?>[] getOutputClasses() {
return new Class[] {ExampleSet.class};
}

@Override
public List<ParameterType> getParameterTypes() {
List<ParameterType> types = super.getParameterTypes();
types.add(new ParameterTypeFile("example_set_file", "The file for the examples", "txt", false));
return types;
}


}
- Create the operator.xml from the tutorial
Code:
<operators>

<!-- Your own Operator -->
<operator
name = "MyExampleSetWriter"
class = "com.rapidminer.operator.my.ExampleSetWriter"
description = "Writes example set into file."
group = "MyOps"
/>

</operators>
- Create the manifest file
Code:
Manifest-Version: 1.0
RapidMiner-Type: RapidMiner_Plugin
- Create the .jar out of it

As I said, in RapidMiner 4.6 it works but unfortunately not in 5.1.
I would really like to buy the whitepaper, but for a student 40€ is definitely to much  Undecided

So is there a simple trick in order to get it to work in RapidMiner 5.1, do I have to change the operators.xml or something?

Cheers Q-Dog
Logged
Marco Boeck
Administrator
Sr. Member
*****
Posts: 264


WWW
« Reply #3 on: January 19, 2012, 01:01:59 PM »

Hi,

I have not been around in the RapidMiner 4 days, however from what I can see it has indeed changed quite a bit. The best advice I can give you is probably to checkout one of the RapidMiner extensions, for example Text Processing, and pay close attention to the "OperatorsPluginName.xml" and "OperatorsDocPluginName.xml" files in the resource folder. Also have a look at the build.xml file, where the properties like operator definition file etc can be found. On that basis you should be able to work out what you need yourself Wink

Regards,
Marco
Logged

Did you try our new Marketplace? Upload or download new Extensions, add comments, and organize your operators. Have a look at  http://marketplace.rapid-i.com
Q-Dog
Newbie
*
Posts: 32


« Reply #4 on: January 19, 2012, 01:16:05 PM »

I'll do that, thanks a lot  Smiley
Logged
Pages: [1]
  Print  
 
Jump to: