DoubleMultiviewSpectralClustering implements MultiviewSimilarityClusterer<IndexClusters> { @Override public IndexClusters cluster(List<SparseMatrix> data) { final DoubleSpectralClustering dsp = new DoubleSpectralClustering(conf); if (data.size() == 1) { return dsp.cluster(data.get(0)); } final ArrayList<IndependentPair<double[], double[][]>> answers = new ArrayList<IndependentPair<double[], double[][]>>(data.size()); PreparedSpectralClustering prep = new PreparedSpectralClustering(conf); for (int i = 0; i < data.size(); i++) { answers.add(prep.bestCols(dsp.spectralCluster(data.get(i)))); } while (!conf.stop.stop(answers)) { for (int i = 0; i < answers.size(); i++) { final SparseMatrix laplacian = dsp.laplacian(data.get(i)); SparseMatrix ujujSum = null; for (int j = 0; j < answers.size(); j++) { if (i == j) continue; final Matrix uj = new DenseMatrix(answers.get(j).secondObject()); final SparseMatrix ujuj = MatlibMatrixUtils.dotProductTranspose(uj, uj, new SparseMatrix(uj.rowCount(), uj.rowCount())); if (ujujSum == null) { ujujSum = ujuj; } else { MatlibMatrixUtils.plusInplace(ujujSum, ujuj); } } MatlibMatrixUtils.plusInplace(laplacian, MatlibMatrixUtils.scaleInplace(ujujSum, conf.lambda)); answers.add(i, prep.bestCols(dsp.laplacianEigenVectors(laplacian))); } } return null; } DoubleMultiviewSpectralClustering(MultiviewSpectralClusteringConf<double[]> conf); @Override IndexClusters cluster(List<SparseMatrix> data); @Override int[][] performClustering(List<SparseMatrix> data);  }
@Test public void test() { SpatialClusterer<DoubleDBSCANClusters,double[]> inner = new DoubleNNDBSCAN( epss, 2, new DoubleNearestNeighboursExact.Factory(DoubleFVComparison.EUCLIDEAN)); MultiviewSpectralClusteringConf<double[]> conf = new MultiviewSpectralClusteringConf<double[]>( 0.1,inner ); conf.eigenChooser = new ChangeDetectingEigenChooser(100, 1.0); conf.stop = new StoppingCondition.HardCoded(10); DoubleSpectralClustering clust = new DoubleSpectralClustering(conf); IndexClusters clusters1 = clust.cluster(allsim); System.out.println(clusters1); }