dswah / pyGAM

[HELP REQUESTED] Generalized Additive Models in Python
https://pygam.readthedocs.io
Apache License 2.0
857 stars 157 forks source link

predict_proba not consistent with sklearn #283

Open o1iv3r opened 3 years ago

o1iv3r commented 3 years ago

LogisticGAM.predict_proba() not consistent with sklearn since it does not return a two-dimensional array. I got around this issue by defining a new derived class:

class myGAM(LogisticGAM):
    def predict_proba(self, X):
        proba = self.predict_mu(X)
        pred_proba_sklearn_like = np.array([1 - proba, proba]).T
        return pred_proba_sklearn_like

Perhaps that can be changed in future versions of pyGAM

BTW: Great package, thanks for the development!

No-Stream commented 2 years ago

+1, also encountered this; would be great to output [[proba_0, proba_1]...]

miguelfmc commented 1 year ago

Open PR here #213