Skip to content

Commit c63c165

Browse files
authored
Merge pull request #28 from softmin/monotonic-constraints
Monotonic constraints
2 parents 6ad5732 + 213d101 commit c63c165

6 files changed

Lines changed: 318 additions & 171 deletions

File tree

doc/source/tutorials/constraint.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Usage
77
-----
88

99
.. code:: python
10-
11-
# list of
10+
11+
# list of
1212
# name (str): name of the custom linear constraints
1313
# loss_kwargs: more keys and values for constraint parameters
1414
constraint = [{'name': <constraint_name>, <**constraint_kwargs>}, ...]
@@ -20,7 +20,7 @@ Usage
2020

2121
* - constraint
2222
- | args
23-
- | Example
23+
- | Example
2424

2525
* - **nonnegative**
2626
- | ``name``: 'nonnegative' or '>=0'
@@ -32,6 +32,11 @@ Usage
3232
| ``tol_sen``: 1d array [p] of tolerance for fairness
3333
- | ``constraint=[{'name': 'fair', 'sen_idx': sen_idx, 'tol_sen': tol_sen}]``
3434

35+
* - **monotonic**
36+
- | ``name``: 'monotonic' or 'monotonicity'
37+
| ``decreasing`` (*bool*): False (default)
38+
- | ``constraint=[{'name': 'monotonic', 'decreasing': True}]``
39+
3540
* - **custom**
3641
- | ``name``: 'custom'
3742
| ``A``: 2d array [K x d] for linear constraint coefficients

doc/source/tutorials/loss.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Usage
77
-----
88

99
.. code:: python
10-
10+
1111
# name (str): name of the custom loss function
1212
# loss_kwargs: more keys and values for loss parameters
1313
loss = {'name': <loss_name>, <**loss_kwargs>}
@@ -24,7 +24,7 @@ Classification loss
2424

2525
* - loss
2626
- | args
27-
- | Example
27+
- | Example
2828

2929
* - **SVM**
3030
- | ``name``: 'hinge' / 'svm' / 'SVM'
@@ -48,7 +48,7 @@ Regression loss
4848

4949
* - loss
5050
- | args
51-
- | Example
51+
- | Example
5252

5353
* - **Quantile Reg**
5454
- | ``name``: 'check' / 'quantile' / 'QR'
@@ -57,7 +57,8 @@ Regression loss
5757

5858
* - **Huber**
5959
- | ``name``: 'huber' / 'Huber'
60-
- | ``loss={'name': 'huber'}``
60+
| ``tau`` (*float*): 1.0 (default)
61+
- | ``loss={'name': 'huber', 'tau': 1.0}``
6162

6263
* - **SVR**
6364
- | ``name``: 'SVR' / 'svr'

0 commit comments

Comments
 (0)