Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

python - ValueError: column_name: input_tensor dtype must be string or integer. dtype: <dtype: 'float32'>

I'm trying to create a packet classifier using packet flows in Tensorflow 2.4.0. When training my model using tf.estimator, I get the error:

    ValueError: column_name: avg_piat input_tensor dtype must be string or integer. dtype: <dtype: 'float32'>.

Here is a portion of the data set which contains avg_piat: enter image description here

I've tried doing everything from similar questions but nothing seems to be working. I'm thinking it might be from how I create my feature columns but I'm not sure. Here are how I create my feature columns. Thanks in advance.

min_piat = tf.feature_column.categorical_column_with_hash_bucket("min_piat",hash_bucket_size=1000)
max_piat = tf.feature_column.categorical_column_with_hash_bucket("max_piat",hash_bucket_size=1000)
avg_piat = tf.feature_column.categorical_column_with_hash_bucket("avg_piat",hash_bucket_size=1000)

## Edit ##

I solved the issue. When I defined a feature column for avg_piat I changed it from a hash bucket to a numerical column:

avg_piat = tf.feature_column.numeric_column("avg_piat")
question from:https://stackoverflow.com/questions/65903192/valueerror-column-name-input-tensor-dtype-must-be-string-or-integer-dtype-d

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...