【问题标题】:Is H2O target mean encoding available in Python?Python 中是否提供 H2O 目标均值编码?
【发布时间】:2019-06-03 19:01:54
【问题描述】:

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

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

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

【问题讨论】:

  • 为了您将来的方便,请注意您提供链接的文档随附 R 和 Python 代码示例。请在代码 sn-ps 上方查找切换。切换按页面工作,因此只需单击其中任何一个即可更改语言。

标签: python h2o


【解决方案1】:

像这样:

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2019-06-20
  • 1970-01-01
  • 2019-08-23
  • 2018-10-31
  • 1970-01-01
  • 2018-03-01
  • 2016-07-27
  • 1970-01-01
相关资源
最近更新 更多