pub struct QuantileRegressorSGBT { /* private fields */ }alloc only.Expand description
Non-crossing multi-quantile SGBT regressor.
Maintains K independent SGBT<QuantileLoss> models – one per quantile
level – and applies the Pool Adjacent Violators Algorithm (PAVA) to
predictions to guarantee non-crossing quantile estimates.
§Non-crossing guarantee
For quantile levels tau_1 < tau_2 < … < tau_K, the predicted values q_hat(tau_1) <= q_hat(tau_2) <= … <= q_hat(tau_K) after PAVA enforcement. This makes the output suitable for prediction intervals, conditional density estimation, and risk quantification.
Implementations§
Source§impl QuantileRegressorSGBT
impl QuantileRegressorSGBT
Sourcepub fn new(config: SGBTConfig, quantiles: &[f64]) -> Result<Self>
pub fn new(config: SGBTConfig, quantiles: &[f64]) -> Result<Self>
Create a new multi-quantile regressor.
Quantile levels are automatically sorted. Each level must be in (0, 1) and there must be at least one level.
§Errors
Returns IrithyllError::InvalidConfig if:
quantilesis empty- any quantile is not in (0, 1)
- duplicate quantile levels exist
Sourcepub fn train_one(&mut self, sample: &impl Observation)
pub fn train_one(&mut self, sample: &impl Observation)
Train all quantile models on a single observation.
Each model independently learns from the same sample, targeting its respective quantile level.
Sourcepub fn train_batch<O: Observation>(&mut self, samples: &[O])
pub fn train_batch<O: Observation>(&mut self, samples: &[O])
Train on a batch of observations.
Sourcepub fn predict(&self, features: &[f64]) -> Vec<f64>
pub fn predict(&self, features: &[f64]) -> Vec<f64>
Predict quantile values with PAVA non-crossing enforcement.
Returns a Vec<f64> of length n_quantiles where:
result[i]is the predicted quantile at levelquantiles[i]result[0] <= result[1] <= ... <= result[K-1](guaranteed)
Sourcepub fn predict_raw(&self, features: &[f64]) -> Vec<f64>
pub fn predict_raw(&self, features: &[f64]) -> Vec<f64>
Predict raw quantile values WITHOUT non-crossing enforcement.
This may produce crossing predictions. Use predict
for the PAVA-enforced version.
Sourcepub fn predict_interval(&self, features: &[f64]) -> (f64, f64, f64)
pub fn predict_interval(&self, features: &[f64]) -> (f64, f64, f64)
Predict a symmetric prediction interval at coverage level 1 - alpha.
Returns (lower, median, upper) if the model was constructed with
quantile levels that include alpha/2, 0.5, and 1 - alpha/2.
If the exact levels are not present, returns the closest available quantile predictions with PAVA enforcement applied.
Sourcepub fn predict_batch(&self, feature_matrix: &[Vec<f64>]) -> Vec<Vec<f64>>
pub fn predict_batch(&self, feature_matrix: &[Vec<f64>]) -> Vec<Vec<f64>>
Batch prediction with PAVA enforcement.
Sourcepub fn n_quantiles(&self) -> usize
pub fn n_quantiles(&self) -> usize
Number of quantile levels.
Sourcepub fn n_samples_seen(&self) -> u64
pub fn n_samples_seen(&self) -> u64
Total samples seen.
Sourcepub fn model(&self, idx: usize) -> &SGBT<QuantileLoss>
pub fn model(&self, idx: usize) -> &SGBT<QuantileLoss>
Sourcepub fn models(&self) -> &[SGBT<QuantileLoss>]
pub fn models(&self) -> &[SGBT<QuantileLoss>]
Access all quantile models.