Nice article! I just have a suggestion on pred_ints function, you’ll have a great performance gain using vectorial functions:

def prediction_intervals(model, X, percentile=95):

predictions = np.array([pred.predict(X) for pred in model.estimators_])

err_down = np.apply_along_axis(lambda x: np.percentile(x, (100 – percentile) / 2.), 0, predictions)

err_up = np.apply_along_axis(lambda x: np.percentile(x, 100 – (100 – percentile) / 2.), 0, predictions)

return np.transpose(np.array([err_down, err_up]))

]]>Cheers,

]]>the -Notify me when new comments are added- checkbox and from now on whenever

a comment is added I receive four emails with the

same comment. Is there a means you are able to remove

me from that service? Thanks! ]]>

thank you ]]>

def pred_ints(model, X, percentile=95):

err_down = []

err_up = []

preds = []

for pred in model.estimators_:

preds.append(pred.predict(X))

preds = np.vstack(preds).T

err_down = np.percentile(preds, (100 – percentile) / 2., axis=1, keepdims=True)

err_up = np.percentile(preds, 100 – (100 – percentile) / 2., axis=1, keepdims=True)

return err_down.reshape(-1,), err_up.reshape(-1,)