问题
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