<s> """<STR_LIT>""" <EOL> print ( __doc__ ) <EOL> import numpy as np <EOL> from matplotlib import pyplot as plt <EOL> from matplotlib . colors import ListedColormap <EOL> from sklearn . model_selection import train_test_split <EOL> from sklearn . preprocessing import StandardScaler <EOL> from sklearn . datasets import make_moons , make_circles , make_classification <EOL> from sklearn . neural_network import MLPClassifier <EOL> h = <NUM_LIT> <EOL> alphas = np . logspace ( - <NUM_LIT:5> , <NUM_LIT:3> , <NUM_LIT:5> ) <EOL> names = [ ] <EOL> for i in alphas : <EOL> names . append ( '<STR_LIT>' + str ( i ) ) <EOL> classifiers = [ ] <EOL> for i in alphas : <EOL> classifiers . append ( MLPClassifier ( alpha = i , random_state = <NUM_LIT:1> ) ) <EOL> X , y = make_classification ( n_features = <NUM_LIT:2> , n_redundant = <NUM_LIT:0> , n_informative = <NUM_LIT:2> , <EOL> random_state = <NUM_LIT:0> , n_clusters_per_class = <NUM_LIT:1> ) <EOL> rng = np . random . RandomState ( <NUM_LIT:2> ) <EOL> X += <NUM_LIT:2> * rng . uniform ( size = X . shape ) <EOL> linearly_separable = ( X , y ) <EOL> datasets = [ make_moons ( noise = <NUM_LIT> , random_state = <NUM_LIT:0> ) , <EOL> make_circles ( noise = <NUM_LIT> , factor = <NUM_LIT:0.5> , random_state = <NUM_LIT:1> ) , <EOL> linearly_separable ] <EOL> figure = plt . figure ( figsize = ( <NUM_LIT> , <NUM_LIT:9> ) ) <EOL> i = <NUM_LIT:1> <EOL> for X , y in datasets : <EOL> X = StandardScaler ( ) . fit_transform ( X ) <EOL> X_train , X_test , y_train , y_test = train_test_split ( X , y , test_size = <NUM_LIT> ) <EOL> x_min , x_max = X [ : , <NUM_LIT:0> ] . min ( ) - <NUM_LIT> , X [ : , <NUM_LIT:0> ] . max ( ) + <NUM_LIT> <EOL> y_min , y_max = X [ : , <NUM_LIT:1> ] . min ( ) - <NUM_LIT> , X [ : , <NUM_LIT:1> ] . max ( ) + <NUM_LIT> <EOL> xx , yy = np . meshgrid ( np . arange ( x_min , x_max , h ) , <EOL> np . arange ( y_min , y_max , h ) ) <EOL> cm = plt . cm . RdBu <EOL> cm_bright = ListedColormap ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> ax = plt . subplot ( len ( datasets ) , len ( classifiers ) + <NUM_LIT:1> , i ) <EOL> ax . scatter ( X_train [ : , <NUM_LIT:0> ] , X_train [ : , <NUM_LIT:1> ] , c = y_train , cmap = cm_bright ) <EOL> ax . scatter ( X_test [ : , <NUM_LIT:0> ] , X_test [ : , <NUM_LIT:1> ] , c = y_test , cmap = cm_bright , alpha = <NUM_LIT> ) <EOL> ax . set_xlim ( xx . min ( ) , xx . max ( ) ) <EOL> ax . set_ylim ( yy . min ( ) , yy . max ( ) ) <EOL> ax . set_xticks ( ( ) ) <EOL> ax . set_yticks ( ( ) ) <EOL> i += <NUM_LIT:1> <EOL> for name , clf in zip ( names , classifiers ) : <EOL> ax = plt . subplot ( len ( datasets ) , len ( classifiers ) + <NUM_LIT:1> , i ) <EOL> clf . fit ( X_train , y_train ) <EOL> score = clf . score ( X_test , y_test ) <EOL> if hasattr ( clf , "<STR_LIT>" ) : <EOL> Z = clf . decision_function ( np . c_ [ xx . ravel ( ) , yy . ravel ( ) ] ) <EOL> else : <EOL> Z = clf . predict_proba ( np . c_ [ xx . ravel ( ) , yy . ravel ( ) ] ) [ : , <NUM_LIT:1> ] <EOL> Z = Z . reshape ( xx . shape ) <EOL> ax . contourf ( xx , yy , Z , cmap = cm , alpha = <NUM_LIT> ) <EOL> ax . scatter ( X_train [ : , <NUM_LIT:0> ] , X_train [ : , <NUM_LIT:1> ] , c = y_train , cmap = cm_bright ) <EOL> ax . scatter ( X_test [ : , <NUM_LIT:0> ] , X_test [ : , <NUM_LIT:1> ] , c = y_test , cmap = cm_bright , <EOL> alpha = <NUM_LIT> ) <EOL> ax . set_xlim ( xx . min ( ) , xx . max ( ) ) <EOL> ax . set_ylim ( yy . min ( ) , yy . max ( ) ) <EOL> ax . set_xticks ( ( ) ) <EOL> ax . set_yticks ( ( ) ) <EOL> ax . set_title ( name ) <EOL> ax . text ( xx . max ( ) - <NUM_LIT> , yy . min ( ) + <NUM_LIT> , ( '<STR_LIT>' % score ) . lstrip ( '<STR_LIT:0>' ) , <EOL> size = <NUM_LIT:15> , horizontalalignment = '<STR_LIT:right>' ) <EOL> i += <NUM_LIT:1> <EOL> figure . subplots_adjust ( left = <NUM_LIT> , right = <NUM_LIT> ) <EOL> plt . show ( ) </s>
