public OutlierResult run ( Database database , Relation < V > relation ) { final int dbsize = relation . size ( ) ; ArrayList < ArrayList < DBIDs > > ranges = buildRanges ( relation ) ; Heap < Individuum > . UnorderedIter individuums = ( new EvolutionarySearch ( relation , ranges , m , rnd . getSingleThreadedRandom ( ) ) ) . run ( ) ; WritableDoubleDataStore outlierScore = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_HOT | DataStoreFactory . HINT_STATIC ) ; for ( ; individuums . valid ( ) ; individuums . advance ( ) ) { DBIDs ids = computeSubspaceForGene ( individuums . get ( ) . getGene ( ) , ranges ) ; double sparsityC = sparsity ( ids . size ( ) , dbsize , k , phi ) ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { double prev = outlierScore . doubleValue ( iter ) ; if ( Double . isNaN ( prev ) || sparsityC < prev ) { outlierScore . putDouble ( iter , sparsityC ) ; } } } DoubleMinMax minmax = new DoubleMinMax ( ) ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { double val = outlierScore . doubleValue ( iditer ) ; if ( Double . isNaN ( val ) ) { outlierScore . putDouble ( iditer , val = 0. ) ; } minmax . put ( val ) ; } DoubleRelation scoreResult = new MaterializedDoubleRelation ( "AggarwalYuEvolutionary" , "aggarwal-yu-outlier" , outlierScore , relation . getDBIDs ( ) ) ; OutlierScoreMeta meta = new InvertedOutlierScoreMeta ( minmax . getMin ( ) , minmax . getMax ( ) , Double . NEGATIVE_INFINITY , 0.0 ) ; return new OutlierResult ( meta , scoreResult ) ; }
Performs the evolutionary algorithm on the given database .