combust/mleap

Logistic Regression prediction probabilities

オープン

#464 opened on 2018/12/22

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (312 件のフォーク)batch import
help wantedwaiting for input

Repository metrics

Stars
 (1,461 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Currently sklearn logistic classifier only supports predictions.

https://github.com/neilsummers/mleap/blob/master/python/mleap/sklearn/logistic.py

    def serialize_to_bundle(self, transformer, path, model_name):

        # compile tuples of model attributes to serialize
        attributes = list()
        attributes.append(('intercept', transformer.intercept_.tolist()[0]))
        attributes.append(('coefficients', transformer.coef_.tolist()[0]))
        attributes.append(('num_classes', 2)) # TODO: get number of classes from the transformer

        # define node inputs and outputs
        inputs = [{
                  "name": transformer.input_features,
                  "port": "features"
                }]

        outputs = [{
                  "name": transformer.prediction_column,
                  "port": "prediction"
                }]

        self.serialize(transformer, path, model_name, attributes, inputs, outputs)

Want to be able to access the probabilities from the classifier too. This is already supported in the MLeap logistic model. Just need to add the appropriate outputs. I will create a PR with the change we made to access this for our own production model.

コントリビューターガイド