skglm.datafits.WeightedQuadratic#
- class skglm.datafits.WeightedQuadratic(sample_weights)[source]#
Weighted Quadratic datafit to handle sample weights.
The datafit reads:
`1 / (2 xx \sum_(i=1)^(n_"samples") weights_i) \sum_(i=1)^(n_"samples") weights_i (y_i - (Xw)_i)^ 2`- Attributes:
- Xtwyarray, shape (n_features,)
Pre-computed quantity used during the gradient evaluation. Equal to
X.T @ (samples_weights * y).- sample_weightsarray, shape (n_samples,)
Weights for each sample.
Methods
__init__(sample_weights)full_grad_sparse(X_data, X_indptr, ...)get_global_lipschitz(X, y)get_global_lipschitz_sparse(X_data, ...)get_lipschitz(X, y)get_lipschitz_sparse(X_data, X_indptr, ...)get_spec()Specify the numba types of the class attributes.
gradient(X, y, Xw)gradient_scalar(X, y, w, Xw, j)gradient_scalar_sparse(X_data, X_indptr, ...)initialize(X, y)Pre-computations before fitting on X and y.
initialize_sparse(X_data, X_indptr, X_indices, y)Pre-computations before fitting on X and y when X is a sparse matrix.
intercept_update_step(y, Xw)inverse_link(Xw)Inverse link function (identity by default).
params_to_dict()Get the parameters to initialize an instance of the class.
raw_grad(y, Xw)raw_hessian(y, Xw)value(y, w, Xw)Value of datafit at vector w.