-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest1.scala
More file actions
40 lines (31 loc) · 975 Bytes
/
Copy pathTest1.scala
File metadata and controls
40 lines (31 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.File
import java.io.PrintWriter
import scala.collection.mutable.ArrayBuffer
import scala.io.Source
object Test1 {
def main (args: Array[String]) : Unit = {
val SOP : SetOfPoint = new SetOfPoint()
val lines = Source.fromFile("PATH OF THE DATASET FILE").getLines.toArray
val dimChoisi : Int =4 // number of features
for(str <- lines){
val words = str.split("\t")
val tab : ArrayBuffer[Float] = ArrayBuffer.empty[Float]
for ( i <- 0 to ( dimChoisi -1)) {
tab+=words(i).toFloat
}
var Pt: Point = new Point(dimChoisi, tab)
SOP.Ajout(Pt)
}
val p : Double =0.1
val r : Float = p.toFloat
val db : DBSCAN = new DBSCAN(SOP,r,200)
db.DBSCAN_RUN()
// outputs each point a,d the cluster it belongs to
val writer = new PrintWriter(new File(CUsersPROXY INFODesktopResults.txt))
for(p1 <- SOP.MySet)
{
println( p1.ClId)
}
writer.close()
}
}