Learn R Programming

pintervals (version 1.0.1)

grid_finder: Grid search for lower and upper bounds of continuous conformal prediction intervals

Description

Grid search for lower and upper bounds of continuous conformal prediction intervals

Usage

grid_finder(
  y_min,
  y_max,
  ncs,
  ncs_type,
  y_hat,
  alpha,
  min_step = NULL,
  grid_size = NULL,
  calib = NULL,
  coefs = NULL,
  distance_weighted_cp = FALSE,
  distance_features_calib = NULL,
  distance_features_pred = NULL,
  distance_type = c("mahalanobis", "euclidean"),
  normalize_distance = c("minmax", "sd", "none"),
  weight_function = gauss_kern
)

Value

a tibble with the predicted values and the lower and upper bounds of the prediction intervals

Arguments

y_min

minimum value to search

y_max

maximum value to search

ncs

vector of non-conformity scores

ncs_type

String indicating the non-conformity score function to use

y_hat

vector of predicted values

alpha

confidence level

min_step

The minimum step size for the grid search

grid_size

Alternative to min_step, the number of points to use in the grid search between the lower and upper bound

calib

a tibble with the predicted values and the true values of the calibration partition. Used when weighted_cp is TRUE. Default is NULL

coefs

a numeric vector of coefficients for the heterogeneous error model. Must be of length 2, where the first element is the intercept and the second element is the slope. Used when ncs_type is 'heterogeneous_error'. Default is NULL

distance_weighted_cp

logical. If TRUE, the non-conformity scores will be weighted according to the distance function

distance_features_calib

a matrix of features for the calibration partition. Used when distance_weighted_cp is TRUE

distance_features_pred

a matrix of features for the prediction partition. Used when distance_weighted_cp is TRUE

distance_type

The type of distance metric to use when computing distances between calibration and prediction points. Options are 'mahalanobis' (default) and 'euclidean'.

normalize_distance

Either "none", "minmax", or "sd". Indicates how to normalize the distances when distance_weighted_cp is TRUE

weight_function

a function to use for weighting the distances. Can be 'gaussian_kernel', 'caucy_kernel', 'logistic', or 'reciprocal_linear'. Default is 'gaussian_kernel'