def predict_proba(self, X):
if len(X.shape)==1: # IG modif Feb3 2015
X = np.reshape(X,(-1,1))
prediction = self.predictors[0].predict_proba(X)
if self.n_label==2: # Keep only 1 prediction, 1st column = (1 - 2nd column)
prediction = prediction[:,1]
for i in range(1,self.n_target): # More than 1 target, we assume that labels are binary
new_prediction = self.predictors[i].predict_proba(X)[:,1]
prediction = np.column_stack((prediction, new_prediction))
return prediction
评论列表
文章目录