protected boolean decideRemove ( SAXMotif motif1 , SAXMotif motif2 , SAXPointsNumber [ ] pointsNumberRemoveStrategy ) { // motif1 details int motif1Start = motif1 . getPos ( ) . getStart ( ) ; int motif1End = motif1 . getPos ( ) . getEnd ( ) - 1 ; int length1 = motif1End - motif1Start ; // motif2 details int motif2Start = motif2 . getPos ( ) . getStart ( ) ; int motif2End = motif1 . getPos ( ) . getEnd ( ) - 1 ; int length2 = motif2End - motif2Start ; int countsMotif1 = 0 ; int countsMotif2 = 0 ; // compute the averageWeight double averageWeight = 1 ; int count = 0 ; for ( int i = 0 ; i < pointsNumberRemoveStrategy . length ; i ++ ) { count += pointsNumberRemoveStrategy [ i ] . getPointOccurenceNumber ( ) ; } averageWeight = ( double ) count / ( double ) pointsNumberRemoveStrategy . length ; // compute counts for motif 1 for ( int i = motif1Start ; i <= motif1End ; i ++ ) { countsMotif1 += pointsNumberRemoveStrategy [ i ] . getPointOccurenceNumber ( ) ; } // compute counts for motif 2 for ( int i = motif2Start ; i <= motif2End ; i ++ ) { countsMotif2 += pointsNumberRemoveStrategy [ i ] . getPointOccurenceNumber ( ) ; } // get weights double weight1 = countsMotif1 / ( averageWeight * length1 ) ; double weight2 = countsMotif2 / ( averageWeight * length2 ) ; if ( weight1 > weight2 ) { return true ; } return false ; }
Decide which one from overlapping subsequences should be removed . The decision rule is that each sub - sequence has a weight the one with the smaller weight should be removed .