rules/mapie/predict-and-predict-interval.md

predict_interval already returns the point predictions as its first value, so calling predict too runs the model twice. Unpack both from one predict_interval call.

diff
1-y_pred = mapie.predict(X_test)
2-_, y_pis = mapie.predict_interval(X_test)
3+y_pred, y_pis = mapie.predict_interval(X_test)

What the rule reports

The rule reports predict on the same object and the same rows as a predict_interval or predict_set in the same block.

The rule matches the two calls by receiver and input. It can do so without resolving the receiver's class.

How to fix it

xpd has no automatic fix. The rewrite needs a new name and changes two statements. Make the change by hand.

predict_interval and predict_set return the point predictions as their first value. With a forest of 50 trees on one thread, both forms returned the same arrays, bit for bit, and the pair of calls took longer than the single call:

CallsAt 2,000 rowsAt 20,000 rows
predict and predict_interval, against predict_interval alone1.99 times1.99 times
predict and predict_set, against predict_set alone1.98 times1.97 times

The two calls must be statements of the same block and name the same object and the same rows.