问题
I have trained a classifier model using RapidMiner after a trying a lot of algorithms and evaluate it on my dataset. I also export the model from RapidMiner as XML and pkl file, but I can't read it in my python program (scikit-learn). Is there any way to import RapidMiner classifier/model in a python program and use it to predict or classify new data in my end application?
回答1:
Practically, I would say no - just train your model in sklearn from the beginning if that's where you want it.
Your RapidMiner model is some kind of object. The two formats you are exporting as are just storage methods. Sklearn models are a different kind of object. You can't directly save one and load it into the other. A similar example would be to ask if you can take an airplane engine and load it into a train.
To do what you're asking, you'll need to take the underlying data that your classifier saved, find the format, and then figure out a way to get it in the same format as a sklearn classifier. This is dependent on what type of classifier you have. For example, if you're using a bayesian model, you could somehow capture the prior probabilities and then use those, but this isn't trivial.
回答2:
You could use the pmml extenstion for RapidMiner to export your model.
For python there is for example the augustus library that can work with pmml files.
来源:https://stackoverflow.com/questions/37592608/can-i-export-rapidminer-model-to-integrate-with-python