def test_adagard_max_scaling():
 try:
  AdaGrad((-1.0))
  allows_null = True
 except AssertionError:
  allows_null = False
 assert (not allows_null)
 def one_case(dataset_type, model_type):
  (cost, model, dataset, sgd, state) = prepare_adagrad_test(dataset_type, model_type)
  sgd.train(dataset=dataset)
  for param in model.get_params():
   assert (not np.any(np.isnan(param.get_value())))
 one_case('zeros', 'zeros')
 one_case('arange', 'zeros')
 one_case('zeros', 'random')
 one_case('arange', 'random')

def test_adagard_max_scaling ( ) : try : AdaGrad ( ( - 1.0 ) ) allows_null = True except AssertionError : allows_null = False assert ( not allows_null ) def one_case ( dataset_type , model_type ) : ( cost , model , dataset , sgd , state ) = prepare_adagrad_test ( dataset_type , model_type ) sgd . train ( dataset = dataset ) for param in model . get_params ( ) : assert ( not np . any ( np . isnan ( param . get_value ( ) ) ) ) one_case ( 'zeros' , 'zeros' ) one_case ( 'arange' , 'zeros' ) one_case ( 'zeros' , 'random' ) one_case ( 'arange' , 'random' )
tests the max_scaling argument to the constructor .