Search code examples
cluster-analysisdata-miningdbscanelki

Pass Java array as an input for ELKI DBSCAN


I have been able to use ELKI for DBSCAN using Java code and its amazingly fast compared to any other tool. Till now I was working with a CSV file and using following to give that as an input.

params.addParameter(FileBasedDatabaseConnection.Parameterizer.INPUT_ID,fileLocation)

I am wondering how can I pass an array of (lat,long,timestamp) as an input instead of a CSV file. I am not able to figure it out.


Solution

  • Good morning.

    This is what the class ArrayAdapterDatabaseConnection is for.

    DatabaseConnection dbc = new ArrayAdapterDatabaseConnection(...);
    
    // Pass an instance, not a class, as parameter.
    params.addParameter(
        AbstractDatabase.Parameterizer.DATABASE_CONNECTION_ID, dbc);
    

    Alternatively, you can implement your own DatabaseConnection or Parser.

    When woring with latitude, longitude, timestamp be careful with distances and types. Do not use Euclidean distance on lat,long,timestamp; instead carefully construct a domain specific similarity measure.