bind_predictor#
- superglm.bind_predictor(
- family: DistributionalFamily,
- name: str,
- *terms: TermInput,
- intercept: bool = True,
- offset: Any = None,
- link: Literal['log', 'identity', 'logit', 'probit', 'cloglog', 'cauchit', 'inverse', 'inverse_squared', 'sqrt'] | Link | None = None,
Declare a predictor by parameter name, including for custom families.
Built-in family helpers are the usual entry point. Use this function when a custom family declares its parameters without helper methods.
- Parameters:
- familyDistributionalFamily
The same family instance that will be passed to
SuperLSS.- namestr
A name from
family.parameters. This is also the name used in model results and offsets.- *termsstr or BoundTerm or BoundInteraction or mapping
Numeric column names or declarations made by the term helpers. A
{column: spec}mapping addsterm(column, spec)for each entry, in the mapping’s order. Supply no terms for an intercept-only predictor.- interceptbool, default=True
Include an intercept in this predictor. A predictor needs at least one term or its intercept.
- linkstr or Link, optional
Override the family’s default link. The model checks compatibility with the parameter’s support.
- offsetcolumn name, array-like, or list of sources, optional
Fixed additions on the link scale, with coefficient one. Multiple sources sum; no logarithm is applied. Arrays are copied and frozen. New-row predictions need replacements for array sources; columns are read from the prediction frame. Offsets add no coefficients or EDF.
- Returns:
- BoundPredictor
A declaration for one parameter. Every family parameter needs one.
Examples
The generic binder and a built-in helper declare the same parameter:
>>> from superglm import GaussianLS, bind_predictor >>> family = GaussianLS() >>> bind_predictor(family, "location", "age").name 'location' >>> family.location("age").name 'location'