official/wide_deep/ydq_wide_deep_model.py
def run_census(flags_obj):
  """Construct all necessary functions and call run_loop.

  Args:
    flags_obj: Object containing user specified flags.
  """
  if flags_obj.download_if_missing:
    census_dataset.download(flags_obj.data_dir)

  train_file = os.path.join(flags_obj.data_dir, census_dataset.TRAINING_FILE)
  test_file = os.path.join(flags_obj.data_dir, census_dataset.EVAL_FILE)

  # Train and evaluate the model every `flags.epochs_between_evals` epochs.
  def train_input_fn():
    return census_dataset.input_fn(
        train_file, flags_obj.epochs_between_evals, True, flags_obj.batch_size)

  def eval_input_fn():
    return census_dataset.input_fn(test_file, 1, False, flags_obj.batch_size)

  tensors_to_log = {
      'average_loss': '{loss_prefix}head/truediv',
      'loss': '{loss_prefix}head/weighted_loss/Sum'
  }

  wide_deep_run_loop.run_loop(
      name="Census Income", train_input_fn=train_input_fn,
      eval_input_fn=eval_input_fn,
      model_column_fn=census_dataset.build_model_columns,
      build_estimator_fn=build_estimator,
      flags_obj=flags_obj,
      tensors_to_log=tensors_to_log,
      early_stop=True)
Construct all necessary functions and call run_loop.

  Args:
    flags_obj: Object containing user specified flags.
  
Construct all necessary functions and call run_loop.
Construct all necessary functions and call run_loop .
def run_census(flags_obj):
  if flags_obj.download_if_missing:
    census_dataset.download(flags_obj.data_dir)
  train_file = os.path.join(flags_obj.data_dir, census_dataset.TRAINING_FILE)
  test_file = os.path.join(flags_obj.data_dir, census_dataset.EVAL_FILE)
  def train_input_fn():
    return census_dataset.input_fn(
        train_file, flags_obj.epochs_between_evals, True, flags_obj.batch_size)
  def eval_input_fn():
    return census_dataset.input_fn(test_file, 1, False, flags_obj.batch_size)
  tensors_to_log = {
      'average_loss': '{loss_prefix}head/truediv',
      'loss': '{loss_prefix}head/weighted_loss/Sum'
  }
  wide_deep_run_loop.run_loop(
      name="Census Income", train_input_fn=train_input_fn,
      eval_input_fn=eval_input_fn,
      model_column_fn=census_dataset.build_model_columns,
      build_estimator_fn=build_estimator,
      flags_obj=flags_obj,
      tensors_to_log=tensors_to_log,
      early_stop=True)
def run_census ( flags_obj ) : if flags_obj . download_if_missing : census_dataset . download ( flags_obj . data_dir ) train_file = os . path . join ( flags_obj . data_dir , census_dataset . TRAINING_FILE ) test_file = os . path . join ( flags_obj . data_dir , census_dataset . EVAL_FILE ) def train_input_fn ( ) : return census_dataset . input_fn ( train_file , flags_obj . epochs_between_evals , True , flags_obj . batch_size ) def eval_input_fn ( ) : return census_dataset . input_fn ( test_file , 1 , False , flags_obj . batch_size ) tensors_to_log = { 'average_loss' : '{loss_prefix}head/truediv' , 'loss' : '{loss_prefix}head/weighted_loss/Sum' } wide_deep_run_loop . run_loop ( name = "Census Income" , train_input_fn = train_input_fn , eval_input_fn = eval_input_fn , model_column_fn = census_dataset . build_model_columns , build_estimator_fn = build_estimator , flags_obj = flags_obj , tensors_to_log = tensors_to_log , early_stop = True )
Construct all necessary functions and call run_loop.
Construct all necessary functions and call run_loop .
"""Construct all necessary functions and call run_loop.

  Args:
    flags_obj: Object containing user specified flags.
  """ # Train and evaluate the model every `flags.epochs_between_evals` epochs.
flags_obj
Object containing user specified flags.
Object containing user specified flags .