pub struct FindKOptimalOutput {
pub k_star: usize,
pub selector: String,
pub cv_scores: Option<BTreeMap<usize, f64>>,
pub cv_scores_se: Option<BTreeMap<usize, f64>>,
pub bic_scores: Option<BTreeMap<usize, f64>>,
pub pvalues: Option<Col<f64>>,
pub diagnostic: Option<String>,
pub seed: u64,
pub n_eff: f64,
pub stable_rank: Option<f64>,
}Expand description
Result of pls1_find_k_optimal.
Fields§
§k_star: usizeThe selected number of components. 0 when the full-data fit cannot
extract a first component (y constant, or orthogonal to X up to
rounding: the k_used = 0 zero model of pls1_fit); the score maps
are then empty and the diagnostic, if requested, tests nothing.
selector: StringSelection criterion used ("r2_se", "r2_max", or "bic").
cv_scores: Option<BTreeMap<usize, f64>>CV R² per K (present for R2Se and R2Max selectors).
cv_scores_se: Option<BTreeMap<usize, f64>>SE of CV R² per K (present only for R2Se selector).
bic_scores: Option<BTreeMap<usize, f64>>BIC scores per K (present only for Bic selector).
pvalues: Option<Col<f64>>Per-component p-values from the same-sample sequential diagnostic up to
K* (present when diagnostic.is_some()). Same-sample → diagnostic only,
not honest inference.
diagnostic: Option<String>Name of the diagnostic method that actually ran (present when
diagnostic.is_some()). A split_nb request the sequence-level
auto-gate flagged reads "split_exact".
seed: u64RNG seed actually used.
n_eff: f64Kish’s effective sample size. Equals n_samples for uniform/absent weights.
stable_rank: Option<f64>Stable rank of the standardized X, as the sequence-level auto-gate saw
it. Some whenever diagnostic == Some(SplitNb) — whether the gate
fired or not, and also under force. None otherwise, including when
no diagnostic was requested. NaN when the Gram matrix of the
standardized X is not finite; the gate then fires.
Implementations§
Source§impl FindKOptimalOutput
impl FindKOptimalOutput
Sourcepub fn k_to_fit(&self) -> PlsKitResult<usize>
pub fn k_to_fit(&self) -> PlsKitResult<usize>
The component count a fit at the selected K uses: k_star.
This is the policy of pls1_fit(k = "optimal") in every wrapper,
kept here so they share it: selection and fit are separate calls,
and a wrapper that composes them asks this rather than reading
k_star itself.
§Errors
PlsKitError::OptimalNoComponent when k_star == 0 (no first
component can be extracted). An explicit k still fits the
k_used = 0 zero model; this refuses only to present that model as
the selected one.
Trait Implementations§
Source§impl Clone for FindKOptimalOutput
impl Clone for FindKOptimalOutput
Auto Trait Implementations§
impl Freeze for FindKOptimalOutput
impl RefUnwindSafe for FindKOptimalOutput
impl Send for FindKOptimalOutput
impl Sync for FindKOptimalOutput
impl Unpin for FindKOptimalOutput
impl UnsafeUnpin for FindKOptimalOutput
impl UnwindSafe for FindKOptimalOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more