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,datafitis initialized as aQuadraticdatafit.datafitis replaced by a JIT-compiled instance when calling fit.- penaltyinstance of BasePenalty, optional
Penalty. If
None,penaltyis initialized as aL1penalty.penaltyis replaced by a JIT-compiled instance when calling fit.- solverinstance of BaseSolver, optional
Solver. If
None,solveris initialized as anAndersonCDsolver.
- 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 fromcoef_- intercept_array, shape (n_tasks,)
constant term in decision function.
- n_iter_int
Number of subproblems solved to reach the specified tolerance.
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.