@@ -200,13 +200,15 @@ def fit(self, X, y, sample_weight=None):
200
200
else :
201
201
solver_options = self .solver_options
202
202
203
+ # After rescaling alpha, the minimization problem is
204
+ # min sum(pinball loss) + alpha * L1
203
205
# Use linear programming formulation of quantile regression
204
206
# min_x c x
205
207
# A_eq x = b_eq
206
208
# 0 <= x
207
209
# 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
210
212
# c = (alpha * 1_p, alpha * 1_p, quantile * 1_n, (1-quantile) * 1_n)
211
213
# residual = y - X@coef - intercept = u - v
212
214
# 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):
216
218
# 1_n = vector of length n with entries equal one
217
219
# see https://stats.stackexchange.com/questions/384909/
218
220
#
219
- # Filtering out zero samples weights from the beginning makes life
221
+ # Filtering out zero sample weights from the beginning makes life
220
222
# easier for the linprog solver.
221
223
mask = sample_weight != 0
222
224
n_mask = int (np .sum (mask )) # use n_mask instead of n_samples
0 commit comments