如何在tf.estimator.BoostedTreesClassifier中使用numeric_column?

时间:2018-09-04 13:14:14

标签: python tensorflow machine-learning

当我尝试在张量流中将数字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的实现。

0 个答案:

没有答案