How do I use DNNEstimator from tensorflow?

FixIT21 report abuse

When researching which algorithm to use in the text classification I stumbled upon usage of DNNClassifier. As I understand it is different from text classifiers from nltk. I already have my text embedded, but can`t quite figure what is the 'input_fn' argument passed to fit function. What is this function and how do I use DNNClassifier properly?


CarlosCV report abuse __ edited

input_fn is a function where you convert your data to '' and configure how your data is served to the model (shuffling, repeats, etc.).

Here's an example how can it be defined:

def train_input_fn(): 
dataset =, y_train)) 
dataset = dataset.shuffle(1000).repeat().batch(10) 
return dataset

You can find out more in this article:

Hope, that helps. Cheers.

Add Answer

Need support?

Just drop us an email to ... Show more