skglm.GeneralizedLinearEstimator#

class skglm.GeneralizedLinearEstimator(datafit=None, penalty=None, solver=None)[source]#

Generic generalized linear estimator.

This estimator takes a penalty and a datafit and runs a coordinate descent solver to solve the optimization problem. It handles classification and regression tasks.

Parameters:
datafitinstance of BaseDatafit, optional

Datafit. If None, datafit is initialized as a Quadratic datafit. datafit is replaced by a JIT-compiled instance when calling fit.

penaltyinstance of BasePenalty, optional

Penalty. If None, penalty is initialized as a L1 penalty. penalty is replaced by a JIT-compiled instance when calling fit.

solverinstance of BaseSolver, optional

Solver. If None, solver is initialized as an AndersonCD solver.

Attributes:
coef_array, shape (n_features,) or (n_features, n_tasks)

parameter array (`w` in the cost function formula)

sparse_coef_scipy.sparse matrix, shape (n_features, 1) or (n_features, n_tasks)

sparse_coef_ is a readonly property derived from coef_

intercept_array, shape (n_tasks,)

constant term in decision function.

n_iter_int

Number of subproblems solved to reach the specified tolerance.

__init__(datafit=None, penalty=None, solver=None)[source]#

Methods

__init__([datafit, penalty, solver])

fit(X, y)

Fit estimator.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters of the estimators including the datafit's and penalty's.

predict(X)

Predict target values for samples in X.

set_params(**params)

Set the parameters of this estimator.