skglm.MCPRegression¶
- class skglm.MCPRegression(alpha=1.0, gamma=3, weights=None, max_iter=50, max_epochs=50000, p0=10, verbose=0, tol=0.0001, positive=False, fit_intercept=True, warm_start=False, ws_strategy='subdiff')[source]¶
Linear regression with MCP penalty estimator.
The optimization objective for MCPRegression is, with `x >= 0`:
`"pen"(x) = {(alpha x - x^2 / (2 gamma), if x <= alpha gamma), (gamma alpha^2 / 2 , if x > alpha gamma):}``"obj" = 1 / (2 xx n_"samples") ||y - Xw||_2 ^ 2 + sum_(j=1)^(n_"features") "pen"(|w_j|)`For more details see Coordinate descent algorithms for nonconvex penalized regression, with applications to biological feature selection, Breheny and Huang.
- Parameters:
- alphafloat, optional
Penalty strength.
- gammafloat, default=3
If
gamma = 1
, the prox of MCP is a hard thresholding. Ifgamma = np.inf
it is a soft thresholding. Should be larger than (or equal to) 1.- weightsarray, shape (n_features,), optional (default=None)
Positive weights used in the L1 penalty part of the Lasso objective. If
None
, weights equal to 1 are used.- max_iterint, optional
The maximum number of iterations (subproblem definitions).
- max_epochsint
Maximum number of CD epochs on each subproblem.
- p0int
First working set size.
- verbosebool or int
Amount of verbosity.
- tolfloat, optional
Stopping criterion for the optimization.
- positivebool, optional
When set to
True
, forces the coefficient vector to be positive.- fit_interceptbool, optional (default=True)
Whether or not to fit an intercept.
- warm_startbool, optional (default=False)
When set to
True
, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution.- ws_strategystr
The score used to build the working set. Can be
fixpoint
orsubdiff
.
See also
Lasso
Lasso regularization.
- Attributes:
- coef_array, shape (n_features,)
parameter vector (`w` in the cost function formula)
- sparse_coef_scipy.sparse matrix, shape (n_features, 1)
sparse_coef_
is a readonly property derived fromcoef_
- intercept_float
constant term in decision function.
- n_iter_int
Number of subproblems solved to reach the specified tolerance.
- __init__(alpha=1.0, gamma=3, weights=None, max_iter=50, max_epochs=50000, p0=10, verbose=0, tol=0.0001, positive=False, fit_intercept=True, warm_start=False, ws_strategy='subdiff')[source]¶
Methods
__init__
([alpha, gamma, weights, max_iter, ...])fit
(X, y)Fit the model according to the given training data.
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
path
(X, y, alphas[, coef_init, return_n_iter])Compute MCPRegression path.
predict
(X)Predict using the linear model.
score
(X, y[, sample_weight])Return the coefficient of determination of the prediction.
set_params
(**params)Set the parameters of this estimator.
set_score_request
(*[, sample_weight])Request metadata passed to the
score
method.