Menu

[572a65]: / src / junit / clustering / TestDensityBasedClustering.java  Maximize  Restore  History

Download this file

36 lines (28 with data), 956 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
/**
* %SVN.HEADER%
*/
package junit.clustering;
import java.io.File;
import net.sf.javaml.clustering.DensityBasedSpatialClustering;
import net.sf.javaml.core.Dataset;
import net.sf.javaml.distance.ChebychevDistance;
import net.sf.javaml.tools.data.FileHandler;
import org.junit.Assert;
import org.junit.Test;
public class TestDensityBasedClustering {
@Test
public void testDBScan() {
try {
Dataset data = FileHandler.loadDataset(new File("devtools/data/test.lst"), ";");
DensityBasedSpatialClustering dbscan = new DensityBasedSpatialClustering(30, 5, new ChebychevDistance());
Dataset[] clusters = dbscan.cluster(data);
for (Dataset ds : clusters) {
System.out.println(ds.size());
Assert.assertTrue(ds.size() >= 5);
}
} catch (Exception e) {
e.printStackTrace();
Assert.assertFalse(true);
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.