Expand description
Term construction: bridge from parsed formula terms to TermCollectionSpec.
This module takes the AST produced by inference::formula_dsl and a loaded
dataset, resolves column references, infers knot counts and center strategies,
and produces a TermCollectionSpec ready for build_term_collection_design.
Enums§
- Duchon
Power Policy - Term
Builder Error - Typed errors emitted by term-builder helpers.
Displayreproduces the exact pre-refactorformat!(...)text byte-for-byte, so callers that string-match on the message (tests, log assertions) keep working unchanged. Public-API functions still returnResult<_, String>and use.to_string()shims at their boundary to stay compatible with callers in protected modules.
Constants§
- SECONDARY_
CENTER_ CAP_ OPTION - Private (engine-injected) option that caps the default spatial center
count for a secondary (distributional) predictor’s smooth — see
solver::fit_orchestration::apply_secondary_predictor_basis_parsimonyand #501.
Functions§
- build_
smooth_ basis - build_
termspec - col_
minmax - column_
map_ with_ alias - enable_
scale_ dimensions - Initialise per-axis anisotropic log-scales on eligible spatial smooth specs.
- has_
explicit_ countwith_ basis_ alias - heuristic_
centers - heuristic_
knots_ for_ column - Per-column knot count from the unique-value count, with the same n^(1/3)
ceiling growth as
heuristic_knotsso per-column smooths can support more detail at large scale. The 4-knot floor stays put because we still need enough basis functions to fit a non-trivial smooth at all. - parse_
countwith_ basis_ alias - parse_
cyclic_ boundary - parse_
duchon_ order - parse_
duchon_ power - parse_
duchon_ power_ policy - parse_
periodic_ domain_ 1d - Parse the periodic-uniform domain for a one-dimensional cyclic smooth.
- resolve_
col - Resolve a bare column name to its index, returning a typed
DataError::ColumnNotFoundon miss so the FFI boundary can surface a structuredgamfit.ColumnNotFoundError(column=…, available=…)rather than rely on string-classification of human prose. Internal callers that still flowResult<_, String>get byte-identical text viaFrom<DataError> for String. - resolve_
role_ col - Like
resolve_colbut tags the missing-column payload with a role label ("response","entry","exit","event","z","id", …) so the boundary-side Python exception can disambiguate which formula slot held the bad reference. - resolve_
smooth_ type_ name - smooth_
type_ uses_ spatial_ center_ heuristic - Does this canonical smooth type size its basis through the generous spatial
center heuristic (
crate::basis::default_num_centers)? - spatial_
center_ strategy_ for_ dimension - unique_
count_ column - validate_
known_ options - Reject unknown option keys with a focused error that names the term and
the offending key, plus suggests near-matches from the known-key list.
Without this, typos like
lengt_scale=0.1ornyu=5/2are silently dropped, the term uses the default, and the user has no idea why their option had no effect.