private SpectralClustering cluster(double[][] data, int k) { long clock = System.currentTimeMillis(); SpectralClustering cluster = new SpectralClustering(data, k, 0.27); System.out.format( "DBSCAN clusterings %d samples in %dms\n", data.length, System.currentTimeMillis() - clock); System.out.println("getNumClusters:" + cluster.getNumClusters()); System.out.println("getClusterSize:" + cluster.getClusterSize()); // System.out.println(JSON.toJSONString(dbscan.getClusterSize())); System.out.println("toString:" + cluster.toString()); return cluster; }
private void _cluster(double[][] data, int k) { long clock = System.currentTimeMillis(); SpectralClustering cluster = new SpectralClustering(data, k, 0.355); System.out.format( "DBSCAN clusterings %d samples in %dms\n", data.length, System.currentTimeMillis() - clock); System.out.println("getNumClusters:" + cluster.getNumClusters()); System.out.println("getClusterSize:" + cluster.getClusterSize()); // System.out.println(JSON.toJSONString(dbscan.getClusterSize())); System.out.println("toString:" + cluster.toString()); /** ************************************************************ */ boolean more = true; EigenValueDecomposition eigen = cluster.getEigen(); double[] lab = eigen.getEigenValues(); double sd = smile.math.Math.sd(eigen.getEigenValues()); System.out.println("sd(eigen.getEigenValues()):" + sd); if (Math.min(eigen.getEigenValues()) > 0.3) { result = cluster; cluster(data, k + 1); } else { return; } }