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
Custom Distance function
superprotta
Member Posts: 3 Contributor I
Hi, i'm new to RapidMiner and i'm trying to develop a clustering application for a university project. I had to create my own custom similarity function and, as I read in this thread http://rapid-i.com/rapidforum/index.php/topic,604.0.html, I tried to use
Problem is that when i try to run the code written above, the application fails at
DistanceMeasures.registerMeasureHere is the beginning of my application code:
public static void main(String[] args) {The process is described by ClusteringObjects.xml and it should use KMedoids operator with my distance function, which is AxmedisObjectsDistance created extending DistanceMeasure class.
try{
RapidMiner.init();
DistanceMeasures.registerMeasure(DistanceMeasures.MIXED_MEASURES_TYPE, "AxmedisObjectsDistance", AxmedisObjectsDistance.class);
Process process = new Process(new File("ClusteringObjects.xml"));
IOContainer io = process.run();
...
Problem is that when i try to run the code written above, the application fails at
IOContainer io = process.run();with the following error message:
java.lang.ArrayIndexOutOfBoundsException: 1Obviously i'm missing something, but i'm really not seeing what, could you please help me?
at com.rapidminer.tools.math.similarity.DistanceMeasures.createMixedMeasure(DistanceMeasures.java:238)
at com.rapidminer.tools.math.similarity.DistanceMeasures.createMeasure(DistanceMeasures.java:216)
at com.rapidminer.operator.clustering.clusterer.AgglomerativeClustering.apply(AgglomerativeClustering.java:69)
at com.rapidminer.operator.Operator.apply(Operator.java:671)
at com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:424)
at com.rapidminer.operator.Operator.apply(Operator.java:671)
at com.rapidminer.Process.run(Process.java:735)
at com.rapidminer.Process.run(Process.java:704)
at com.rapidminer.Process.run(Process.java:694)
at AxmedisClustererAgglomerative.main(AxmedisClustererAgglomerative.java:38)
Tagged:
0
Answers
could you please switch to the newest 4.6 version? The problem will remain there, but the stack trace will actually point to anything in the code
By the way, you might put your new distance measure into a plugin. Then you would have access to the gui for executing any process you like and your new measure would be available in the parameters dialog of KMedoids.
Greetings,
Sebastian
Hi, thanks for the quick answer. i tried switching to RapidMiner 4.6 but the stack trace remains the same and it poits to: I tried recompiling RapidMiner modifying these lines in DistanceMeasures.java from: to: This way my code works, even though it still needs the line at the beginning, otherwise it ends with the same stack trace as above....don't know if this is helpful.
Anyway i tried implementing it as a plugin but it gives the same ArrayIndexOutOfBounds Exception when i try to use it in any clustering operator. I suppose it's the same problem and that's why I need to solve it possibly without recompiling RapidMiner core..
I will check, whats wrong there. To do so, it would be very nice, if you could send me your plugin by mail? This will help me a lot, because otherwise I would have to implement a new plugin just for debugging...
Greetings,
Sebastian
just in case someone having the same problem finds this old thread: It's a bug in RapidMiner that can be fixed easily by modifiying com.rapidminer.tools.math.similarity.DistanceMeasures:
Cheers,
Peter
in fact this has already been fixed and should be available in the current SVN repository at source-forge.
Greetings,
Sebastian