ワイド アンド ディープ ラーニング モデルを作成する方法について説明しているこの Tensorflow 記事のソース コードを見ています。https://www.tensorflow.org/versions/r1.3/tutorials/wide_and_deep
Python ソース コードへのリンクは次のとおりです: https://github.com/tensorflow/tensorflow/blob/r1.3/tensorflow/examples/learn/wide_n_deep_tutorial.py
その目的は、国勢調査情報のデータを基に、年収が 5 万ドルを超えるか下回るかを予測するモデルをトレーニングすることです。
指示どおり、次のコマンドを実行して実行しています。
python wide_n_deep_tutorial.py --model_type=wide_n_deep
私が得る結果は次のとおりです。
$ python wide_n_deep.py --model_type=wide_n_deep
Training data is downloaded to /tmp/tmp_pwqo2h8
Test data is downloaded to /tmp/tmph6jcimik
2018-01-03 05:34:12.236038: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
WARNING:tensorflow:enqueue_data was called with num_epochs and num_threads > 1. num_epochs is applied per thread, so this will produce more epochs than you probably intend. If you want to limit epochs, use one thread.
WARNING:tensorflow:enqueue_data was called with shuffle=False and num_threads > 1. This will create multiple threads, all reading the array/dataframe in order. If you want examples read in order, use one thread; if you want multiple threads, enable shuffling.
WARNING:tensorflow:Casting <dtype: 'float32'> labels to bool.
WARNING:tensorflow:Casting <dtype: 'float32'> labels to bool.
model directory = /tmp/tmp_ab6cfsf
accuracy: 0.808673
accuracy_baseline: 0.763774
auc: 0.841373
auc_precision_recall: 0.66043
average_loss: 0.418642
global_step: 2000
label/mean: 0.236226
loss: 41.8154
prediction/mean: 0.251593
私がオンラインで見たさまざまな記事では、.ckpt
ファイルへのロードについて説明しています。モデル ディレクトリを見ると、次のファイルが表示されます。
$ ls /tmp/tmp_ab6cfsf
checkpoint eval events.out.tfevents.1514957651.ml-1 graph.pbtxt model.ckpt-1.data-00000-of-00001 model.ckpt-1.index model.ckpt-1.meta model.ckpt-2000.data-00000-of-00001 model.ckpt-2000.index model.ckpt-2000.meta
私が使用するものはだと思いますがmodel.ckpt-1.meta
、それは正しいですか?
しかし、このモデル データの使用方法とフィード方法についても混乱しています。Tensorflow のウェブサイトでこの記事を見てきました: https://www.tensorflow.org/versions/r1.3/programmers_guide/saved_model
これは、「Estimators は変数を (model_dir に) 自動的に保存および復元することに注意してください」と述べています。(この文脈でそれが何を意味するのかはわかりません)
給与を除いて、国勢調査データの形式で情報を生成するにはどうすればよいですか? 予測を行うためにトレーニング済みモデルを使用できるようにするために、2 つの Tensorflow 記事を使用する方法は私には明らかではありません。