how to import logistic regression and kmeans pmml files into r

拥有回忆 提交于 2019-12-12 01:54:32

问题


I am looking for some guidance please on importing pmml model files into r. PMML is a predictive model markup language which allows models built in one system to be deployed in another. I have several models that have been trained on spss and saved to the xml format using pmml. They are Logistic Regression and k-means models.

I have undertaken exhaustive searches for r capabilities to import pmml and am finding that there is only a rare function here and there in packages such as Arules for Association models. R seems to be very useful for exporting, but not importing, pmml files. As a second prize I considered using python, but it seems to be the same situation. (I am currently exploring the option of using java/weka but there are some other aspects (irrelevant to the question) why I do not want to go down this route).

So I am wondering if there is any documentation and guidance anywhere on how to build a model object in r in which I can parse the info from the pmml and create my own custom pmml import? All the info I need is in the pmml file – I just need to provide it to r in the right way, I think.

I would also consider options for same question in python. Your guidance would be very appreciated.


回答1:


"partykit" package of R has couple of implementation for importing the PMML file. Code snippets below is one such example.

require(partykit)
ttnc_pmml <- file.path(system.file("pmml", package = "partykit"),
                   "ttnc.pmml")
(ttnc_quest <- pmmlTreeModel(ttnc_pmml))


来源:https://stackoverflow.com/questions/40532336/how-to-import-logistic-regression-and-kmeans-pmml-files-into-r

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