scikit-learn/scikit-learn — pull request #3156 by IvicaJovic (2014-05-17 19:48:29+00:00)
Title: DOC Fix wrong confidence interval

The confidence interval should be 90% instead of 95%. Running the code below will give you 0.8997%.

```
import numpy as np
from sklearn.ensemble import GradientBoostingRegressor

np.random.seed(1)

def f(x):
return x * np.sin(x)

X = np.atleast_2d(np.random.uniform(0, 10.0, size=10000)).T
X = X.astype(np.float32)

y = f(X).ravel()

dy = 1.5 + 1.0 * np.random.random(y.shape)
noise = np.random.normal(0, dy)
y += noise
y = y.astype(np.float32)

alpha = 0.95
clf = GradientBoostingRegressor(loss='quantile', alpha=alpha,
n_estimators=250, max_depth=3,
learning_rate=.1, min_samples_leaf=9,
min_samples_split=9)

clf.fit(X, y)
y_upper = clf.predict(X)
clf.set_params(alpha=1.0 - alpha)
clf.fit(X, y)
y_lower = clf.predict(X)

interval = np.sum((y < y_upper) == (y > y_lower)) / float(10000)
print("{}% confidence interval".format(interval))
```