Reputation: 143
I am trying to use tf.contrib.learn.DNNRegressor
to model a multi-input multi-output system. I have followed the Boston DNNRegressor example on the Tensorflow website, however when I try to pass an array of 2 outputs to the regressor fitter, I get
raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (100, 1) and (100, 2) are incompatible
I found this post with no responses from back in January, so it seems other people have had this problem.
I could conceivably use multiple DNNRegressors for each of the outputs, however is it possible to predict multiple outputs with a single DNNRegressor
in Tensorflow?
I am running Tensorflow 1.2.1 on Ubuntu 16.04.
Upvotes: 4
Views: 1138
Reputation: 118
This might be more than a little too late, but the current tf.estimator.DNNRegressor
has an argument label_dimension
that might do what you're looking for.
regressor = estimator.DNNRegressor(feature_columns=my_feature_columns,
label_dimension=2,
hidden_units=hidden_layers,
model_dir=MODEL_PATH)
In my case this deals perfectly with two outputs
Upvotes: 2