Hi Israt,
I understand that you are trying to calculate the prediction interval coverage probability (PICP) and the mean prediction interval width (MPIW) for Gaussian Process Regression models.
Please follow the below workflow to calculate PICP and MPIW:
- Train your Gaussian Process Regression model using the “fitrgp” function
- Obtain predictions and prediction intervals using the “predict” function
- To calculate PICP:
- Define the lower and upper bounds of the prediction interval, such as yLower and yUpper, based on the prediction intervals obtained in the previous step.
- Calculate the number of observations within the prediction interval: numObservations = sum(yLower <= YTest & YTest <= yUpper).
- Calculate the PICP as the ratio of the number of observations within the prediction interval to the total number of observations: PICP = numObservations / numel(YTest)
4. To calculate MPIW:
- Calculate the width of each prediction interval: intervalWidths = yUpper - yLower
- Calculate the mean prediction interval width: MPIW = mean(intervalWidths)
Please refer to the below code snippet to calculate the PICP and MPIW:
gprMdl = fitrgp(XTrain, YTrain);
[yPred, ysd, yint] = predict(gprMdl, XTest);
numObservations = sum(yLower <= YTest & YTest <= yUpper);
PICP = numObservations / numel(YTest);
intervalWidths = yUpper - yLower;
MPIW = mean(intervalWidths);
Please refer to the below documentations to learn more about “fitrgp” and “predict” functions:
Hope it helps.
Regards,
Sai Pavan