<s> """<STR_LIT>""" <EOL> from __future__ import print_function <EOL> from sklearn import datasets <EOL> from sklearn . model_selection import train_test_split <EOL> from sklearn . model_selection import GridSearchCV <EOL> from sklearn . metrics import classification_report <EOL> from sklearn . svm import SVC <EOL> print ( __doc__ ) <EOL> digits = datasets . load_digits ( ) <EOL> n_samples = len ( digits . images ) <EOL> X = digits . images . reshape ( ( n_samples , - <NUM_LIT:1> ) ) <EOL> y = digits . target <EOL> X_train , X_test , y_train , y_test = train_test_split ( <EOL> X , y , test_size = <NUM_LIT:0.5> , random_state = <NUM_LIT:0> ) <EOL> tuned_parameters = [ { '<STR_LIT>' : [ '<STR_LIT>' ] , '<STR_LIT>' : [ <NUM_LIT> , <NUM_LIT> ] , <EOL> '<STR_LIT:C>' : [ <NUM_LIT:1> , <NUM_LIT:10> , <NUM_LIT:100> , <NUM_LIT:1000> ] } , <EOL> { '<STR_LIT>' : [ '<STR_LIT>' ] , '<STR_LIT:C>' : [ <NUM_LIT:1> , <NUM_LIT:10> , <NUM_LIT:100> , <NUM_LIT:1000> ] } ] <EOL> scores = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> for score in scores : <EOL> print ( "<STR_LIT>" % score ) <EOL> print ( ) <EOL> clf = GridSearchCV ( SVC ( C = <NUM_LIT:1> ) , tuned_parameters , cv = <NUM_LIT:5> , <EOL> scoring = '<STR_LIT>' % score ) <EOL> clf . fit ( X_train , y_train ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> print ( clf . best_params_ ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> for params , mean_score , scores in clf . grid_scores_ : <EOL> print ( "<STR_LIT>" <EOL> % ( mean_score , scores . std ( ) * <NUM_LIT:2> , params ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( ) <EOL> y_true , y_pred = y_test , clf . predict ( X_test ) <EOL> print ( classification_report ( y_true , y_pred ) ) <EOL> print ( ) </s>
