mlcolvar.explain.lasso.lasso_regression

class mlcolvar.explain.lasso.lasso_regression(dataset, alphas=None, scale_inputs=True, print_info=True, plot=True)[source]

Bases:

Perform sparse regression via LASSO on a given DictDataset (requires keys: “data” and “target”). The regularization strength alpha is automatically chosen based on cross-validation on a set of values (alphas), see sklearn.linear_model.LassoCV. The scoring function used is the MSE loss + alpha * L1 regularization.

Parameters:
  • dataset (DictDataset) – dataset with ‘data’ and ‘target’

  • alphas (int or array-like, optional) – List of alphas where to compute the models. If None alphas are set automatically.

  • scale_inputs (bool, optional) – whether to standardize inputs based on mean and std.dev., by default True

  • feature_names (list, optional) – names of the input features, if not given they are taken from dataset.feature_names, by default None

  • print_info (bool, optional) – whether to print results, by default True

  • plot (bool, optional) – whether to plot results, by default True

Returns:

  • regressor – optimized estimator

  • feats – names of the non-zero features

  • coeffs – coefficients of the non-zero features

__init__(**kwargs)