Skip to content

Commit bde8b38

Browse files
lorentzenchrglemaitre
authored andcommitted
DOC fix linear programming derivation comment in QuantileRegressor (scikit-learn#21952)
1 parent 10c562e commit bde8b38

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

doc/whats_new/v1.1.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ Changelog
158158
This is particularly relevant when `n_features > n_samples` and the
159159
estimator of the noise variance cannot be computed.
160160
:pr:`21481` by :user:`Guillaume Lemaitre <glemaitre>`
161+
:pr:`21481` by :user:`Guillaume Lemaitre <glemaitre>`.
162+
163+
- |Enhancement| :class:`linear_model.QuantileRegressor` support sparse input
164+
for the highs based solvers.
165+
:pr:`21086` by :user:`Venkatachalam Natchiappan <venkyyuvy>`.
161166

162167
- |Fix| :class:`linear_model.LassoLarsIC` now correctly computes AIC
163168
and BIC. An error is now raised when `n_features > n_samples` and

sklearn/linear_model/_quantile.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,15 @@ def fit(self, X, y, sample_weight=None):
200200
else:
201201
solver_options = self.solver_options
202202

203+
# After rescaling alpha, the minimization problem is
204+
# min sum(pinball loss) + alpha * L1
203205
# Use linear programming formulation of quantile regression
204206
# min_x c x
205207
# A_eq x = b_eq
206208
# 0 <= x
207209
# x = (s0, s, t0, t, u, v) = slack variables
208-
# intercept = s0 + t0
209-
# coef = s + t
210+
# intercept = s0 - t0
211+
# coef = s - t
210212
# c = (alpha * 1_p, alpha * 1_p, quantile * 1_n, (1-quantile) * 1_n)
211213
# residual = y - X@coef - intercept = u - v
212214
# A_eq = (1_n, X, -1_n, -X, diag(1_n), -diag(1_n))
@@ -216,7 +218,7 @@ def fit(self, X, y, sample_weight=None):
216218
# 1_n = vector of length n with entries equal one
217219
# see https://stats.stackexchange.com/questions/384909/
218220
#
219-
# Filtering out zero samples weights from the beginning makes life
221+
# Filtering out zero sample weights from the beginning makes life
220222
# easier for the linprog solver.
221223
mask = sample_weight != 0
222224
n_mask = int(np.sum(mask)) # use n_mask instead of n_samples

0 commit comments

Comments
 (0)