def train_experiment(state, channel):
 yaml_template = state.yaml_template
 hyper_parameters = expand(flatten(state.hyper_parameters), dict_type=ydict)
 final_yaml_str = (yaml_template % hyper_parameters)
 train_obj = pylearn2.config.yaml_parse.load(final_yaml_str)
 try:
  iter(train_obj)
  iterable = True
 except TypeError:
  iterable = False
 if iterable:
  raise NotImplementedError('Current implementation does not support running multiple models in one yaml string.  Please change the yaml template and parameters to contain only one single model.')
 else:
  train_obj.main_loop()
  state.results = jobman.tools.resolve(state.extract_results)(train_obj)
  return channel.COMPLETE

def train_experiment ( state , channel ) : yaml_template = state . yaml_template hyper_parameters = expand ( flatten ( state . hyper_parameters ) , dict_type = ydict ) final_yaml_str = ( yaml_template % hyper_parameters ) train_obj = pylearn2 . config . yaml_parse . load ( final_yaml_str ) try : iter ( train_obj ) iterable = True except TypeError : iterable = False if iterable : raise NotImplementedError ( 'Current implementation does not support running multiple models in one yaml string.  Please change the yaml template and parameters to contain only one single model.' ) else : train_obj . main_loop ( ) state . results = jobman . tools . resolve ( state . extract_results ) ( train_obj ) return channel . COMPLETE
train a model specified in state .