private double [ ] getDistanceWeightedVotes ( double distances [ ] , int [ ] nnIndices , Instances instances ) { double v [ ] = new double [ this . maxClassValue + 1 ] ; for ( int nnIdx : nnIndices ) { v [ ( int ) instances . instance ( nnIdx ) . classValue ( ) ] += 1. / Math . max ( distances [ nnIdx ] , 0.000000001 ) ; } return v ; }
Returns the distance weighted votes .