noiseDim = dimensionality(fulldatabase);
/** * Run CASH on the relation. * * @param database Database * @param vrel Relation * @return Clustering result */ public Clustering<Model> run(Database database, Relation<V> vrel) { fulldatabase = preprocess(database, vrel); processedIDs = DBIDUtil.newHashSet(fulldatabase.size()); noiseDim = dimensionality(fulldatabase); FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("CASH Clustering", fulldatabase.size(), LOG) : null; Clustering<Model> result = doRun(fulldatabase, progress); LOG.ensureCompleted(progress); if(LOG.isVerbose()) { StringBuilder msg = new StringBuilder(1000); for(Cluster<Model> c : result.getAllClusters()) { if(c.getModel() instanceof LinearEquationModel) { LinearEquationModel s = (LinearEquationModel) c.getModel(); msg.append("\n Cluster: Dim: " + s.getLes().subspacedim() + " size: " + c.size()); } else { msg.append("\n Cluster: " + c.getModel().getClass().getName() + " size: " + c.size()); } } LOG.verbose(msg.toString()); } return result; }
/** * Builds a database for the derivator consisting of the ids in the specified * interval. * * @param relation the database storing the parameterization functions * @param ids the ids to build the database from * @return a database for the derivator consisting of the ids in the specified * interval */ private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, DBIDs ids) { ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); MaterializedRelation<DoubleVector> prep = new MaterializedRelation<>(type, ids); proxy.addRelation(prep); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.insert(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); } return proxy; }
final int dim = dimensionality(relation);
Clustering<Model> res = new Clustering<>("CASH clustering", "cash-clustering"); final int dim = dimensionality(relation);
/** * Builds a database for the derivator consisting of the ids in the specified * interval. * * @param relation the database storing the parameterization functions * @param ids the ids to build the database from * @return a database for the derivator consisting of the ids in the specified * interval */ private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, DBIDs ids) { ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); MaterializedRelation<DoubleVector> prep = new MaterializedRelation<>(type, ids); proxy.addRelation(prep); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { DoubleVector v = new DoubleVector(relation.get(iter).getColumnVector().getArrayRef()); prep.insert(iter, v); } return proxy; }
/** * Builds a database for the derivator consisting of the ids in the specified * interval. * * @param relation the database storing the parameterization functions * @param interval the interval to build the database from * @return a database for the derivator consisting of the ids in the specified * interval */ private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, CASHInterval interval) { DBIDs ids = interval.getIDs(); ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); WritableDataStore<DoubleVector> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, DoubleVector.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, DoubleVector.wrap(relation.get(iter).getColumnVector())); } if(LOG.isDebugging()) { LOG.debugFine("db fuer derivator : " + ids.size()); } MaterializedRelation<DoubleVector> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return proxy; }
/** * Builds a database for the derivator consisting of the ids in the specified * interval. * * @param relation the database storing the parameterization functions * @param interval the interval to build the database from * @return a database for the derivator consisting of the ids in the specified * interval */ private Database buildDerivatorDB(Relation<ParameterizationFunction> relation, CASHInterval interval) { DBIDs ids = interval.getIDs(); ProxyDatabase proxy = new ProxyDatabase(ids); int dim = dimensionality(relation); SimpleTypeInformation<DoubleVector> type = new VectorFieldTypeInformation<>(DoubleVector.FACTORY, dim); WritableDataStore<DoubleVector> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, DoubleVector.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, new DoubleVector(relation.get(iter).getColumnVector().getArrayRef())); } if(LOG.isDebugging()) { LOG.debugFine("db fuer derivator : " + ids.size()); } MaterializedRelation<DoubleVector> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return proxy; }