【问题标题】:Load and use XGBoost PMML or XGBoost .rds model in python sklearn with out loosing its dependencies/nature在 python sklearn 中加载和使用 XGBoost PMML 或 XGBoost .rds 模型,而不会丢失其依赖项/性质
【发布时间】:2020-02-15 03:37:30
【问题描述】:

我有一个内置于 R 中的 XGB 模型,我想在 python 中使用相同的模型进行预测,而不会失去其性质/嵌入式依赖项。

我试过 rpy2 和 sklearn-pmml-model,似乎对 XGBoost 模型没有帮助。

感谢任何帮助。

【问题讨论】:

    标签: python r machine-learning xgboost pmml


    【解决方案1】:

    您可以使用PyPMML 在 Python 中评估 XGBoost PMML,例如:

    from pypmml import Model
    
    model = Model.fromFile('the/pmml/model/file/path')
    result = predict(data)
    

    data 可以是字典、Pandas 的 Series 或 DataFrame 或 JSON 字符串。

    【讨论】:

      猜你喜欢
      • 2019-06-05
      • 2021-09-16
      • 2017-04-28
      • 2019-10-13
      • 1970-01-01
      • 2021-09-23
      • 2021-04-07
      • 2018-08-27
      • 2021-02-21
      相关资源
      最近更新 更多