Skip to main content

FitConfig

Struct FitConfig 

Source
pub struct FitConfig {
Show 45 fields pub family: Option<String>, pub negative_binomial_theta: Option<f64>, pub link: Option<String>, pub flexible_link: bool, pub offset_column: Option<String>, pub noise_offset_column: Option<String>, pub frailty: Option<FrailtySpec>, pub baseline_target: String, pub baseline_scale: Option<f64>, pub baseline_shape: Option<f64>, pub baseline_rate: Option<f64>, pub baseline_makeham: Option<f64>, pub time_basis: String, pub time_degree: usize, pub time_num_internal_knots: usize, pub time_smooth_lambda: f64, pub survival_likelihood: String, pub survival_distribution: String, pub threshold_time_k: Option<usize>, pub threshold_time_degree: usize, pub sigma_time_k: Option<usize>, pub sigma_time_degree: usize, pub noise_formula: Option<String>, pub logslope_formula: Option<String>, pub z_column: Option<String>, pub weight_column: Option<String>, pub expectile_tau: Option<f64>, pub ctn_stage1: Option<CtnStage1Recipe>, pub scale_dimensions: bool, pub adaptive_regularization: Option<bool>, pub ridge_lambda: f64, pub transformation_normal: bool, pub firth: bool, pub outer_max_iter: Option<usize>, pub outer_wall_clock_budget_secs: Option<f64>, pub gpu_policy: GpuPolicy, pub resource_policy: Option<ResourcePolicy>, pub group_metadata: Option<BTreeMap<String, Value>>, pub coefficient_groups: Vec<CoefficientGroupSpec>, pub penalty_block_gamma_priors: Vec<(String, f64, f64)>, pub latents: Option<Value>, pub analytic_penalties: Option<Value>, pub topology_auto_selector: Option<TopologyAutoSelector>, pub smooth_overrides: Option<Value>, pub persist_warm_start_disk: bool,
}

Fields§

§family: Option<String>

Family: “gaussian”, “binomial”, “poisson”, “negative-binomial”, “gamma”, “tweedie” (alias “tw”; variance power fixed at p = 1.5), or None for auto-detect.

§negative_binomial_theta: Option<f64>

Fixed size/overdispersion parameter for family="negative-binomial".

§link: Option<String>

Link: “identity”, “logit”, “probit”, “cloglog”, “sas”, “beta-logistic”, or None.

§flexible_link: bool

Whether to use flexible (wiggle-augmented) link.

§offset_column: Option<String>

Optional additive offset column for the primary linear predictor.

§noise_offset_column: Option<String>

Optional additive offset column for the noise/log-scale predictor.

§frailty: Option<FrailtySpec>

Optional family-level frailty modifier.

§baseline_target: String

Baseline target: “linear”, “weibull”, “gompertz”, “gompertz-makeham”.

§baseline_scale: Option<f64>§baseline_shape: Option<f64>§baseline_rate: Option<f64>§baseline_makeham: Option<f64>§time_basis: String

Time basis: “ispline” or “none”.

§time_degree: usize§time_num_internal_knots: usize§time_smooth_lambda: f64§survival_likelihood: String

Survival likelihood mode: “location-scale”, “transformation”, “weibull”, “marginal-slope”, “latent”, or “latent-binary”.

§survival_distribution: String

Residual distribution: “gaussian”, “logistic”, “gumbel”.

§threshold_time_k: Option<usize>§threshold_time_degree: usize§sigma_time_k: Option<usize>§sigma_time_degree: usize§noise_formula: Option<String>

If set, fit a location-scale model with this formula for the noise parameter.

§logslope_formula: Option<String>

Formula for the log-slope model (survival marginal-slope or Bernoulli marginal-slope).

§z_column: Option<String>

Column name for the z (exposure/dose) variable in marginal-slope models.

§weight_column: Option<String>

Optional non-negative per-row training weights column.

§expectile_tau: Option<f64>

Expectile asymmetry τ ∈ (0, 1) for family = "expectile".

When family resolves to "expectile" the fit minimizes the Newey–Powell asymmetric squared loss Σ wᵢ(τ)·(yᵢ − μᵢ)² with wᵢ(τ) = τ if yᵢ > μᵢ else 1 − τ, tracing the conditional τ-expectile — the smooth analogue of the τ-quantile. τ = 0.5 reduces exactly to the Gaussian-identity mean fit. The whole penalized smooth + REML λ-selection machinery is reused via a Least Asymmetrically Weighted Squares (LAWS) outer loop. None defaults to the median expectile τ = 0.5 when the family is "expectile"; it is ignored for every other family. The asymmetry may also be written inline as family = "expectile(0.9)", which fills this field at resolve time.

§ctn_stage1: Option<CtnStage1Recipe>

Internal CTN Stage-1 provenance for the marginal-slope z column.

When the marginal-slope z was generated by a transformation-normal Stage-1 fit, the orchestration layer fills this with the Stage-1 recipe. Its presence is the sole auto-enable signal for cross-fitted, Neyman- orthogonal score calibration (#461): the materializer cross-fits the CTN to produce out-of-fold z and the score-influence Jacobian J, replaces the raw z with z_oof, and absorbs J as a leakage-projection block in Stage-2. This is in-process plumbing only — there is no CLI flag, env var, or feature gate. None ⇒ raw z with the free-warp score_warp fallback. See CtnStage1Recipe.

§scale_dimensions: bool§adaptive_regularization: Option<bool>

Enable exact spatial adaptive regularization for standard formula fits. None uses the quality-first automatic policy. The current automatic policy leaves LAREG off unless explicitly requested because the optimizer’s REML-selected local weights can over-regularize small high-yield spatial signals.

§ridge_lambda: f64§transformation_normal: bool

Route the fit through the transformation-normal family. When set, the formula terms are treated as the covariate side of the transformation model and the response basis is built internally. Incompatible with noise_formula and with Surv(...) responses.

§firth: bool

Enable Firth bias reduction for standard single-parameter families.

§outer_max_iter: Option<usize>

Optional cap on the REML/LAML outer smoothing-parameter iterations for standard formula fits. None uses the production default.

§outer_wall_clock_budget_secs: Option<f64>

Optional wall-clock budget (seconds) for the outer smoothing search (gam#979). Threaded to the survival marginal-slope fit, whose constrained joint-Newton can fail to certify convergence and otherwise grind without bound; with this set the fit returns its best-so-far iterate (or a catchable error) within the budget instead of hanging. None keeps the generous built-in default for that path and is unbounded elsewhere.

§gpu_policy: GpuPolicy

GPU backend selection policy. Auto uses supported device kernels for large workloads, Off pins execution to CPU kernels, and Force fails loudly when a requested GPU kernel has no compiled backend.

§resource_policy: Option<ResourcePolicy>

Optional override of the gam_runtime::resource::ResourcePolicy used when planning spatial bases (TPS / Matern / Duchon) during term construction. When None, the default-library policy is used.

§group_metadata: Option<BTreeMap<String, Value>>

Optional per-group metadata supplied by the caller. Fitting ignores this field; saved-model builders pass it through so deployment consumers can recover group provenance.

§coefficient_groups: Vec<CoefficientGroupSpec>

Optional user-defined coefficient groups with separate precision parameters. Group-local priors, including catalog-metadata-informed Gamma precision hyperpriors, are resolved during design setup.

§penalty_block_gamma_priors: Vec<(String, f64, f64)>

Optional per-existing-penalty-block Gamma(shape, rate) precision hyperpriors keyed by penalty-block label. This is the catalog-metadata-informed-prior hook for models that do not need a new user-defined coefficient group.

§latents: Option<Value>

Python gamfit.fit(..., latents={...}) configuration. This reaches the standard formula workflow as an owned latent-coordinate block: the named smooth’s synthetic covariates are rebuilt from t, and joint REML optimizes [rho, vec(t)] through latent design hyper-dirs.

§analytic_penalties: Option<Value>

Python gamfit.fit(..., penalties=[...]) analytic-penalty descriptors, validated against the declared latent-coordinate blocks before a standard latent fit starts.

§topology_auto_selector: Option<TopologyAutoSelector>

Formula-path latent topology selector descriptor. The selector itself fits candidates through the ordinary workflow; this slot lets callers request and validate that path from the same config registry.

§smooth_overrides: Option<Value>

gamfit.fit(..., smooths={...}) Python kwarg routed through the FFI bridge. JSON object keyed by formula symbol (single column name or comma-joined tuple) → smooth descriptor ({"kind": "duchon", "centers": [[...], ...], ...}). Applied as a post-processing step on the TermCollectionSpec produced by the formula DSL: each smooth term whose feature_cols match a registry key has its kind-specific tunables (centers, knots, kernel hyperparameters) overridden with the user-supplied values. The single canonical lowering path guarantees smooths={"x": Duchon(centers=K)} (integer) produces a bit-identical block spec to writing duchon(x, centers=K) in the formula; only explicit array-valued centers= differs, routing through CenterStrategy::UserProvided instead of FarthestPoint/EqualMass.

§persist_warm_start_disk: bool

Engage the cross-process ON-DISK persistent warm-start layer (#1082).

Default false: only the always-on in-memory warm start runs, so a single fit and throwaway/replicate/CI-coverage loops pay zero disk I/O (no WarmStartStore dir/eviction scan, no record load/store). Set true to engage cross-process / repeat-fit resume: the flag threads FitConfig → FitOptions → ExternalOptimOptions down to the standard RemlState, which then calls enable_persistent_warm_start_disk().

Trait Implementations§

Source§

impl Clone for FitConfig

Source§

fn clone(&self) -> FitConfig

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 FitConfig

Source§

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

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

impl Default for FitConfig

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

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