scalanlp / nak

The Nak Machine Learning Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can you just offer an example of using nak's DBSCAN in java code?

zhaoxp0905 opened this issue · comments

As the title above, because I never used scala, and I just running java task on spark cluster, I want using nak's DBSCAN in my java task, thank you!

Hi @zhaoxp0905

Thanks for your request. This repository has not been maintained in years. Make sure you are aware of that if you plan to use this library in production code.

Depending on the Java Version you are using the code is very similar to https://github.com/scalanlp/nak/blob/master/src/test/scala/nak/cluster/GDBSCANTest.scala

import nak.cluster.GDBSCAN._
val gdbscan = new GDBSCAN(
   DBSCAN.getNeighbours(epsilon = 1, distance = Kmeans.euclideanDistance),
   DBSCAN.isCorePoint(minPoints = 2)
)

Add more type infos, replace val with the actual type, remove the named parameters.

import nak.cluster.GDBSCAN.*
GDBSCAN gdbscan = new GDBSCAN(
   DBSCAN.getNeighbours(1, Kmeans.euclideanDistance),
   DBSCAN.isCorePoint(2)
)

I have no idea if this works, but it should be close. Don't know if breeze makes use of implicits. If so, then you will have no fun with using this in java.