Class<DependencyDerivator<DoubleVector, DoubleDistance>> cls = ClassGenericsUtil.uglyCastIntoSubclass(DependencyDerivator.class);
derivator = parameters.tryInstantiate(cls);
CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB);
Matrix weightMatrix = model.getSimilarityMatrix();
DoubleVector centroid = new DoubleVector(model.getCentroid());
DistanceQuery<DoubleVector, DoubleDistance> df = QueryUtil.getDistanceQuery(derivatorDB, new WeightedDistanceFunction(weightMatrix));
DoubleDistance eps = df.getDistanceFactory().parseString("0.25");
ids.addDBIDs(interval.getIDs());
// Search for nearby vectors in original database
for(DBID id : relation.iterDBIDs()) {
DoubleVector v = new DoubleVector(relation.get(id).getColumnVector().getArrayRef());
DoubleDistance d = df.distance(v, centroid);
if(d.compareTo(eps) < 0) {
ids.add(id);
}
}
Matrix basis = model.getStrongEigenvectors();
return basis.getMatrix(0, basis.getRowDimensionality() - 1, 0, dim - 2);
}