How should I Create my New Classifier Operator

siamak_wantsiamak_want Member Posts: 98 Contributor II
edited November 2018 in Help
Hi,

I want to create a new Naive Bayes  classifier. So, I have got confused with the following issues:

1- Should I extend Operator class or AbstractLearner class?
2- Should I put my algorithm in dowork() method or in Learn() method?
3- Why does a clustering operator like kmeans directly extend Operator but another clustering operator extends RMAbstractClusterer?
4- What are learners? are they equivalent of classifiers? All of the classifiers should extend Abstract learner?

I am really confused:(
Would you please guide me through making a new classifier operator?

Any help will be appreciated.

Tagged:

Answers

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

    noone forces you to follow the approach RM uses, but it is strongly recommended.

    1 - NaiveBayes and KernelNaiveBayes both extend AbstractLearner, so I suggest you do the same
    2 - have a look at the learn(ExampleSet) method of these aforementioned classes
    3 - the first 5 clustering operators I checked all extend RMAbstractClusterer
    4 - Have a look at the JavaDoc for the AbstractLearner class

    Regards,
    Marco
  • siamak_wantsiamak_want Member Posts: 98 Contributor II
    Hi Marco,

    Thanks to your guides. But now I have a new issue when I wanted to see my new operator in RM GUI. I added my new operator to Operators.XML file located in resources folder. Now, when I start off the GUI, RM says something like: "no valid XML". My added code in operatorsXML is:

    <operator>
                  <key>MyOp</key>
                  <class>my.myop</class>
    </operator>
  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Moderator, Employee, Member, University Professor Posts: 1,806   RM Engineering
    Hi,

    well I can't help you there, looks like you have messed something up in the file. But I encourage you to take a look at this thread (click), as that is a much better way of adding something to RapidMiner. Editing the RM sourcecode directly is not a good idea because if you add something to the RM Core, it may get overwritten or create a conflict if we update RapidMiner sources ourselves - and we work on the RM sources on a daily basis.

    Regards,
    Marco
  • siamak_wantsiamak_want Member Posts: 98 Contributor II
    Thanks Marco, I studied the thread you mentioned. Now there is two key questions:

    1- It was really helpful. By the way, If the right way to extend rapidminer is plugin, why hadn't the RM developers used this approach for LibSVM component?! (They have insert the Libsvm code directly in RM code!)

    2- As far as I understood from your guides, I should write my own "learning algorithm" in Learn() method and then set the PredictionAttribute in Model class. Am i right? I mean Is it a standard way for creating my new classifier?

    Thanks in advance.
  • Nils_WoehlerNils_Woehler Member Posts: 463  Guru
    Hi,

    the LibSVM Operator is no plugin because it has been developed - as you have stated - by the RM developers. Only they are allowed to change the RM core and the LibSVM Operator is part of the RM core.
    Developing plugins is a good opportunity for other developers (like you) to extend RapidMiner without touching the core of RM.

    Your approach to write your own learning algorithm seems to be okay the way you described it.

    Best,
    Nils
  • siamak_wantsiamak_want Member Posts: 98 Contributor II
    Thanks a lot Nils. I thought that LibSVM is an external third party wich has been used by RM developers. This was due to the fact that I saw a class named JMySVMLearner class too. Anyway thanks your guide.
Sign In or Register to comment.