_models#
- cultivars.engine._internals._models = <module 'cultivars.engine._internals._models' from '/home/runner/work/cultivars/cultivars/src/cultivars/engine/_internals/_models.py'>[source]#
Protected base classes for model specifications and fitted results.
Two hierarchies live here, and they are deliberately separate.
Results inherit a single linear chain of field bases –
_Resultthen_MeanResult– because multiple slotted dataclass bases that each declare fields raiseTypeError: multiple bases have instance lay-out conflict. Anything optional is a behavior mixin with__slots__ = ()and no fields of its own; the concrete result declares the attribute the mixin reads.Model specifications inherit
_ModelBase, which ownsendogvalidation and the length check. Every family base in this subpackage descends from it, so no public constructor re-implements either.A family base also owns its estimation:
_build_objectiveassembles the optimizer surface from the validated specification, and_fit_familyruns it and packs the raw outputs into a record fromcultivars._internals._fits. The fit records carry no estimation logic of their own, so the specification is never destructured into a foreign call signature.These bases implement the structural contracts in
cultivars._core._protocolswithout importing them: the protocols are duck-typed, so the relationship is checked byisinstanceat runtime and bymypystatically, with no import edge in either direction.