python - Tensorflow - Extract metric keys and/or dict from tf.contrib.learn.DNNLinearCombinedRegressor -
i having problem getting metrics pre-built estimator models.this code extract metrics model:
v_metrics = { "accuracy": tf.contrib.learn.metricspec( metric_fn=tf.contrib.metrics.streaming_accuracy, prediction_key = tf.contrib.learn.predictionkey.scores), "precision": tf.contrib.learn.metricspec( metric_fn=tf.contrib.metrics.streaming_precision, prediction_key = tf.contrib.learn.predictionkey.scores), "recall": tf.contrib.learn.metricspec( metric_fn=tf.contrib.metrics.streaming_recall, prediction_key = tf.contrib.learn.predictionkey.scores) } v_monitor = tf.contrib.learn.monitors.validationmonitor( input_fn=lambda: input_fn(df_test), eval_steps = 1, every_n_steps=10, metrics=v_metrics ) m = build_estimator(model_dir, model_type) m.fit(input_fn=lambda: input_fn(df_train), steps=train_steps, monitors=[v_monitor]) results = m.evaluate(input_fn=lambda: input_fn(df_test), steps=1)
however, when run gives me:
info:tensorflow:saving dict global step 28: accuracy = 0.0, global_step = 28, loss = 24.7031, precision = 1.0, recall = 1.0
i looked api , estimator.py , metric_spec.py scripts, did find way extract tensors responsible accuracy, precision, , recall. looked @ other answers, them solutions custom estimators. checked results on tensorboard , still 0s , 1s.
note when used exact same method tf.contrib.learn.dnnlinearcombinedregressor
prediction_key = tf.contrib.learn.predictionkey.classes
works properly.
i not sure doing wrong combined regressor. know proper prediction keys (or doing wrong), when run model, gives me proper metric results.
Comments
Post a Comment