diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-06-26 09:35:04 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-06-26 09:38:41 -0700 |
commit | 6b7b01a9c5df50977476b3c2892a896d9934f381 (patch) | |
tree | 9b8adc0c959825ecc63775d8dc381ae578e49414 /tensorflow/examples/learn | |
parent | e9bdfd7a10c599b1b4216372acc9e5551be8621d (diff) |
Deletes iris_val_based_early_stopping example, which uses deprecated ValidationMonitor.
PiperOrigin-RevId: 160154863
Diffstat (limited to 'tensorflow/examples/learn')
-rw-r--r-- | tensorflow/examples/learn/BUILD | 11 | ||||
-rw-r--r-- | tensorflow/examples/learn/README.md | 1 | ||||
-rwxr-xr-x | tensorflow/examples/learn/examples_test.sh | 1 | ||||
-rw-r--r-- | tensorflow/examples/learn/iris_val_based_early_stopping.py | 83 |
4 files changed, 0 insertions, 96 deletions
diff --git a/tensorflow/examples/learn/BUILD b/tensorflow/examples/learn/BUILD index 1606e1a947..91fc105f27 100644 --- a/tensorflow/examples/learn/BUILD +++ b/tensorflow/examples/learn/BUILD @@ -70,16 +70,6 @@ py_binary( ) py_binary( - name = "iris_val_based_early_stopping", - srcs = ["iris_val_based_early_stopping.py"], - srcs_version = "PY2AND3", - deps = [ - "//tensorflow:tensorflow_py", - "//tensorflow/contrib/learn", - ], -) - -py_binary( name = "iris_with_pipeline", srcs = ["iris_with_pipeline.py"], srcs_version = "PY2AND3", @@ -201,7 +191,6 @@ sh_test( ":iris_custom_decay_dnn", ":iris_custom_model", ":iris_run_config", - ":iris_val_based_early_stopping", ":iris_with_pipeline", ":random_forest_mnist", ":resnet", diff --git a/tensorflow/examples/learn/README.md b/tensorflow/examples/learn/README.md index 3166f37e78..6671d68831 100644 --- a/tensorflow/examples/learn/README.md +++ b/tensorflow/examples/learn/README.md @@ -19,7 +19,6 @@ processing (`sudo pip install pandas`). ## Techniques -* [Improving Performance Using Early Stopping with Iris Data]( https://www.tensorflow.org/code/tensorflow/examples/learn/iris_val_based_early_stopping.py) * [Using skflow with Pipeline]( https://www.tensorflow.org/code/tensorflow/examples/learn/iris_with_pipeline.py) * [Deep Neural Network with Customized Decay Function]( https://www.tensorflow.org/code/tensorflow/examples/learn/iris_custom_decay_dnn.py) diff --git a/tensorflow/examples/learn/examples_test.sh b/tensorflow/examples/learn/examples_test.sh index 8942720271..77b245ab15 100755 --- a/tensorflow/examples/learn/examples_test.sh +++ b/tensorflow/examples/learn/examples_test.sh @@ -49,7 +49,6 @@ test iris test iris_custom_decay_dnn test iris_custom_model test iris_run_config -test iris_val_based_early_stopping test iris_with_pipeline test random_forest_mnist test resnet diff --git a/tensorflow/examples/learn/iris_val_based_early_stopping.py b/tensorflow/examples/learn/iris_val_based_early_stopping.py deleted file mode 100644 index 991d1831d7..0000000000 --- a/tensorflow/examples/learn/iris_val_based_early_stopping.py +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2016 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Example of DNNClassifier for Iris plant dataset, with early stopping.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import shutil - -from sklearn import datasets -from sklearn import metrics -from sklearn.cross_validation import train_test_split -import tensorflow as tf - -learn = tf.contrib.learn - - -def clean_folder(folder): - """Cleans the given folder if it exists.""" - try: - shutil.rmtree(folder) - except OSError: - pass - - -def main(unused_argv): - iris = datasets.load_iris() - x_train, x_test, y_train, y_test = train_test_split( - iris.data, iris.target, test_size=0.2, random_state=42) - - x_train, x_val, y_train, y_val = train_test_split( - x_train, y_train, test_size=0.2, random_state=42) - val_monitor = learn.monitors.ValidationMonitor( - x_val, y_val, early_stopping_rounds=200) - - model_dir = '/tmp/iris_model' - clean_folder(model_dir) - - # classifier with early stopping on training data - classifier1 = learn.DNNClassifier( - feature_columns=learn.infer_real_valued_columns_from_input(x_train), - hidden_units=[10, 20, 10], - n_classes=3, - model_dir=model_dir) - classifier1.fit(x=x_train, y=y_train, steps=2000) - predictions1 = list(classifier1.predict(x_test, as_iterable=True)) - score1 = metrics.accuracy_score(y_test, predictions1) - - model_dir = '/tmp/iris_model_val' - clean_folder(model_dir) - - # classifier with early stopping on validation data, save frequently for - # monitor to pick up new checkpoints. - classifier2 = learn.DNNClassifier( - feature_columns=learn.infer_real_valued_columns_from_input(x_train), - hidden_units=[10, 20, 10], - n_classes=3, - model_dir=model_dir, - config=tf.contrib.learn.RunConfig(save_checkpoints_secs=1)) - classifier2.fit(x=x_train, y=y_train, steps=2000, monitors=[val_monitor]) - predictions2 = list(classifier2.predict(x_test, as_iterable=True)) - score2 = metrics.accuracy_score(y_test, predictions2) - - # In many applications, the score is improved by using early stopping - print('score1: ', score1) - print('score2: ', score2) - print('score2 > score1: ', score2 > score1) - - -if __name__ == '__main__': - tf.app.run() |