Tensorflow custom estimator: 'Series' objects are mutable, thus they cannot be hashed
Tensorflow custom estimator: 'Series' objects are mutable, thus they cannot be hashed
Trying to create a custom classifier in Tensorflow like so
def my_model_fn(
features, # This is batch_features from input_fn
labels, # This is batch_labels from input_fn
mode, # An instance of tf.estimator.ModeKeys
params # Additional configuration
):
input_layer = tf.feature_column.input_layer(features,
feature_columns=params['feature_columns'])
(...)
where params['feature_columns']
is defined as below, and is of type _NumericColumn
params['feature_columns']
_NumericColumn
feature_columns = [
tf.feature_column.numeric_column(training_examples['x'])
]
params={'feature_columns': feature_columns, 'n_outputs': 1}
When I try and construct the model, however,
#construct model
model = tf.estimator.Estimator(
model_fn=my_model_fn,
model_dir='tensor_custom',
params=params
)
I receive the following error
TypeError: 'Series' objects are mutable, thus they cannot be hashed
Which I don't understand; the docs suggest that I should be able to pass a _NumericColumn
to the feature_columns
argument?
_NumericColumn
feature_columns
I suppose I'm missing something conceptually, but not sure what it is. Any help would be appreciated!
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment