Skip to main content

AutoOuterSubsampleOptions

Struct AutoOuterSubsampleOptions 

Source
pub struct AutoOuterSubsampleOptions {
    pub min_n_for_auto: usize,
    pub min_k: usize,
    pub target_fraction: f64,
    pub seed: u64,
    pub outer_work_per_k_unit: u64,
    pub min_k_floor: usize,
}
Expand description

Configuration for the automatic outer-score subsampler.

At large scale (n ≥ tens of thousands) the marginal-slope outer rho-gradient computes a sum-over-rows trace tr(F Fᵀ M_k) = Σ_i row_i(k) whose per-row work is dominated by the cell-moment kernel. Stratified Horvitz–Thompson subsampling replaces the full sum with an unbiased estimator using K of N rows; the trace cost drops from O(N · cell_work) to O(K · cell_work).

§Math

Estimator T̂ = Σ_{i∈S} w_i · row_i with HT weights w_i = N_h / K_h (per-stratum) is unbiased: E[T̂] = T.

Variance under stratified SRS without replacement: Var(T̂) = Σ_h N_h² (1 − K_h/N_h) S_h² / K_h where S_h² is the within-stratum variance of per-row contributions. With proportional allocation K_h = K · N_h/N, the standard deviation of relative to T is roughly σ(T̂)/T ≈ (1/√K) · √(1 − K/N) · cv_within where cv_within is the within-stratum coefficient of variation.

The defaults are tuned so that the relative gradient-noise σ stays below ≈ 1 % across realistic n ∈ [30 000, 300 000+], assuming cv_within ≲ 1 (which holds for marginal-slope contributions because the z-decile stratification absorbs the dominant inhomogeneity).

Fields§

§min_n_for_auto: usize

Below this n, the auto-subsampler always returns None (use full data). Default 30 000.

§min_k: usize

Floor on K, so the relative gradient noise stays bounded even when the target fraction would round to a smaller K. K = max(min_k, round(n · target_fraction)). Default 10 000 gives σ/T ≤ 1 % for cv_within ≤ 1 and any n ≥ min_n_for_auto.

§target_fraction: f64

Target ratio K / n once n ≫ min_k. Default 0.10.

§seed: u64

RNG seed for stratified mask construction. Default 0xA075_8AMP_LE_5UB5 (deterministic across runs at the same n, so CRN holds across BFGS iterations).

§outer_work_per_k_unit: u64

Family-supplied per-unit-of-K outer-derivative work cost.

Despite the historical name, this is not a per-row quantity. It is predicted_outer_gradient_work / K evaluated at the family’s reference operating point — i.e. how many work units each additional row in the K-subsample contributes summed over all n. The auto schedule caps K by K_work = AUTO_OUTER_WORK_BUDGET / outer_work_per_k_unit, guaranteeing a single outer evaluation never exceeds AUTO_OUTER_WORK_BUDGET work units regardless of the noise-only target. Default 1 (no effective work cap beyond K ≤ n); families with measurable per-K cost (survival marginal-slope, BMS) overwrite at the call site.

Calibration recipe: from a profiled run, outer_work_per_k_unit = predicted_gradient_work / K. For the large-scale survival marginal-slope reference (predicted_gradient_work ≈ 4.33×10⁹ at K=19_661), this gives ~220_000; we use 250_000 as a conservative upper bound. With AUTO_OUTER_WORK_BUDGET = 5×10⁸ that caps K at ~2_000.

§min_k_floor: usize

Absolute floor on the chosen K after the noise/work caps are combined. Default AUTO_OUTER_MIN_K_FLOOR.

Implementations§

Source§

impl AutoOuterSubsampleOptions

Source

pub fn target_k(&self, n: usize) -> Option<usize>

Compute the K that this configuration would pick for a given n. Returns None if n < min_n_for_auto (caller should not subsample).

Source

pub fn target_k_detailed(&self, n: usize) -> Option<AutoOuterKChoice>

Same as [target_k] but also reports the noise-only K, the work-budget cap, and which constraint set the final value. Used by maybe_install_auto_outer_subsample to surface a cap_reason in the auto-subsample log line.

Trait Implementations§

Source§

impl Clone for AutoOuterSubsampleOptions

Source§

fn clone(&self) -> AutoOuterSubsampleOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AutoOuterSubsampleOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AutoOuterSubsampleOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V