H2O目标平均编码在Python中可用吗?

时间:2019-01-09 03:14:48

标签: python h2o

我注意到H2O已发布目标均值编码

http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-munging/target-encoding.html

仅带有R代码示例。有人有Python示例吗?

1 个答案:

答案 0 :(得分:3)

赞:

from h2o.targetencoder import TargetEncoder

# Fit target encoding on training data
targetEncoder = TargetEncoder(x= ["addr_state", "purpose"], y = "bad_loan", fold_column = "cv_fold_te")
targetEncoder.fit(ext_train)

但这要求版本至少为3.22

以下是示例的链接:https://github.com/h2oai/h2o-tutorials/blob/78c3766741e8cbbbd8db04d54b1e34f678b85310/best-practices/feature-engineering/feature_engineering.ipynb

以及代码本身的链接:https://github.com/h2oai/h2o-3/blob/master/h2o-py/h2o/targetencoder.py