Multi-task LS estimators¶
Multi-response least squares with joint feature selection across
tasks. Unlike the scalar LS family — where every output column of
Y would be regressed independently — these estimators penalize a
feature’s whole row of the coefficient matrix B ∈ ℝ^(p × K), so
that feature j is either “active in every task” or “inactive in
every task.” Useful for genomics, finance, and any setting where
related outcomes are expected to share a sparse support.
All 8 classes follow the same shape:
Lasso (convex):
MultiTaskLassoRegressor,MultiTaskLassoPathRegressor.MCP (LLA-wrapped non-convex):
MultiTaskMCPRegressor,MultiTaskMCPPathRegressor.SCAD (LLA-wrapped non-convex):
MultiTaskSCADRegressor,MultiTaskSCADPathRegressor.Elastic net (convex):
MultiTaskElasticNetRegressor,MultiTaskElasticNetPathRegressor.
Single-λ classes are useful when you’ve already chosen λ; path classes are the workhorse when picking λ post-hoc. CV wrappers live on the CV page.
Inputs and outputs¶
fit(X, Y) takes X ∈ ℝ^(n, p) (dense ndarray or scipy.sparse CSC)
and Y ∈ ℝ^(n, K). After fitting:
coef_has shape(K, p)— matches sklearn’sMultiTaskLasso.intercept_has shape(K,).predict(X) → (n_pred, K).
Path classes have analogous coefs_ of shape (n_lambdas, K, p)
and intercepts_ of shape (n_lambdas, K).
Convention vs sklearn¶
skein uses the natural per-sample objective from the stacked
formulation: (1/(2nK)) ‖Y - X·B‖²_F + λ · P(B) where P(B) = Σ_j w_j ‖B[j, :]‖_2 for the lasso. sklearn’s MultiTaskLasso uses
(1/(2n)) ‖Y - X·W^T‖²_F + α · ‖W‖_{2,1}. The same minimizer is
reached at λ_skein = α_sklearn / K. Verified by a regression test
in the suite.
This convention difference does not apply to MCP/SCAD’s
shape parameters (gamma, a) — those mean the same thing as
in scalar MCP/SCAD because they’re applied to the per-row L2 norm
of B[j, :], which is on the same scale as the natural
formulation.
See Concepts → Multi-task for the algebraic reduction (multi-task LS reduces exactly to a group-lasso problem on a virtual block-replicated design) and the K-rescale derivation.
Sparse + standardize¶
The MultiTaskLasso/MCP/SCAD/ElasticNet estimators dispatch
transparently on scipy.sparse.issparse(X) — pass a CSC matrix
and the path solver routes through the sparse MultiTaskDesign
backend. standardize=True works for both dense (physical
center+scale) and sparse (lazy Standardized wrapper composed
with the augmented intercept column).
Lasso — single λ + path¶
- class skein_glm.multitask.MultiTaskLassoRegressor(lambda_=0.1, *, weights=None, max_iter=100, tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimator,RegressorMixinMulti-task lasso at a single λ. Penalty is λ Σ_j w_j ‖B[j, :]‖_2 — feature j is selected jointly across all tasks. coef_ has shape (K, p), intercept_ shape (K,), predict(X) returns (n, K).
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_predict_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
predictmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_score_request(*, sample_weight='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- class skein_glm.multitask.MultiTaskLassoPathRegressor(*, lambdas=None, n_lambdas=100, lambda_min_ratio=0.001, weights=None, max_iter=100, tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimatorMulti-task lasso along a λ-path with warm starts. After fit, coefs_ has shape (n_lambdas, K, p), intercepts_ shape (n_lambdas, K), lambdas_ shape (n_lambdas,).
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
MCP — single λ + path¶
- class skein_glm.multitask.MultiTaskMCPRegressor(lambda_=0.1, gamma=3.0, *, weights=None, max_iter=100, tol=1e-06, max_outer=10, outer_tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimator,RegressorMixinMulti-task MCP at a single λ via LLA outer loop. The non-convex row-group MCP penalty is linearized to a weighted multi-task lasso at each LLA outer iteration.
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_predict_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
predictmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_score_request(*, sample_weight='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- class skein_glm.multitask.MultiTaskMCPPathRegressor(gamma=3.0, *, lambdas=None, n_lambdas=100, lambda_min_ratio=0.001, weights=None, max_iter=100, tol=1e-06, max_outer=10, outer_tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimatorMulti-task MCP along a λ-path via LLA at every λ.
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
SCAD — single λ + path¶
- class skein_glm.multitask.MultiTaskSCADRegressor(lambda_=0.1, a=3.7, *, weights=None, max_iter=100, tol=1e-06, max_outer=10, outer_tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimator,RegressorMixinMulti-task SCAD at a single λ via LLA outer loop. SCAD shape a > 2 (default 3.7 — Fan & Li’s recommendation).
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_predict_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
predictmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_score_request(*, sample_weight='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- class skein_glm.multitask.MultiTaskSCADPathRegressor(a=3.7, *, lambdas=None, n_lambdas=100, lambda_min_ratio=0.001, weights=None, max_iter=100, tol=1e-06, max_outer=10, outer_tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimatorMulti-task SCAD along a λ-path via LLA at every λ.
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Elastic net — single λ + path¶
- class skein_glm.multitask.MultiTaskElasticNetRegressor(lambda_=0.1, alpha=0.5, *, weights=None, max_iter=100, tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimator,RegressorMixinMulti-task elastic net at a single λ. Convex per-row penalty α λ w_j ‖B[j,:]‖₂ + (1-α) λ w_j ‖B[j,:]‖₂² / 2. α=1 reduces to multi-task lasso; α=0 is per-row ridge.
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_predict_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
predictmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- set_score_request(*, sample_weight='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
scoremethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
- class skein_glm.multitask.MultiTaskElasticNetPathRegressor(alpha=0.5, *, lambdas=None, n_lambdas=100, lambda_min_ratio=0.001, weights=None, max_iter=100, tol=1e-06, fit_intercept=True, standardize=False, screening='strong', acceleration=5, parallel=False)[source]¶
Bases:
BaseEstimatorMulti-task elastic net along a λ-path with warm starts.
- Parameters:
- set_fit_request(*, x='$UNCHANGED$')¶
Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.