问题
Knime has generated for me a PMML model. At this time I want to apply this model to a python process. What is the right way to do this?
More in depth: I develop a django student attendance system. The application is already so mature that I have time to implement the 'I'm feeling lucky' button to automatically fill an attendance form. Here is where PMML comes in. Knime has generated a PMML model that predicts student attendance. Also, thanks to django for being so productive that I time for this great work ;)
回答1:
Finally I have wrote my own code. Be free to contribute or fork it:
https://github.com/ctrl-alt-d/lightpmmlpredictor
回答2:
The code for Augustus, to score PMML models in Python, is at https://code.google.com/p/augustus/
回答3:
You could use PyPMML to apply PMML in Python, for example:
from pypmml import Model
model = Model.fromFile('the/pmml/file/path')
result = model.predict(data)
The data could be dict, json, Series or DataFrame of Pandas.
If you use PMML in PySpark, you could use PyPMML-Spark, for example:
from pypmml_spark import ScoreModel
model = ScoreModel.fromFile('the/pmml/file/path')
score_df = model.transform(df)
The df is a DataFrame of PySpark.
For more info about other PMML libraries, be free to see: https://github.com/autodeployai
来源:https://stackoverflow.com/questions/15577427/apply-pmml-predictor-model-in-python