tf.contrib.learn.LogisticRegressor(
model_fn,
thresholds=None,
model_dir=None,
config=None,
feature_engineering_fn=None
)
Defined in tensorflow/contrib/learn/python/learn/estimators/logistic_regressor.py
.
Builds a logistic regression Estimator for binary classification.
THIS CLASS IS DEPRECATED. See 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)
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. IfNone
, 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 ofinput_fn
and returns features and labels which will be fed into the model.
Returns:
An Estimator
instance.