User friendly weight normalization
For simplicity, the weight normalization in case of nonexchangeable CP needs to be done inside the method deel.puncc.api.calibration.BaseCalibrator.calibrate.
Also, documentation should clarify if the weights passed as arguments are to be normalized or not.
I have a question related to this issue. In the paper https://proceedings.mlr.press/v204/mendil23a/mendil23a.pdf, it is mentioned that Weighted Split Conformal Prediction (WSCP) can be implemented as follows:
# Definition of exponentially decaying weights function
def exp_decay(X):
k = len(X)
return [0.99 ** (k + 1 - i) for i in range(k)]
# Definition of split conformal predictor whose nonconformity scores
# are weighted according to the function defined above
wscp = SplitCP(predictor , weight_func = exp_decay)
I tried it out, but I always encounter an IndexError (sorted_cumsum_weights = np.cumsum(w[sorted_idx], axis=axis)) when I try to call wscp.predict(). Can you maybe provide a complete example that complements the one in the paper? Based on your above comment, one maybe has to work with the calibrator instead?
Ok, I just saw that there is an open pull request for a very helpful tutorial on time series CP (https://github.com/deel-ai/puncc/blob/mouhcine-ts-tutorial/docs/puncc_timeseries.ipynb). This is what I needed to better understand the weighting method.