modelmatrix builds model matrices from tabular data. Its ModelSpec
is a scikit-learn transformer: a list of terms (columns, categorical
encodings, polynomials, splines, principal components and their
interactions) is fit to a pd.DataFrame, a polars or pyarrow frame or
an np.ndarray, and transforms new data the same way. It goes in a
Pipeline, and the parameters of its terms are tuned with
GridSearchCV.
pip install modelmatrixFeatures: polynomials, splines and PCA
Responses and the wildcard:
y ~ .,Surv,Binomial,Multinomialand missing valuesANOVA with
build_sequenceModelSpeccompared withColumnTransformer, patsy and formulaicThe API reference
ModelSpec was written for the labs of
An Introduction to Statistical Learning with Python,
whose ISLP package provides the data used on these pages.
For more information, visit the GitHub repository.