Skip to content

Commit 26cd739

Browse files
authored
Merge pull request #11 from DataboyUsen/main
Update _base.py
2 parents 5f24620 + 080ab64 commit 26cd739

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

rehline/_base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def _make_loss_rehline_param(loss, X, y):
254254
The function supports various loss functions, including:
255255
- 'hinge'
256256
- 'svm' or 'SVM'
257+
- 'mae' or 'MAE' or 'mean absolute error'
257258
- 'check' or 'quantile' or 'quantile regression' or 'QR'
258259
- 'sSVM' or 'smooth SVM' or 'smooth hinge'
259260
- 'TV'
@@ -358,6 +359,14 @@ def _make_loss_rehline_param(loss, X, y):
358359
V[0] = -(y + loss['epsilon'])
359360
V[1] = (y - loss['epsilon'])
360361

362+
363+
elif (loss['name'] == 'MAE') \
364+
or (loss['name'] == 'mae') \
365+
or (loss['name'] == 'mean absolute error'):
366+
U = np.array([[1.0] * n, [-1.0] * n])
367+
V = np.array([-y , y])
368+
369+
361370
else:
362371
raise Exception("Sorry, ReHLine currently does not support this loss function, \
363372
but you can manually set ReHLine params to solve the problem via `ReHLine` class.")
@@ -525,4 +534,4 @@ def _make_penalty_rehline_param(self, penalty=None, X=None):
525534
# self.U = U_new
526535
# self.V = V_new
527536
# self.auto_shape()
528-
# return X_fake
537+
# return X_fake

0 commit comments

Comments
 (0)