Sergio Bernardo Sergio Bernardo - 1 year ago 292
Python Question

Tensorflow 'features' format

I'm a total begginer with AI and tensorflow, so please forgive if this is a dumb question.
I've trained a tensorflow network using a script based on this tutorial:

I believe training was ok.
Now I whant to run this method to make a prediction for a single input:


But I cannot find any documentation on how to build the "x" parameter...
I tryed:

x = {k: tf.SparseTensor(indices=[[0, 0]], values=[d_data[k]], shape=[1, 1]) for k in COLUMNS}

d_data is a dictionary containing about 150 key/value pairs.
COLUMNS is a list with all the keys needed.
This same setup was used to train the network.

But got the error:

AttributeError: 'dict' object has no attribute 'dtype'

So... x should not be a 'dict'... but what should it be then?
Can anyone give me some directions?

Thanks a lot.

Answer Source

The BaseEstimator class has better documentation.

x: Matrix of shape [n_samples, n_features...]. Can be iterator that returns arrays of features. The training input samples for fitting the model. If set, `input_fn` must be `None`.

I will looking into getting the documentation here fixed. Thanks for pointing out.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download