new developed operator not functioning

alandhwalandhw Member Posts: 25 Contributor II
edited November 2018 in Help
1. to develop a new operator, it is a must to have a input and output port?
2. when want to send the input object to the output port must use deliver() function? or it have others method to use?
3. " ExampleSet exampleSet = exampleSetInput.getData(); " what the ExampleSet class doing? it's a must to use it when I want to retrieve data/get data?
4. How to test the operator is working or not? I run the ant file already, when I use the new developed operator and run it, it's no response, I not sure is my function code got error or any others problem occurs .

I need a guide here. Thanks.

Best Regards,
Alan
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,885   RM Engineering
    Hi,

    the whitepaper How to Extend RapidMiner covers your questions pretty well.
    Otherwise you might want to try and search this development forum and piece some code fragments that have been posted here together, that might help you as well.

    4) Add RM as a project in Eclipse, add RM as a library project to your extension project, launch RM in debug mode and play around with your operator. You can then add breakpoints in your code and see what happens yourself.

    Regards,
    Marco
  • alandhwalandhw Member Posts: 25 Contributor II
    Yes, I bought the white paper and go through the tutorial already. However when start to develop my own operator, the problems come. Without the input/output port, RM is not able to show the operator outcome ?

    Best Regards,
    Alan
  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,885   RM Engineering
    Hi,

    1) yes input/output ports are a necessity - unless you are creating a special kind of operator to import data (for example see AbstractReader class) with no input port. The RapidMiner operator concept bases on an "execution flow" which basically sends your data through each operator in the chain in the given order. Even if your operator does nothing on the data, it needs to pass the data from an input port to an output port regardless.

    2) It depends on what operator class you want to extend. For example, extending AbstractExampleSetProcessing class youwould simply need to do:

    @Override
    public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
         return exampleSet;
    }
    This takes the input and delivers it at the output without doing anything.

    3) See JavaDoc and whitepaper. However data is not always an ExampleSet, it could also be a Model or some other data. Most of the time you will deal with ExampleSets though I guess.


    Regards,
    Marco
  • alandhwalandhw Member Posts: 25 Contributor II
    I tried the new operator with code the input port getting the data from the Employee class which to perform the  println("hello world"), and I expected the output port will deliver the message that in the Employee class. But it doesn't work. Whats wrong with me concept? pls advice, thank you

    private InputPort exampleSetInput = getInputPorts().createPort("example set");
    private OutputPort exampleSetOutput = getOutputPorts().createPort("example set");

    Employee a = new Employee();
    ExampleSet ex = exampleSetInpu.getData();

    a.printEmployee();
    exampleSetOutput.deliver(ex);

    Best Regards,
    Alan
  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,885   RM Engineering
    Hi,

    I don't quite understand what you're trying to achieve. Your operator class needs to extend the appropriate operator class (for example AbstractExampleSetProcessing), and then implement/overwrite the method that does the work, in the case of the AbstractExampleSetProcessing class it's the

    @Override
    public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
         // insert your code here
         return exampleSet;
    }
    method as shown in my previous post. Also please note that creating a process programatically is of course possible but discouraged for beginners, as it is quite error prone and it is a lot easier to create the process (with your new operator) in the RapidMiner GUI and then just execute the whole process. See here how to do that.

    Regards,
    Marco
  • alandhwalandhw Member Posts: 25 Contributor II
    Marco Boeck wrote:

    Hi,

    the whitepaper How to Extend RapidMiner covers your questions pretty well.
    Otherwise you might want to try and search this development forum and piece some code fragments that have been posted here together, that might help you as well.

    4) Add RM as a project in Eclipse, add RM as a library project to your extension project, launch RM in debug mode and play around with your operator. You can then add breakpoints in your code and see what happens yourself.

    Regards,
    Marco
    how to launch the RM in debug mode? Can explain this in details?
    For example how to debug Numerical2DateOperator file ?

    Regards,
    Alan
  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Administrator, Moderator, Employee, Member, University Professor Posts: 1,885   RM Engineering
    Hi,

    as you would launch any other java program in debug mode. Use an IDE like Eclipse, add the RapidMiner_Unuk project via SourceForge SVN and then launch it in debug mode (RapidMinerGUI class contains the main() method you're looking for).

    Regards,
    Marco
Sign In or Register to comment.