mixle.task.recommend module

recommend_model – point a regular program at a data sample and get back a model shape, with confidence.

The other local task Grant named: “help recommend a model shape from the data.” mixle already auto-selects structure (mixle.utils.automatic.analyze_structure() scores candidate families per field by description length); this wraps that into a decision-oriented answer a program can act on:

  • the recommended estimator (ready to fit),

  • per field, the chosen family, the runner-up, and the bit-gap between them – how confident the choice is (a wide gap = clearly this family; a narrow gap = the data can’t yet tell them apart),

  • the fields whose choice is low-confidence – exactly where collecting more data would pay off (the “better data collection” lever),

  • the pairwise dependencies that argue for modeling fields jointly rather than independently.

No teacher, no GPU – this is mixle’s generative model selection exposed as a one-call advisor. fit=True also returns the fitted model.

class FieldChoice(path, kind, family, runner_up, gap_bits)[source]

Bases: object

The family chosen for one field, the runner-up, and how decisive the choice was (bits/obs).

Parameters:
path: str
kind: str
family: str
runner_up: str | None
gap_bits: float | None
property confident: bool

Confident when the family is type-determined (no real contender) or clears the runner-up by a margin.

class ModelRecommendation(estimator, fields, dependencies, warnings, profile=None)[source]

Bases: object

A model shape recommended from data: estimator, per-field choices+confidence, dependencies, and notes.

Parameters:
estimator: Any
fields: list[FieldChoice]
dependencies: list[tuple[str, str, float]]
warnings: list[str]
profile: Any = None
low_confidence_fields()[source]

Fields whose family choice is not yet decisive – where more data would most sharpen the model.

Return type:

list[FieldChoice]

fit(data, **kwargs)[source]

Fit the recommended estimator on data and return the model.

Parameters:
Return type:

Any

explain()[source]

Plain-language lines: the underlying profile’s explanation (families, bits, dependencies, warnings).

Return type:

list[str]

recommend_model(data, *, fit=False, **analyze_kwargs)[source]

Recommend a model shape for data (and optionally fit it); see ModelRecommendation.

analyze_kwargs pass through to mixle.utils.automatic.analyze_structure() (sampling, pairwise budget, validation). With fit=True the returned recommendation’s estimator is also fit and the model is attached as .model.

Parameters:
Return type:

ModelRecommendation