tf.contrib.learn.LogisticRegressor
Stay organized with collections
Save and categorize content based on your preferences.
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
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. 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.
|
Returns |
An Estimator instance.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.learn.LogisticRegressor\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor.py#L78-L130) |\n\nBuilds a logistic regression Estimator for binary classification. \n\n tf.contrib.learn.LogisticRegressor(\n model_fn, thresholds=None, model_dir=None, config=None,\n feature_engineering_fn=None\n )\n\nTHIS CLASS IS DEPRECATED. See\n[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)\nfor general migration instructions.\n\nThis method provides a basic Estimator with some additional metrics for custom\nbinary classification models, including AUC, precision/recall and accuracy.\n\n#### Example:\n\n # See tf.contrib.learn.Estimator(...) for details on model_fn structure\n def my_model_fn(...):\n pass\n\n estimator = LogisticRegressor(model_fn=my_model_fn)\n\n # Input builders\n def input_fn_train:\n pass\n\n estimator.fit(input_fn=input_fn_train)\n estimator.predict(x=x)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `model_fn` | Model function with the signature: `(features, labels, mode) -\u003e (predictions, loss, train_op)`. Expects the returned predictions to be probabilities in \\[0.0, 1.0\\]. |\n| `thresholds` | List of floating point thresholds to use for accuracy, precision, and recall metrics. If `None`, defaults to `[0.5]`. |\n| `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. |\n| `config` | A RunConfig configuration object. |\n| `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. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| An `Estimator` instance. ||\n\n\u003cbr /\u003e"]]