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
"Plugging a custom kernel for SVM"
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.
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.
0
Answers
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.
Greetings,
Sebastian