Keras Wrappers for Scikit Learn - AUC scorer is not working

后端 未结 1 1032
礼貌的吻别
礼貌的吻别 2021-01-13 13:32

I\'m trying to use Keras Scikit Learn Wrapper in order to make random search for parameters easier. I wrote an example code here where :

  1. I generate an
相关标签:
1条回答
  • 2021-01-13 13:46

    There is a bug in the KerasClassifier that is causing this issue. I have opened an issue for it on the repo. https://github.com/fchollet/keras/issues/2864

    The fix is also in there. You can define your own KerasClassifier in the mean time as a temporary workaround.

    class FixedKerasClassifier(KerasClassifier):
        def predict_proba(self, X, **kwargs):
            kwargs = self.filter_sk_params(Sequential.predict_proba, kwargs)
            probs = self.model.predict_proba(X, **kwargs)
            if(probs.shape[1] == 1):
                probs = np.hstack([1-probs,probs]) 
            return probs
    
    0 讨论(0)
提交回复
热议问题