#NEWLINE# def print_report( grid_search , parameters ) : #NEWLINE# #INDENT# print ( ) #NEWLINE# print ( ( '== ' * 20 ) ) #NEWLINE# print ( 'All parameters:' ) #NEWLINE# best_parameters = grid_search . best_estimator_ . get_params ( ) #NEWLINE# for ( param_name , value ) in sorted ( best_parameters . items ( ) ) : #NEWLINE# #INDENT# if ( not isinstance ( value , BaseEstimator ) ) : #NEWLINE# #INDENT# print ( ( '    %s=%r,' % ( param_name , grid_search ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# print ( ) #NEWLINE# print ( ( '== ' * 20 ) ) #NEWLINE# print ( ( 'Best score: %0.4f' % grid_search . best_score_ ) ) #NEWLINE# print ( 'Best grid parameters:' ) #NEWLINE# for param_name in sorted ( parameters . keys ( ) ) : #NEWLINE# #INDENT# print ( ( '    %s=%r,' % ( param_name , best_parameters [ param_name ] ) ) ) #NEWLINE# #UNINDENT# print ( ( '== ' * 20 ) ) #NEWLINE# return grid_search