Exporting Linear SVC coefficients to PMML

47 Views Asked by At

I'm trying to export a linear SVC to PMML. I have created an sklearn pipeline (sklearn.pipeline.Pipeline) containing a SimpleImputer, a Standard scaler, and also a linear Support Vector Machine (svm.SVC(kernel="linear")).

I turn this into a PMML pipeline using the sklearn2pmml.make_pmml_pipeline function. Next, I can export this pipeline using the sklearn2pmml function. Which works great. However, if I examine the PMML file, I find that the model is saved using the support vectors. The weights or coefficients of the model are not stored in the PMML file.

I would like to have these coefficients to be able to generate a local explanation for each outcome (using the elements of the dot product of the coefficients and feature scores). Furthermore, the model now only outputs a 0 or 1 scores whereas I would like to obtain the score resulting from the dot product.

I have tried finding if it is possible to export the coefficients of the SVC instead of the support vectors, but have only found some obscure references but no real examples or applications.

Does anybody know if it's at all possible to do this with the sklearn2pmml package. Or with a different method to export an sklearn model to a PMML file?

TLDR: I tried to export a linear SVC to PMML, and although it works, it only exports the support vectors. I want the coefficients of the model as well/instead but can't seem to figure out how.

0

There are 0 best solutions below