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,)

I have one question, you said -> “After training the monotone model, we can see that the relationship is now strictly monotone”

But it is not strictly monotone right, I can see there are values or intervals of x where your prediction does not change.

By definition:

Let y=f(x) be a differentiable function on an interval (a,b). If for any two points x1,x2∈(a,b) such that x1<x2, there holds the inequality f(x1)≤f(x2), the function is called increasing on ths interval.

If there holds the inequality f(x1)<f(x2), the function is called strictly increasing on the interval.

So, for my articular application it should be strictly monotonic at all intervals. Can you tell me how to achieve this in LGBM or any other method?

Thanks

Vineet

If I want to make a histogram fast and easy then I’m always using: https://www.answerminer.com/calculators/histogram

]]>