public void theBestAttributes ( Instance instance , AutoExpandVector < AttributeClassObserver > observersParameter ) { for ( int z = 0 ; z < instance . numAttributes ( ) - 1 ; z ++ ) { if ( ! instance . isMissing ( z ) ) { int instAttIndex = modelAttIndexToInstanceAttIndex ( z , instance ) ; ArrayList < Double > attribBest = new ArrayList < Double > ( ) ; if ( instance . attribute ( instAttIndex ) . isNominal ( ) ) { this . minEntropyNominalAttrib = Double . MAX_VALUE ; AutoExpandVector < DoubleVector > attribNominal = ( ( NominalAttributeClassObserver ) observersParameter . get ( z ) ) . attValDistPerClass ; findBestValEntropyNominalAtt ( attribNominal , instance . attribute ( z ) . numValues ( ) ) ; // The best value (lowest entropy) of a nominal attribute. attribBest . add ( this . saveBestEntropyNominalAttrib . getValue ( 0 ) ) ; attribBest . add ( this . saveBestEntropyNominalAttrib . getValue ( 1 ) ) ; attribBest . add ( this . saveBestEntropyNominalAttrib . getValue ( 2 ) ) ; this . saveBestValGlobalEntropy . add ( attribBest ) ; this . saveBestGlobalEntropy . setValue ( z , this . saveBestEntropyNominalAttrib . getValue ( 1 ) ) ; } else { this . root = ( ( BinaryTreeNumericAttributeClassObserver ) observersParameter . get ( z ) ) . root ; mainFindBestValEntropy ( this . root ) ; // The best value (lowest entropy) of a numeric attribute. attribBest . add ( this . saveBestEntropy . getValue ( 0 ) ) ; attribBest . add ( this . saveBestEntropy . getValue ( 1 ) ) ; attribBest . add ( this . saveBestEntropy . getValue ( 2 ) ) ; attribBest . add ( this . saveBestEntropy . getValue ( 4 ) ) ; this . saveBestValGlobalEntropy . add ( attribBest ) ; this . saveBestGlobalEntropy . setValue ( z , this . saveBestEntropy . getValue ( 1 ) ) ; } } else { double value = Double . MAX_VALUE ; this . saveBestGlobalEntropy . setValue ( z , value ) ; } } }
This function gives the best value of entropy for each attribute