# tf.contrib.learn.LogisticRegressor

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor.py#L78-L130) |

Builds a logistic regression Estimator for binary classification.

    tf.contrib.learn.LogisticRegressor(
        model_fn, thresholds=None, model_dir=None, config=None,
        feature_engineering_fn=None
    )

THIS CLASS IS DEPRECATED. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for general migration instructions.

This method provides a basic Estimator with some additional metrics for custom
binary classification models, including AUC, precision/recall and accuracy.

#### Example:

      # See tf.contrib.learn.Estimator(...) for details on model_fn structure
      def my_model_fn(...):
        pass

      estimator = LogisticRegressor(model_fn=my_model_fn)

      # Input builders
      def input_fn_train:
        pass

      estimator.fit(input_fn=input_fn_train)
      estimator.predict(x=x)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `model_fn` | Model function with the signature: `(features, labels, mode) -> (predictions, loss, train_op)`. Expects the returned predictions to be probabilities in \[0.0, 1.0\]. |
| `thresholds` | List of floating point thresholds to use for accuracy, precision, and recall metrics. If `None`, defaults to `[0.5]`. |
| `model_dir` | Directory to save model parameters, graphs, etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model. |
| `config` | A RunConfig configuration object. |
| `feature_engineering_fn` | Feature engineering function. Takes features and labels which are the output of `input_fn` and returns features and labels which will be fed into the model. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An `Estimator` instance. ||

<br />