Is H2O target mean encoding available in Python?

 ̄綄美尐妖づ 提交于 2019-12-10 10:23:55

问题


I noticed H2O has released the target mean encoding

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

It only comes with an R code example. Does anyone have a Python example?


回答1:


Like this:

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)

But this requires version at least 3.22

Here is a link to an example: https://github.com/h2oai/h2o-tutorials/blob/78c3766741e8cbbbd8db04d54b1e34f678b85310/best-practices/feature-engineering/feature_engineering.ipynb

And the link to code itself: https://github.com/h2oai/h2o-3/blob/master/h2o-py/h2o/targetencoder.py



来源:https://stackoverflow.com/questions/54102766/is-h2o-target-mean-encoding-available-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!