Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2da9f01 commit 4064301Copy full SHA for 4064301
sklearn/ensemble/gradient_boosting.py
@@ -77,7 +77,10 @@ class LogOddsEstimator(BaseEstimator):
77
"""An estimator predicting the log odds ratio."""
78
def fit(self, X, y):
79
n_pos = np.sum(y)
80
- self.prior = np.log(n_pos / (y.shape[0] - n_pos))
+ n_neg = y.shape[0] - n_pos
81
+ if n_neg == 0 or n_pos == 0:
82
+ raise ValueError('y contains non binary labels.')
83
+ self.prior = np.log(n_pos / n_neg)
84
85
def predict(self, X):
86
y = np.empty((X.shape[0], 1), dtype=np.float64)
0 commit comments