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

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

它只附带一个 R 代码示例。有人有 Python 示例吗?

最佳答案

像这样:

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

关于python - H2O 目标均值编码在 Python 中可用吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54102766/

10-12 23:46