class documentation

Sparse linear model for regression.

The model is trained using the L2 loss function and the L2 regularization penalty. The optimal features are selected using a scalable cutting plane algorithm.

Method _fit_coef_for_subset Undocumented
Method _get_coef Undocumented
Method _get_intercept Undocumented
Method _make_callback Undocumented
Method _pre_process_y Normalize the target variable.
Method _predict Perform inference using the fitted model.
Instance Variable _scaler_y Undocumented

Inherited from BaseSparseEstimator:

Method __init__ Model constructor.
Method fit Fit the model to the training data.
Method predict Predict using the fitted model.
Instance Variable feature_groups Set of features that are mutually exclusive. For example, if feature_groups=[{0, 1}, {2, 3}], then at most one features 0 and 1 will be selected, and at most one features 2 and 3 will be selected. This can be used to encode prior knowledge about the problem.
Instance Variable gamma The regularization parameter. If None, then gamma is set to 1 / sqrt(n_samples).
Instance Variable k The sparsity parameter (i.e. number of non-zero coefficients). If None, then k is set to the square root of the number of features, rounded to the nearest integer.
Instance Variable max_iters The maximum number of iterations.
Instance Variable normalize Whether to normalize the data before fitting the model.
Instance Variable random_state Controls the random seed for the initial guess if a user-defined initial guess is not provided.
Instance Variable solver The solver to use for the optimization problem. The available options are "CBC" and "GUROBI". Support for the "HiGHS" solver is also planned for a future release.
Instance Variable start The initial guess for the selected features. For example if start={0, 1, 2}, then the first three features will be selected. If None, then the initial guess is randomly selected. Providing a good initial guess based on problem-specific knowledge can significantly speed up the search.
Instance Variable tol The tolerance for the stopping criterion.
Instance Variable verbose Whether to enable logging of the search progress.
Property coef Get the coefficients of the linear model.
Property intercept Get the intercept of the linear model.
Method _validate_params Undocumented
Class Variable _parameter_constraints Undocumented
Instance Variable _coef Undocumented
Instance Variable _gamma Undocumented
Instance Variable _k Undocumented
Instance Variable _scaler_X Undocumented
def _fit_coef_for_subset(self, X_subset: np.ndarray, y) -> np.ndarray: (source)
def _get_coef(self) -> np.ndarray: (source)
def _get_intercept(self) -> float: (source)
def _make_callback(self, X: np.ndarray, y: np.ndarray) -> Callable[[np.ndarray], tuple[float, np.ndarray]]: (source)
def _pre_process_y(self, y: np.ndarray) -> np.ndarray: (source)

Normalize the target variable.

def _predict(self, X: np.ndarray, proba: bool = False) -> np.ndarray: (source)

Perform inference using the fitted model.

Parameters
X:np.ndarrayThe training data. The array should be of shape (n_samples, n_features).
proba:boolNot used. Exists for interoperability with the sparse linear classifier.
Returns
np.ndarrayThe predicted values. The array will be of shape (n_samples,).
_scaler_y = (source)

Undocumented