sklearn_quantile#


class RandomForestQuantileRegressorVectorRegressionModel(confidence: float, random_state=42, **kwargs)[source]#

Bases: AbstractSkLearnMultipleOneDimVectorRegressionModel

Parameters:
  • q – the default quantile that is used for predictions

  • kwargs – keyword arguments to pass on to RandomForestQuantileRegressor

predict_confidence_intervals(x: DataFrame, var_name: Optional[str] = None)[source]#
Parameters:
  • x – the input data

  • var_name – the predicted variable name; may be None if there is only one predicted variable

Returns:

an array of shape [2, N], where the first dimension contains the confidence interval’s lower bounds and the second its upper bounds

class QuantileRegressionMetric(name: Optional[str] = None, bounds: Optional[Tuple[float, float]] = None)[source]#

Bases: RegressionMetric, ABC

Parameters:
  • name – the name of the metric; if None use the class’ name attribute

  • bounds – the minimum and maximum values the metric can take on (or None if the bounds are not specified)

static compute_confidence_intervals(model: VectorRegressionModel, io_data: InputOutputData = None) ndarray[source]#
name: str#
class QuantileRegressionMetricAccuracyInConfidenceInterval(name: Optional[str] = None, bounds: Optional[Tuple[float, float]] = None)[source]#

Bases: QuantileRegressionMetric

Metric reflecting the accuracy of the confidence interval, i.e. the relative frequency of predictions where the confidence interval contains the ground true value

Parameters:
  • name – the name of the metric; if None use the class’ name attribute

  • bounds – the minimum and maximum values the metric can take on (or None if the bounds are not specified)

name: str = 'AccuracyInCI'#
classmethod compute_value(y_true: ndarray, y_predicted: ndarray, model: Optional[VectorRegressionModel] = None, io_data: Optional[InputOutputData] = None)[source]#
class QuantileRegressionMetricConfidenceIntervalMeanSize(name: Optional[str] = None, bounds: Optional[Tuple[float, float]] = None)[source]#

Bases: QuantileRegressionMetric

Metric for the mean size of the confidence interval

Parameters:
  • name – the name of the metric; if None use the class’ name attribute

  • bounds – the minimum and maximum values the metric can take on (or None if the bounds are not specified)

name: str = 'MeanSizeCI'#
classmethod compute_value(y_true: ndarray, y_predicted: ndarray, model: Optional[VectorRegressionModel] = None, io_data: Optional[InputOutputData] = None)[source]#
class QuantileRegressionMetricConfidenceIntervalMedianSize(name: Optional[str] = None, bounds: Optional[Tuple[float, float]] = None)[source]#

Bases: QuantileRegressionMetric

Metric for the median size of the confidence interval

Parameters:
  • name – the name of the metric; if None use the class’ name attribute

  • bounds – the minimum and maximum values the metric can take on (or None if the bounds are not specified)

name: str = 'MedianSizeCI'#
classmethod compute_value(y_true: ndarray, y_predicted: ndarray, model: Optional[VectorRegressionModel] = None, io_data: Optional[InputOutputData] = None)[source]#
class QuantileRegressionMetricRelFreqMaxSizeConfidenceInterval(max_size: float)[source]#

Bases: QuantileRegressionMetric

Relative frequency of confidence interval having the given maximum size

Parameters:
  • name – the name of the metric; if None use the class’ name attribute

  • bounds – the minimum and maximum values the metric can take on (or None if the bounds are not specified)

compute_value(y_true: ndarray, y_predicted: ndarray, model: Optional[VectorRegressionModel] = None, io_data: Optional[InputOutputData] = None)[source]#
name: str#