Search code examples
javapythonweka

Using External packages like DBScan in Weka API mode


I am trying to use Weka API with Java and Python(using weka-python-wrapper). I want to use

weka.clusterers.DBScan 

here, but I am unable to use it for both Java and python. In the Weka src, they are in the External packages directory. Do I need to do something else for using it?

I am able to use

weka.clusterers.SimpleKMeans

in both the Java and Python mode, and also able to DBScan using the GUI and terminal means my Weka Path and Eclipse JARs are set up correctly.

Am I missing anything?


Solution

  • If you have the correct package installed that contains DBScan (I believe it is optics_dbScan), then you can use it from python-weka-wrapper.

    For installing a Weka package, you can use something like this:

    import weka.core.packages as packages
    #packages.refresh_cache()  # uncomment this to query for updates
    packages.install_package("optics_dbScan")
    

    You need to tell the JVM to include the jars from the packages when starting it:

    jvm.start(packages=True)
    

    From Java, you should be able to load the packages as follows:

    import weka.core.WekaPackageManager;
    ...
    WekaPackageManager.loadPackages(false);