I am trying to implement dbscan in spark but I am facing lots of issues. Can anyone please tell me how to implement dbscan in spark-scala. Please help me. I mention the Main class and POM.xml file below. Please tell me if any version is wrong or any dependency is missing.
val conf = new SparkConf().setAppName("DBSCAN Sample")
val sc = new SparkContext(conf)
val data = sc.textFile("hdfs://localhost:8020/DBScan/labeled_data.csv")
val parsedData = data.map(s => Vectors.dense(s.split(',').map(_.toDouble))).cache()
val model = DBSCAN.train(
parsedData,
eps = 0.6,
minPoints = 5,
maxPointsPerPartition = 8)
model.labeledPoints.map(p => s"${p.x},${p.y},${p.cluster}").saveAsTextFile("hdfs://localhost:8020/DBScan/OPTS")
sc.stop()
I am trying to implement dbscan in spark but I am facing lots of issues. Can anyone please tell me how to implement dbscan in spark-scala. Please help me. I mention the Main class and POM.xml file below. Please tell me if any version is wrong or any dependency is missing.
This is My main class:
package DBScanClustering
import org.apache.spark.mllib.clustering.dbscan.DBSCAN import org.apache.spark.SparkContext import org.apache.spark.SparkConf import org.apache.spark.mllib.linalg.Vectors
object MyMain {
def main(args: Array[String]) {
} }
and this is my POM.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">