EdwinMald
EdwinMald

Reputation: 145

What is the loss function that use the DNNRegressor?

I am using DNNRegressor to train my model. I search in the documentation what is the loss function used by this wrapper but i don't find it. On the other hand, it is possible to change that loss function?.

Thank you for your suggestions.

Upvotes: 3

Views: 1513

Answers (1)

lejlot
lejlot

Reputation: 66835

It uses L2 loss (mean squared error) as defined in target_column.py:

def regression_target(label_name=None,
                      weight_column_name=None,
                      target_dimension=1):
  """Creates a _TargetColumn for linear regression.
  Args:
    label_name: String, name of the key in label dict. Can be null if label
        is a tensor (single headed models).
    weight_column_name: A string defining feature column name representing
      weights. It is used to down weight or boost examples during training. It
      will be multiplied by the loss of the example.
    target_dimension: dimension of the target for multilabels.
  Returns:
    An instance of _TargetColumn
  """
  return _RegressionTargetColumn(loss_fn=_mean_squared_loss,
                                 label_name=label_name,
                                 weight_column_name=weight_column_name,
                                 target_dimension=target_dimension)

and currently API does not support any changes here. However, since it is open source - you can always modify the constructor to call different function internally, with different loss.

Upvotes: 5

Related Questions