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

Problem: Extending Rapidminer (a new operator)

Q-DogQ-Dog Member Posts: 32 Contributor II
edited November 2018 in Help
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
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    it seems you've mixed something up ;)
    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 :)

    Regards,
    Marco
  • Q-DogQ-Dog Member Posts: 32 Contributor II
    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

    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

    <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

    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  :-\

    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
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    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 ;)

    Regards,
    Marco
  • Q-DogQ-Dog Member Posts: 32 Contributor II
    I'll do that, thanks a lot  :)
  • aishaagrawal33aishaagrawal33 Member Posts: 2 Learner III

    sir, i am making a project in rapidminer .i want a new extension for my project.would you make it for me

Sign In or Register to comment.