Repository navigation
ISLP 0.7: ModelSpec from modelmatrix - #72
Merged
Merged
Conversation
ISLP now depends on modelmatrix>=0.3, to which ModelSpec moved. - ISLP.models re-exports modelmatrix's ModelSpec and features, and its wildcard, Contrast, Ordinal and responses (Surv, Binomial, Multinomial, Outcome). - ISLP.models.model_spec, ISLP.models.columns and ISLP.transforms are modelmatrix's modules (aliased in sys.modules), so imports from them keep working. - intercept defaults to False, as 0.6.0 announced; the FutureWarning is gone. - strategy.py counts terms with terms_ and maps given terms to their fitted versions through features_, so a wildcard (one term standing for many) no longer misaligns them. Unused imports of the column helpers, and the unused _build_submodel, are removed. - The tests of ModelSpec moved to modelmatrix; the stepwise tests stay, with new ones for a wildcard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- models.rst and transforms.rst keep their entries, now links to modelmatrix's pages (spec, anova, comparison, responses, poly, splines, pca); models/selection stays an ISLP page. - The moved notebooks (and their jupytext sources) are removed. - intersphinx maps modelmatrix's API, so :py:class:`modelmatrix.ModelSpec` links there. - The API list drops ISLP.models.model_spec, ISLP.models.columns and ISLP.transforms, now modelmatrix's modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ModelSpechas moved to its own package, modelmatrix (0.3.0 on PyPI). ISLP now depends onmodelmatrix>=0.3instead of carrying its own copy.Imports keep working.
from ISLP.models import ModelSpec(andpoly,ns,bs,pca,derived_feature,contrast,ordinal, ...) gives modelmatrix's objects.ISLP.modelsalso exports modelmatrix'swildcard(R's.),Contrast,Ordinaland its responsesSurv,Binomial,MultinomialandOutcome.ISLP.models.model_spec,ISLP.models.columnsandISLP.transformsare aliased to modelmatrix's modules insys.modules, sofrom ISLP.transforms import Polyand similar still work, private names included.Breaking, as 0.6.0 announced:
interceptdefaults toFalse. statsmodels' models, andsklearn_sm/sklearn_selectedwith them, needintercept=True. The 0.6.0FutureWarningabout the move is gone.Bug fix in
strategy.py. Stepwise selection counted terms withmodel_spec.termsand mapped them toterms_by position. With awildcard, which is one term standing for many, the two lists don't line up, and selection failed. It now countsterms_and maps given terms (lower_terms,upper_terms,initial_terms) to their fitted versions throughfeatures_. A column the wildcard stands for can therefore be a lower term. The unused imports of the column helpers, and the unused_build_submodel, are removed.Tests:
ModelSpectests moved to modelmatrix.tests/models/test_modelmatrix.pychecks the re-exports, the old import paths and the new default. It also checks stepwise selection with a wildcard: forward, a lower term among the wildcard's columns, and fixed-step backward. Those three tests fail on the oldstrategy.py.ModelSpectests moved here: a strict xfail for derived terms, and the 1-SD rule.Docs:
models/selectionstays an ISLP page. The moved notebooks are removed.:py:class:modelmatrix.ModelSpec`` links to its API page.ISLP.models.model_spec,ISLP.models.columnsandISLP.transforms, which are now modelmatrix's modules.objects.invof a local modelmatrix docs build. The reference resolves, no page links to a removed one, and there are fewer warnings than before.Not in this PR:
intercept=Truewherever they rely on the old default, plus the Ch07ordinal('education')fix. That's a separate PR there.🤖 Generated with Claude Code