Registry / ai-ml / tensorflow-estimator

tensorflow-estimator

JSON →
library2.15.0pypypi✓ verified 29d ago

The TensorFlow Estimator library provides a high-level API for training machine learning models, simplifying the process of training, evaluating, and predicting. While still maintained for existing projects, it is officially not recommended for new code, with Keras being the preferred API in modern TensorFlow. It generally follows the TensorFlow core release cadence.

pip install tensorflow-estimator
INSTALL
IMPORT
SIG · TENSORFLOW-ESTIMAT
T
tensorflow-estimator
ai-mlpythonv2.15.0
Install
17.6s avg
Import
—
Disk
1161MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.15.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
1/2 runs
✓ 17.6s
py 3.11
1/2 runs
✓ 16.45s
py 3.12
1/2 runs
✓ 15.45s
py 3.13
1/2 runs
✓ 15.3s
py 3.9
1/2 runs
✓ 23.35s
1161MB installed
● package 1161MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Estimator
✓ from tensorflow_estimator import Estimator
✗ from tensorflow_estimator.python.estimator.estimator import Estimator

This quickstart demonstrates how to create, train, and make predictions with a `DNNRegressor` using `tf.estimator`. It defines a simple input function for training and prediction, and then trains the model for a few steps before predicting on new data.

import tensorflow as tf # Define feature columns feature_columns = [ tf.feature_column.numeric_column('x', shape=[1]) ] # Define the estimator estimator = tf.estimator.DNNRegressor( feature_columns=feature_columns, hidden_units=[10, 10], model_dir='/tmp/DNNRegressor_model' ) # Define input function for training def input_fn_train(): features = {'x': tf.constant([1., 2., 3., 4.])} labels = tf.constant([0., -1., -2., -3.]) return tf.data.Dataset.from_tensor_slices((features, labels)).repeat().batch(2) # Define input function for prediction def input_fn_predict(): features = {'x': tf.constant([5., 6.])} return tf.data.Dataset.from_tensor_slices(features).batch(2) # Train the estimator print('Training the model...') estimator.train(input_fn=input_fn_train, steps=100) print('Training complete.') # Predict print('Making predictions...') predictions = list(estimator.predict(input_fn=input_fn_predict)) for p in predictions: print(f"Prediction: {p['predictions'][0]:.2f}")
Debug
Known issues
deprecatedEstimators are not recommended for new code. TensorFlow's official stance is to prefer Keras for new development due to its simpler API, better integration with TF2.x eager execution, and broader community support.
fix
For new projects, use `tf.keras.Model` or `tf.keras.Sequential` directly. For existing projects, consider migrating your Estimator code to Keras as part of a modernization effort.
affects: 2.0.0 and later
gotchaEstimators are designed primarily for graph execution in a TF1.x style. While they run in TF2.x, they often hide the underlying TF2.x features and may not fully leverage eager execution in the same way native Keras models do, potentially leading to less intuitive debugging or performance limitations compared to pure Keras.
fix
If migrating is not feasible, ensure you understand the execution model of Estimators. For advanced use cases or when eager execution is critical, Keras is the recommended path.
affects: 2.0.0 and later
gotchaThe `tensorflow-estimator` package provides the `tf.estimator` namespace, but it's typically installed automatically as a dependency of the main `tensorflow` package. Manually installing `tensorflow-estimator` without `tensorflow` will not provide a functional `tf.estimator` API unless `tensorflow` is already present or installed separately.
fix
Always install the main `tensorflow` package (e.g., `pip install tensorflow`) to ensure all necessary components, including Estimator, are correctly set up and accessible via `import tensorflow as tf`.
affects: All versions
Upgrade
Version history
2.15.0latest on PyPI · released Nov 7, 2023
Audit
Dependencies
tensorflowrequiredEstimator is built on TensorFlow and requires it to run. Installing `tensorflow` directly will also install `tensorflow-estimator`.
Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
1
Resources
tensorflow-estimator — pip install tensorflow-estimator · libregistry