title: How to choose the threshold of the output of a dnn in tensorflow?
body: <p>I am currently learning to make neural networks with tensorflow. And the library provides a very convenient way to create one with the estimator DNNClassifier like in this tutorial: <a href="https://www.tensorflow.org/get_started/premade_estimators" rel="nofollow noreferrer">https://www.tensorflow.org/get_started/premade_estimators</a>.</p>
  
  <p>However, I don't manage to see how to choose the final treshold of the output layer before making the prediction:</p>
  
  <p>For instance, let's say we have a binary classifier between 'KO' and 'OK'. The end of the neural network compute the probabilities for each possibility for a specific sample, for instance [0.4,0.6] (so 40% that the answer is 'KO' and 60% that the answer is 'OK'). I assume that the dnn takes by default a threshold of 0.5, so it will answer 'OK' here. But I want to change this threshold to 0.8 so that if the dnn is not sure at 80% for 'OK', it will answer 'KO' (in order to tune the FP-rate and the FN-rate).
  How can we do that ? </p>
  
  <p>Thanks in advance for your help.</p>