question: public static double L_RankLoss ( int y [ ] , int r [ ] ) { int L = y . length ; ArrayList < Integer > tI = new ArrayList < Integer > ( ) ; ArrayList < Integer > fI = new ArrayList < Integer > ( ) ; for ( int j = 0 ; j < L ; j ++ ) { if ( y [ j ] == 1 ) { tI . add ( j ) ; } else { fI . add ( j ) ; } } if ( ! tI . isEmpty ( ) && ! fI . isEmpty ( ) ) { int c = 0 ; for ( int k : tI ) { for ( int l : fI ) { if ( position ( k , r ) < position ( l , r ) ) { c ++ ; } } } return ( double ) c / ( double ) ( tI . size ( ) * fI . size ( ) ) ; } else { return 0.0 ; } }
target:  Rank Loss - the average fraction of labels which are not correctly ordered. Thanks to Noureddine Yacine NAIR BENREKIA for providing bug fix for this.