I am trying to write Linear classifier using Tensorflow using the following code which works.
m = LinearClassifier(model_dir = model_dir, feature_columns = wide_columns)
m.fit (input_fn=training, steps=FLAGS.train_steps)
results = h.evaluate(input_fn=test, steps=1)
for key in sorted(results):
print ("%s: %s", key, results[key])
However, I am interested in having an ndarray of predictions (i.e. array of 0s and 1s) for each test-feature. I would like to compute some more values (than accuracy and precision) based on these predictions.
Following is the output I get:
accuracy: 0.931035
accuracy/baseline_label_mean: 0.931035
accuracy/threshold_0.500000_mean: 0.931035
auc: 0.5
global_step: 202
labels/actual_label_mean: 0.931035
labels/prediction_mean: 1.0
loss: 1.11758e+11
precision/positive_threshold_0.500000_mean: 0.931035
recall/positive_threshold_0.500000_mean: 1.0
Following is the output I expect: (first five numbers are training features and 1 and 0 is the label of classifier)
1,2,3,4,5 : 1
3,4,4,2,1 : 0
1,2,3,4,1 : 1
1,2,3,4,5 : 1
4,4,2,2,2 : 0
5,4,1,2,1 : 0
How can I get such an output from Tensorflow APIs ?