获取单热编码的 H2OFrame

Get one-hot encoded H2OFrame

我在 H2O 中使用 xgboost 进行二元分类任务。该数据集具有多个分类特征,模型在训练期间对其应用了 one-hot 编码。

现在我想使用 SHAP (https://github.com/slundberg/shap) 在本地解释预测。为此,最好让数据帧具有一次性编码的列和值。但是,我似乎无法从 H2O 模型中获取它。

我可能可以手动重新创建 one-hot 编码,但也许有人知道更快的解决方案?

我们有一个ticket open for this for a while, but we will re-visiting this soon due to increased demand for this feature. For now, you will have to convert your H2OFrame to a Pandas DataFrame using the as_data_frame() method and then apply one of the following solutions