尝试像这样在Tensorflow中创建自定义分类器
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'])
(...)
其中params['feature_columns']
的定义如下,其类型为_NumericColumn
feature_columns = [
tf.feature_column.numeric_column(training_examples['x'])
]
params={'feature_columns': feature_columns, 'n_outputs': 1}
但是,当我尝试构建模型时,
#construct model
model = tf.estimator.Estimator(
model_fn=my_model_fn,
model_dir='tensor_custom',
params=params
)
我收到以下错误
TypeError: 'Series' objects are mutable, thus they cannot be hashed
我不了解; docs建议我应该能够将_NumericColumn
传递给feature_columns
参数?
我想我在概念上缺少一些东西,但不确定是什么。任何帮助将不胜感激!