Skip to content

Commit c964d7e

Browse files
committed
update doc
1 parent 2ea75d3 commit c964d7e

File tree

10 files changed

+192
-34
lines changed

10 files changed

+192
-34
lines changed

dist/rehline-0.0.1.tar.gz

660 Bytes
Binary file not shown.

doc/_templates/autoapi/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
API Reference
2+
=============
3+
4+
This page contains auto-generated API reference documentation [#f1]_.
5+
6+
.. toctree::
7+
:titlesonly:
8+
9+
/autoapi/rehline/index
10+
11+
.. [#f1] Created with `sphinx-autoapi <https://github.com/readthedocs/sphinx-autoapi>`_

doc/source/api.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ API Reference
77
rehline.ReHLine
88
###############
99

10-
ReHLine
11-
*******
10+
.. toctree::
1211

13-
.. autoclass:: rehline._class.ReHLine
14-
:members:
15-
:show-inheritance:
12+
autoapi/rehline/index
13+
14+
.. .. autoclass:: rehline._class.ReHLine
15+
.. :members:
16+
.. :show-inheritance:
17+

doc/source/conf.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
# release = '0.10'
2626

2727
import sys, os
28-
# sys.path.append('.')
29-
# sys.path.append('..')
28+
sys.path.append('.')
29+
sys.path.insert(0, os.path.abspath('../..'))
30+
sys.path.insert(0, os.path.abspath('../rehline'))
31+
# sys.path.append('../..')
3032
# sys.path.insert(0, os.path.abspath('.'))
3133
# sys.path.insert(0, os.path.abspath('../'))
3234
# sys.path.insert(0, os.path.abspath('../..'))
@@ -39,13 +41,15 @@
3941
master_doc = 'index'
4042
extensions = [
4143
'sphinx.ext.autodoc',
44+
'autoapi.extension',
4245
# "sphinx.ext.linkcode",
4346
# "sphinx.ext.intersphinx",
4447
"sphinx_autodoc_typehints",
4548
'sphinx.ext.autosummary',
4649
'numpydoc',
4750
'nbsphinx'
4851
]
52+
autoapi_dirs = ['../../rehline']
4953

5054
autosummary_generate = True
5155
numpydoc_show_class_members = False
@@ -102,3 +106,15 @@
102106
# html_css_files = [
103107
# 'css/custom.css',
104108
# ]
109+
110+
def skip_submodules(app, what, name, obj, skip, options):
111+
if what == "module":
112+
skip = True
113+
return skip
114+
115+
116+
def setup(sphinx):
117+
sphinx.connect("autoapi-skip-member", skip_submodules)
118+
119+
autoapi_template_dir = "_templates/autoapi"
120+
# autoapi_add_toctree_entry = False

doc/source/example.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Example
2+
=======

doc/source/index.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ See more details in `installation <./installation.rst>`_.
6363
\min_{\mathbf{\beta} \in \mathbb{R}^d} \sum_{i=1}^n \sum_{l=1}^L \text{ReLU}( u_{li} \mathbf{x}_i^\intercal \mathbf{\beta} + v_{li}) + \sum_{i=1}^n \sum_{h=1}^H {\text{ReHU}}_{\tau_{hi}}( s_{hi} \mathbf{x}_i^\intercal \mathbf{\beta} + t_{hi}) + \frac{1}{2} \| \mathbf{\beta} \|_2^2, \ \text{ s.t. } \mathbf{A} \mathbf{\beta} + \mathbf{b} \geq \mathbf{0},
6464
6565
66-
where :math:`\mathbf{U} = (u_{li}),\mathbf{V} = (v_{li}) \in \mathbb{R}^{L \times n}` and :math:`\mathbf{S} = (s_{hi}),\mathbf{T} = (t_{hi}),\mathbf{\tau} = (\tau_{hi}) \in \mathbb{R}^{H \times n}` are the ReLU-ReHU loss parameters, and $(\mathbf{A},\mathbf{b})$ are the constraint parameters. This formulation has a wide range of applications spanning various fields, including statistics, machine learning, computational biology, and social studies. Some popular examples include SVMs with fairness constraints (FairSVM), elastic net regularized quantile regression (ElasticQR), and ridge regularized Huber minimization (RidgeHuber).
66+
where :math:`\mathbf{U} = (u_{li}),\mathbf{V} = (v_{li}) \in \mathbb{R}^{L \times n}`
67+
and :math:`\mathbf{S} = (s_{hi}),\mathbf{T} = (t_{hi}),\mathbf{\tau} = (\tau_{hi}) \in \mathbb{R}^{H \times n}`
68+
are the ReLU-ReHU loss parameters, and :math:`(\mathbf{A},\mathbf{b})` are the constraint parameters.
69+
This formulation has a wide range of applications spanning various fields, including statistics,
70+
machine learning, computational biology, and social studies.
71+
Some popular examples include SVMs with fairness constraints (FairSVM),
72+
elastic net regularized quantile regression (ElasticQR),
73+
and ridge regularized Huber minimization (RidgeHuber).
6774

6875
.. image:: ./figs/tab.png
6976

@@ -99,7 +106,6 @@ Reference
99106

100107
installation
101108
example
102-
api
103109

104110
Indices and tables
105111
==================

rehline/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33

44
from ._loss import ReHLoss, PQLoss
55
from ._class import ReHLine, ReHLine_solver
6-
from ._base import make_fair_classification
6+
from ._base import relu, rehu, make_fair_classification
7+
8+
__all__ = ("ReHLine",
9+
"ReHLoss",
10+
"make_fair_classification", "relu", "rehu")

rehline/_base.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,27 @@
1212

1313
def relu(x):
1414
"""
15-
Evaluation of ReLU given a vector
15+
Evaluation of ReLU given a vector.
1616
1717
Parameters
1818
----------
1919
2020
x: {array-like} of shape (n_samples, )
2121
Training vector, where `n_samples` is the number of samples
2222
23+
24+
Returns
25+
-------
26+
array of shape (n_samples, )
27+
An array with ReLU applied, i.e., all negative values are replaced with 0.
28+
2329
"""
2430
return np.maximum(x, 0)
2531

2632

2733
def rehu(x, cut=1):
2834
"""
29-
Evaluation of ReHU given a vector
35+
Evaluation of ReHU given a vector.
3036
3137
Parameters
3238
----------
@@ -37,6 +43,11 @@ def rehu(x, cut=1):
3743
cut: {array-like} of shape (n_samples, )
3844
Cutpoints of ReHU, where `n_samples` is the number of samples
3945
46+
Returns
47+
-------
48+
array of shape (n_samples, )
49+
The result of the ReHU function.
50+
4051
"""
4152
n_samples = x.shape[0]
4253
cut = cut * np.ones_like(x)

0 commit comments

Comments
 (0)