Repository navigation
v0.4.0
This is a major new release with some new features, greatly improved ergonomics
for structured formulae, matrices and specs, and a few small breaking changes
(most with backward compatibility shims). All users are encouraged to upgrade.
Breaking changes:
include_interceptis no longer an argument toFormulaParser.get_terms;
and is instead an argument of theDefaultFormulaParserconstructor. If you
want to modify theinclude_interceptbehaviour, please use:Formula("y ~ x", _parser=DefaultFormulaParser(include_intercept=False))
- Accessing terms via
Formula.termsis deprecated sinceFormulabecame a
subclass ofStructured[List[Terms]]. You can directly iterate over, and/or
access nested structure on theFormulainstance itself.Formula.terms
has a deprecated property which will return a reference to itself in order to
support legacy use-cases. This will be removed in 1.0.0. ModelSpec.feature_namesandModelSpec.feature_columnsare deprecated in
favour ofModelSpec.column_namesandModelSpec.column_indices. Deprecated
properties remain in-place to support legacy use-cases. These will be removed
in 1.0.0.
New features and enhancements:
- Structured formulae (and their derived matrices and specs) are now mutable.
InternallyFormulahas been refactored as a subclass of
Structured[List[Terms]], and can be incrementally built and modified. The
matrix and spec outputs now have explicit subclasses ofStructured
(ModelMatricesandModelSpecsrespectively) to expose convenience methods
that allow these objects to be largely used interchangeably with their
singular counterparts. ModelMatricesandModelSpecsarenow surfaced as top-level exports of the
formulaicmodule.Structured(and its subclasses) gained improved integration of nested tuple
structure, as well as support for flattened iteration, explicit mapping
output types, and lots of cleanups.ModelSpecwas made into a dataclass, and gained several new
properties/methods to support better introspection and mutation of the model
spec.FormulaParserwas renamedDefaultFormulaParser, and made a subclass of the
new formula parser interfaceFormulaParser. In this process
include_interceptwas removed from the API, and made an instance attribute
of the default parser implementation.
Bugfixes and cleanups:
- Fixed AST evaluation for large formulae that caused the evaluation to hit the
recursion limit. - Fixed sparse categorical encoding when the dataframe index is not the standard
range index. - Fixed a bug in the linear constraints parser when more than two constraints
were specified in a comma-separated string. - Avoid implicit changing of the sparsity structure of CSC matrices.
- If manually constructed
ModelSpecs are provided by the user during
materialization, they are updated to reflect the output-type chosen by the
user, as well as whether to ensure full rank/etc. - Allowed use of older pandas versions. All versions >=1.0.0 are now supported.
- Various linting cleanups as
pylintwas added to the CI testing.
Documentation:
- Apart from the
.materializersubmodule, most code now has inline
documentation and annotations.