public COPACNeighborPredicate . Instance instantiate ( Database database , Relation < V > relation ) { DistanceQuery < V > dq = database . getDistanceQuery ( relation , EuclideanDistanceFunction . STATIC ) ; KNNQuery < V > knnq = database . getKNNQuery ( dq , settings . k ) ; WritableDataStore < COPACModel > storage = DataStoreUtil . makeStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_HOT | DataStoreFactory . HINT_TEMP , COPACModel . class ) ; Duration time = LOG . newDuration ( this . getClass ( ) . getName ( ) + ".preprocessing-time" ) . begin ( ) ; FiniteProgress progress = LOG . isVerbose ( ) ? new FiniteProgress ( this . getClass ( ) . getName ( ) , relation . size ( ) , LOG ) : null ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { DoubleDBIDList ref = knnq . getKNNForDBID ( iditer , settings . k ) ; storage . put ( iditer , computeLocalModel ( iditer , ref , relation ) ) ; LOG . incrementProcessed ( progress ) ; } LOG . ensureCompleted ( progress ) ; LOG . statistics ( time . end ( ) ) ; return new Instance ( relation . getDBIDs ( ) , storage ) ; }
Full instantiation method .