简体   繁体   English

在R中打开一个腌制的sklearn文件

[英]Opening a pickled sklearn file in R

Does anyone know if I am able to open a pickled sklearn Python algorithm in R? 有谁知道我是否可以在R中打开一个腌制的sklearn Python算法? Or if I can save a trained model in sklearn in a different way that can be opened and used in R? 还是我可以用可以在R中打开和使用的其他方式将受过训练的模型保存在sklearn中? Specifically, I am looking at a gradient boosting model. 具体来说,我正在研究梯度增强模型。 Thanks! 谢谢!

I don't recommend doing what you are doing. 我不建议您做什么。 It's a lot of extra work that you don't need. 您不需要很多额外的工作。

However, in case you find yourself obliged to do that, I would think of saving my model in the binary format. 但是,如果您发现自己有义务这样做,我会考虑将我的模型保存为二进制格式。 This your best option. 这是您最好的选择。

This is possible for Xgboost see link here . Xgboost可以这样做,请参见此处的链接。

Read this answer on how to save xgboost as a binary file: link 阅读有关如何将xgboost保存为二进制文件的答案: 链接

You may want to take a look at the Reticulate package, it will allow you to call python code from R. 您可能需要看一下Reticulate软件包,它将允许您从R中调用python代码。

https://rstudio.github.io/reticulate/ https://rstudio.github.io/reticulate/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM