Search code examples
neural-networktensorflowdeep-learningskflow

Does TensorFlowDNNClassifier or any other deep neural-network model in TensorFlow support predicting of a float value?


In TensorFlowDNNClassifier, I have to specify n_classes (number of classes). What if i am predicting a float value between 0 and 1 ? there could be infinite number of classes if I want full accuracy.

To be more clear, the neural-network in skflow of TensorFlow is kind of designed for classification problem. However, I am dealing with a value predicting problem. How can I modify the model for such a float value predicting problem ?


Solution

  • A task of predicting a value between 0 and 1 is called Regression. Correspondingly, you need a TensorFlowDNNRegressor instead of TensorFlowDNNClassifier.

    The only difference in the interface is that when you call fit, y is not a class label but rather a value between 0 and 1. Similarly, predict returns a value between 0 and 1 as well.