Search code examples
javacluster-analysiselki

How to plug custom distances with ELKI?


I've already read the tutorial at ELKI documentation ( http://elki.dbs.ifi.lmu.de/wiki/Tutorial/DistanceFunctions ).

Unfortunately, I'm not grasping how to plug the generated .class with MiniGUI (or bash script for the provided .jar). How it can be done?

Ps: I know it sounds absolutely noob, but when I try to "type" the class name, as suggested, I get the error "The following parameters could not be processed: HammingDistance", for example.


Solution

  • ELKI will load classes via the standard Java Classloader. Therefore, they must be on the class path or they cannot be loaded. An example call (assuming your classes are in the bin folder) is
    java -cp elki.jar:bin/ de.lmu.ifi.dbs.elki.application.ELKILauncher

    Parameters are interpreted as follows:

    • If there is a class with this name (including the package name!) it is used.
    • Otherwise, ELKI tries prepending the package name of the expected interface. Which enables shortcut names.
    • Otherwise, known classes (from the service files) are checked for aliases. For example, the Euclidean distance has an alias name of l2, Manhattan has an alias l1.
    • The class must have a parameterless public constructor or a inner public static class Parameterizer.

    Input assistance is built as follows:

    • .jar files on the classpath are checked for service files in META-INF/elki/<interface>
    • folders on the classpath put you in development mode, where a recursive list is performed and all .class files are inspected. This is much slower, but removes the need to edit the service files. Discovered classes show up below the ones listed in the service file.

    Furthermore, the package de.lmu.ifi.dbs.elki.application.internal includes classes that will inspect everything on your classpath, and will report e.g. classes that do not have a parameterless public constructor, or a inner public static class Parameterizer.