I have been using the estimator interface in TF 1.3 including the creation of the data input function:
training_input_fn = tf.estimator.inputs.pandas_input_fn(x=training_data, y=training_label, batch_size=64, shuffle=True, num_epochs=None)
and building the NN:
dnnclassifier = tf.estimator.DNNClassifier(
feature_columns=dnn_features,
hidden_units=[1024, 500, 100],
n_classes=2,
model_dir='./tmp/ccsprop',
optimizer=tf.train.ProximalAdagradOptimizer(
learning_rate=0.001,
l1_regularization_strength=0.01
))
and executing it
dnnclassifier.train(input_fn=training_input_fn, steps=1500)
After much searching I see no easy way to add tensorboard output without resorting to recreating the model from scratch and indicated here https://www.tensorflow.org/extend/estimators
And even then I can find no good examples to follow that both create a simple dnnClassifier with tensorboard output. any guidance?
I have the basic model working but need to examine it much more closely for tuning eventually using experiments as well. Don't see how?
Hello does this solution still work for the current version of tf.estimator? I implemented the code structure and i get "No scalar data was found", "No graph definition files were found." Is there another way I should do this? Below is my code:
Thanks.
See here for an extended discussion on GH: https://github.com/tensorflow/tensorflow/issues/12974#issuecomment-339856673
This does the trick to get a full set of TB output from canned models:
Note the last line and be observant of where you need parentheses!
When calling
DNNClassifier.train
, it acceptshooks
parameter, you can create a SummarySaverHook and add it tohooks
.Update
When add a metric (accuracy for example) into TensorBoard, you should flow several steps:
Define a
Tensor
which calculate the accuracy:acc_op = ...
;Add the
Tensor
intotf.summary.scalar
:tf.summary.scalar('acc', acc_op)
;There can be multiple
tf.summary
intf.Graph
, so we define amerge_summary_op = tf.summary.merge_all()
to get anop
to merge all the metricTensor
s.Add the merge_summary_op into a
summary_writer = tf.summary.FileWriter()
;Add the
summary_writer
into aSummarySaverHook
or call thesummary_writer
by your own code.