#NEWLINE# def testing_multiple_datasets_in_monitor_based_lr( ) : #NEWLINE# #INDENT# dim = 3 #NEWLINE# m = 10 #NEWLINE# rng = np . random . RandomState ( [ 6 , 2 , 2014 ] ) #NEWLINE# X = rng . randn ( m , dim ) #NEWLINE# Y = rng . randn ( m , dim ) #NEWLINE# learning_rate = 0.01 #NEWLINE# batch_size = 5 #NEWLINE# epoch_num = 1 #NEWLINE# monitoring_train = DenseDesignMatrix ( X = X ) #NEWLINE# monitoring_test = DenseDesignMatrix ( X = Y ) #NEWLINE# cost = DummyCost ( ) #NEWLINE# model = SoftmaxModel ( dim ) #NEWLINE# dataset = DenseDesignMatrix ( X = X ) #NEWLINE# termination_criterion = EpochCounter ( epoch_num ) #NEWLINE# algorithm = SGD ( learning_rate , cost , batch_size = batch_size , monitoring_batches = 2 , monitoring_dataset = { #NEWLINE# #INDENT# 'train' : monitoring_train , #NEWLINE# 'test' : monitoring_test , #NEWLINE# #UNINDENT# } , termination_criterion = termination_criterion , update_callbacks = None , set_batch_size = False ) #NEWLINE# monitor_lr = MonitorBasedLRAdjuster ( ) #NEWLINE# train = Train ( dataset , model , cost , save_path = None , save_freq = 0 , extensions = [ monitor_lr ] ) #NEWLINE# try : #NEWLINE# #INDENT# train . main_loop ( ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# raise AssertionError ( 'MonitorBasedLRAdjuster takes multiple dataset names in which more than one "objective" channel exist and the user has not specified either channel_name or database_name in the constructor to disambiguate.' )