User defined Similarity?
I´ve seen the revamped distance-similarity schema in RM 4.3.
Is there any way to use a user defined similarity?
The only I imagine is to extend DistanceMeasures
But I label this way unelegant (require change core code) and I can´t see a way a plugin can expand the list of selectable distances-similarities. Any idea? A suggestion for RM5.0?
Thanks for your attention and great work.
F.J. Cuberos
Is there any way to use a user defined similarity?
The only I imagine is to extend DistanceMeasures
And some logic to instantiate the class.
public static final String PARAMETER_USER_CLASS= "user_class";
...
public static final String[] MEASURE_TYPES = new String[] {
"MixedMeasures",
"NominalMeasures",
"NumericalMeasures",
"BregmanDivergences",
"UserDefinedDistance"
};
....
type = new ParameterTypeString(PARAMETER_USER_CLASS,"Class reference","put.your.class.here");
type.registerDependencyCondition(new EqualTypeCondition(operator, PARAMETER_MEASURE_TYPES, true, 4));
list.add(type);
...
But I label this way unelegant (require change core code) and I can´t see a way a plugin can expand the list of selectable distances-similarities. Any idea? A suggestion for RM5.0?
Thanks for your attention and great work.
F.J. Cuberos
Find more posts tagged with
Sort by:
1 - 10 of
101
Hi,
this feature is finally included in the new RapidMiner Version 4.4
You Plugin now might provide a class as follows:
Greetings,
Sebastian
this feature is finally included in the new RapidMiner Version 4.4
You Plugin now might provide a class as follows:
package com.rapidminer;The method initPlugin is called during startup so that your plugin might do something for initilizing itself or register a distance measure as done here.
import com.rapidminer.tools.math.similarity.DistanceMeasures;
public class PluginInit {
public static void initPlugin() {
DistanceMeasures.registerMeasure(DistanceMeasures.DIVERGENCES_TYPE, "Test", TestMeasure.class);
}
}
Greetings,
Sebastian
One more question.
I´ve implemented a "distance": is a kernel function defined for discretized sets and the definition is based in the ranges for every nominal value obtained in the discretization processs.
Previosly, defined as an operator I could access to the IOContainer and read the discretization model in the apply() method.
Now, defined as a SimilarityMeasure, ¿How can I get any object from the input of the current operator? The current operator uses the distanceMeasure and makes its instantiation.
¿Any idea? ???
Thanks again for all you support to the RM users community.
Francisco J. Cuberos
I´ve implemented a "distance": is a kernel function defined for discretized sets and the definition is based in the ranges for every nominal value obtained in the discretization processs.
Previosly, defined as an operator I could access to the IOContainer and read the discretization model in the apply() method.
Now, defined as a SimilarityMeasure, ¿How can I get any object from the input of the current operator? The current operator uses the distanceMeasure and makes its instantiation.
¿Any idea? ???
Thanks again for all you support to the RM users community.

Francisco J. Cuberos
Hi,
oh, that's more difficult now, sorry for that. Actually, it's only possible by introducing a small "hack" into your distance measure:
During the creation process of the distance measure, the methods
Cheers,
Ingo
oh, that's more difficult now, sorry for that. Actually, it's only possible by introducing a small "hack" into your distance measure:
During the creation process of the distance measure, the methods
will be invoked. The first one constructs the measure by reflection and the second one invokes the init method with the example set only. But you can still make use of the second argument, the parameterHandler, since it is actually the invoking operator. So if you implement you init method like in the following, you should have access to the other IOObjects:
measure = (DistanceMeasure) measureClass.newInstance();
measure.init(exampleSet, parameterHandler);
Currently, it should be ensured that only operator invoke this method. I will ask Sebastian and we could change the method to "Operator" instead of "ParameterHandler".
public void init(ExampleSet exampleSet, ParameterHandler parameterHandler) {
// case parameter handler to Operator
Operator operator = (Operator)parameterHandler;
// retrieve the model
Model model = operator.getInput().get(Model.class);
// do whatever you want...
}
Cheers,
Ingo
Thanks for your quickly and clear answer, as usual.
I found then calling code but get confused with the ParameterHandler.
I´ll try your code but it´s clear this is the solution to my problem.
Thanks again Ingo.
F.J. Cuberos
P.D. Some time agoI ask if I could post some documents about RM in spanish in the wiki. The wiki has been redesigned already, but there is no "internalization zone". Are you interested in this work?
I found then calling code but get confused with the ParameterHandler.
I´ll try your code but it´s clear this is the solution to my problem.
Thanks again Ingo.
F.J. Cuberos
P.D. Some time agoI ask if I could post some documents about RM in spanish in the wiki. The wiki has been redesigned already, but there is no "internalization zone". Are you interested in this work?
there will be a method for registering new measures on the DistanceMeasures static class. Plugins will be able to do this during startup using a new init method, which is called if its present.
Greetings,
Sebastian