def test_live_monitoring():
 verify_zmq()
 p = mp.Process(target=train_mlp)
 p.start()
 correct_result = set(['train_objective', 'train_y_col_norms_max', 'train_y_row_norms_min', 'train_y_nll', 'train_y_col_norms_mean', 'train_y_max_max_class', 'train_y_min_max_class', 'train_y_row_norms_max', 'train_y_misclass', 'train_y_col_norms_min', 'train_y_row_norms_mean', 'train_y_mean_max_class', 'learning_rate', 'training_seconds_this_epoch', 'total_seconds_last_epoch'])
 monitor = lm.LiveMonitor()
 result = set(monitor.list_channels().data)
 if (result != correct_result):
  raise ValueError(str(result))
 assert (result == correct_result)
 monitor = lm.LiveMonitor()
 monitor.update_channels(['train_objective'], start=0, end=2)
 assert (len(monitor.channels['train_objective'].val_record) == 2)
 monitor = lm.LiveMonitor()
 monitor.update_channels(['train_objective'], start=1, end=2)
 assert (len(monitor.channels['train_objective'].val_record) == 1)
 p.join()
 assert_raises(AssertionError, monitor.update_channels, 0)
 assert_raises(AssertionError, monitor.update_channels, [])
 assert_raises(AssertionError, monitor.update_channels, ['train_objective'], start=2, end=1)

def test_live_monitoring ( ) : verify_zmq ( ) p = mp . Process ( target = train_mlp ) p . start ( ) correct_result = set ( [ 'train_objective' , 'train_y_col_norms_max' , 'train_y_row_norms_min' , 'train_y_nll' , 'train_y_col_norms_mean' , 'train_y_max_max_class' , 'train_y_min_max_class' , 'train_y_row_norms_max' , 'train_y_misclass' , 'train_y_col_norms_min' , 'train_y_row_norms_mean' , 'train_y_mean_max_class' , 'learning_rate' , 'training_seconds_this_epoch' , 'total_seconds_last_epoch' ] ) monitor = lm . LiveMonitor ( ) result = set ( monitor . list_channels ( ) . data ) if ( result != correct_result ) : raise ValueError ( str ( result ) ) assert ( result == correct_result ) monitor = lm . LiveMonitor ( ) monitor . update_channels ( [ 'train_objective' ] , start = 0 , end = 2 ) assert ( len ( monitor . channels [ 'train_objective' ] . val_record ) == 2 ) monitor = lm . LiveMonitor ( ) monitor . update_channels ( [ 'train_objective' ] , start = 1 , end = 2 ) assert ( len ( monitor . channels [ 'train_objective' ] . val_record ) == 1 ) p . join ( ) assert_raises ( AssertionError , monitor . update_channels , 0 ) assert_raises ( AssertionError , monitor . update_channels , [ ] ) assert_raises ( AssertionError , monitor . update_channels , [ 'train_objective' ] , start = 2 , end = 1 )
function that starts a secondary process to train an mlp with the livemonitoring train extension and then uses a livemonitor to query for data .