
60
|
第
2
章
Triplets(3)
、
Quadruplets(4)
、
Quintuplets(5)
、
Multiple (2+)
),所以有
18
个可能的
(
is_male
,
plurality
)对。如果我们将
hash_bucket_size
设置
为
1000
,我们可
以
85%
确定没有冲突。
最后,要在
DNN
模型中使用交叉列,我们需要将其包装在
indicator_column
或
embedding_column
中,具体取决于我们是要对其进行独热编码还是以较低的维度表
示(请参阅本章的“设计模式
2
:嵌入”一节):
gender_x_plurality = fc.crossed_column(["is_male", "plurality"],
hash_bucket_size=1000)
crossed_feature = fc.embedding_column(gender_x_plurality, dimension=2)
或者
gender_x_plurality = fc.crossed_column(["is_male", "plurality"],
hash_bucket_size=1000)
crossed_feature = fc.indicator_column(gender_x_plurality)
为什么有效
特征交叉为特征工程提供了一种有价值的方法。它们为简单的模型提供了更高的复杂 ...