"Plugging a custom kernel for SVM"

timurtimur Member Posts: 4 Contributor I
edited June 2019 in Help
Hi all,

I am writing a custom kernel function for JMySVMLearner, and have some problems with that. Unfortunately, forum search does not provide any hints.

As far as I understand, there is no simple way to add a new kernel function to JMySVMLearner, so I made a subclass TreeJMySVMLearner where I override the createKernel(int) method to initialize my own kernel. However, I need to set kernel parameters, and I can't do it in createKernel as it is a static method. In the original JMySVMLearner kernel parameters are set right in the 'learn' method, however I don't want to touch it.

As a workaround, I made static fields for kernel parameters in TreeJMySVMLearner (that are used in createKernel function) and override the 'learn' method to initialize these parameters first and then call the parent implementation. This works, but is far from optimal. Does anyone knows better solutions?

As a suggestion: I think that separating kernel parameter initialization block from the learn method in a separate protected method would make the process of implementing new kernels easier, as one should only override createKernel and this method.


  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Timur,
    you are definitively right. I once was going to exchange all this code blocks in rapid miner with a way similar to the DistanceMeasures class, but I didn't find the time until now.

  • timurtimur Member Posts: 4 Contributor I
    Thanks for the response anyway!
Sign In or Register to comment.