Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhaoxp0905 opened this issue Jul 22, 2020 · 1 comment
Open

Comments

@zhaoxp0905
Copy link

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!

@muuki88
Copy link
Contributor

muuki88 commented Jul 27, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants