pub trait Determination: Predictive {
// Provided methods
fn determination(
&self,
predictors: impl Iterator<Item = f64>,
outcomes: impl Iterator<Item = f64> + Clone,
len: usize,
) -> f64 { ... }
fn determination_slice(&self, predictors: &[f64], outcomes: &[f64]) -> f64 { ... }
}
Available on crate feature
regression
only.Expand description
Helper trait to make the R² method take a generic iterator.
This enables Predictive
to be dyn
.
Provided Methods§
sourcefn determination(
&self,
predictors: impl Iterator<Item = f64>,
outcomes: impl Iterator<Item = f64> + Clone,
len: usize,
) -> f64
fn determination( &self, predictors: impl Iterator<Item = f64>, outcomes: impl Iterator<Item = f64> + Clone, len: usize, ) -> f64
Calculates the R² (coefficient of determination), the proportion of variation in predicted model.
predictors
are the x values (input to the function).
outcomes
are the observed dependant variable.
len
is the count of data points.
If predictors
and outcomes
have different lengths, the result might be unexpected.
O(n)