jpmml / jpmml-sklearn

Java library and command-line application for converting Scikit-Learn pipelines to PMML
GNU Affero General Public License v3.0
531 stars 117 forks source link

Change of output probability in PMML #181

Closed axemixer closed 1 year ago

axemixer commented 1 year ago

Hi ,

I have a custom calibration function and I want to apply it to the final prediction of PMML result. Can I integrate it into PMML or It has to be outside ?

vruusmann commented 1 year ago

See https://openscoring.io/blog/2022/05/06/sklearn_prediction_postprocessing/

This article should have surfaced with very minimal googling effort.

In your case, please specify the calibration function as the PMMLPipeline.predict_proba_transformer attribute.

axemixer commented 1 year ago

Hi vrussmann , thank you but I'd seen this article before write down here.

I just want to use some calibration function like below one into pmml only in prediction value as you said "decision engineering".

def custom_function(): return 1-ln(prediction)

Sorry but I could not find exact same examples that lead me the correct implementation.

vruusmann commented 1 year ago

def custom_function(): return 1-ln(prediction)

FFS:

pipeline = PMMLPipeline([...], predict_transformer = ExpressionTransformer("1.0 - numpy.log(X[0])"))