当我尝试在张量流中将数字feature_column馈送到tf.estimator.BoostedTreesClassifier时,程序会引发错误,BoostedTreesClassifier仅支持bucketized and indicator columns。我的问题是如何向GBDT馈送数字,因为存储桶列要求用户提前提供特定的bindaries,当数据集太大而无法保存在内存中时,这是不实际的。
# First, convert the raw input to a numeric column.
numeric_feature_column = tf.feature_column.numeric_column("Year")
# Then, bucketize the numeric column on the years 1960, 1980, and 2000.
bucketized_feature_column = tf.feature_column.bucketized_column(
source_column = numeric_feature_column,
boundaries = [1960, 1980, 2000])
Reference使用bucketized_column的实现。