<s> """<STR_LIT>""" <EOL> from neon . data import ArrayIterator , load_mnist <EOL> from neon . initializers import Gaussian , Constant <EOL> from neon . layers import GeneralizedCost , Affine <EOL> from neon . models import Model <EOL> from neon . optimizers import GradientDescentMomentum , MultiOptimizer , RMSProp <EOL> from neon . transforms import Rectlin , Logistic , CrossEntropyBinary <EOL> from neon . callbacks . callbacks import Callbacks <EOL> from neon . util . argparser import NeonArgparser <EOL> parser = NeonArgparser ( __doc__ ) <EOL> args = parser . parse_args ( ) <EOL> ( X_train , y_train ) , ( X_test , y_test ) , nclass = load_mnist ( args . data_dir ) <EOL> train_set = ArrayIterator ( X_train , y_train , nclass = nclass , lshape = ( <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> valid_set = ArrayIterator ( X_test , y_test , nclass = nclass , lshape = ( <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> init_norm = Gaussian ( loc = <NUM_LIT:0.0> , scale = <NUM_LIT> ) <EOL> layers = [ ] <EOL> layers . append ( Affine ( nout = <NUM_LIT:100> , init = init_norm , bias = Constant ( <NUM_LIT:0> ) , <EOL> activation = Rectlin ( ) ) ) <EOL> layers . append ( Affine ( nout = <NUM_LIT:10> , init = init_norm , bias = Constant ( <NUM_LIT:0> ) , <EOL> activation = Logistic ( shortcut = True ) , <EOL> name = '<STR_LIT>' ) ) <EOL> cost = GeneralizedCost ( costfunc = CrossEntropyBinary ( ) ) <EOL> mlp = Model ( layers = layers ) <EOL> optimizer_one = GradientDescentMomentum ( learning_rate = <NUM_LIT:0.1> , momentum_coef = <NUM_LIT> ) <EOL> optimizer_two = RMSProp ( ) <EOL> opt = MultiOptimizer ( { '<STR_LIT:default>' : optimizer_one , <EOL> '<STR_LIT>' : optimizer_two , <EOL> '<STR_LIT>' : optimizer_two } ) <EOL> callbacks = Callbacks ( mlp , eval_set = valid_set , ** args . callback_args ) <EOL> mlp . fit ( train_set , optimizer = opt , num_epochs = args . epochs , cost = cost , callbacks = callbacks ) </s>
