Skip to content

Commit cc807e8

Browse files
committed
updated sphinx docs
1 parent 389fdd3 commit cc807e8

24 files changed

Lines changed: 522 additions & 75 deletions

docs/api/error_parity.binarize.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error\_parity.binarize
2+
======================
3+
4+
.. automodule:: error_parity.binarize
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
compute_binary_predictions
12+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error\_parity.classifiers
2+
=========================
3+
4+
.. automodule:: error_parity.classifiers
5+
6+
7+
.. rubric:: Classes
8+
9+
.. autosummary::
10+
11+
BinaryClassifier
12+
BinaryClassifierAtROCDiagonal
13+
Classifier
14+
EnsembleGroupwiseClassifiers
15+
RandomizedClassifier
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error\_parity.cvxpy\_utils
2+
==========================
3+
4+
.. automodule:: error_parity.cvxpy_utils
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
compute_fair_optimum
12+
compute_halfspace_inequality
13+
compute_line
14+
make_cvxpy_halfspace_inequality
15+
make_cvxpy_point_in_polygon_constraints
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error\_parity.evaluation
2+
========================
3+
4+
.. automodule:: error_parity.evaluation
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
eval_accuracy_and_equalized_odds
12+
evaluate_fairness
13+
evaluate_performance
14+
evaluate_predictions
15+
evaluate_predictions_bootstrap
16+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error\_parity.pareto\_curve
2+
===========================
3+
4+
.. automodule:: error_parity.pareto_curve
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
compute_inner_and_outer_adjustment_ci
12+
compute_postprocessing_curve
13+
fit_and_evaluate_postprocessing
14+
get_envelope_of_postprocessing_frontier
15+

docs/api/error_parity.plotting.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error\_parity.plotting
2+
======================
3+
4+
.. automodule:: error_parity.plotting
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
plot_polygon_edges
12+
plot_postprocessing_frontier
13+
plot_postprocessing_solution
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error\_parity.roc\_utils
2+
========================
3+
4+
.. automodule:: error_parity.roc_utils
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
calc_cost_of_point
12+
compute_global_roc_from_groupwise
13+
compute_roc_point_from_predictions
14+
roc_convex_hull
15+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error\_parity.threshold\_optimizer
2+
==================================
3+
4+
.. automodule:: error_parity.threshold_optimizer
5+
6+
7+
.. rubric:: Classes
8+
9+
.. autosummary::
10+
11+
RelaxedThresholdOptimizer
12+

docs/concepts.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Core concepts
2+
=============
3+
4+
ROC curves and convex hulls
5+
---------------------------
6+
7+
For each group, the model induces an ROC curve of achievable (FPR, TPR) pairs by thresholding scores. The convex hull of this curve characterizes all achievable points by mixing thresholds and, when necessary, randomization.
8+
9+
Randomized thresholds
10+
---------------------
11+
12+
When the optimal target lies strictly inside a segment of the ROC hull, it is realized by a randomized classifier that mixes at most two deterministic thresholds, and, if needed, the diagonal (random) classifier. See :class:`error_parity.classifiers.RandomizedClassifier`.
13+
14+
Fairness constraints
15+
--------------------
16+
17+
Let groups be indexed by ``a, b``. We support constraints expressed on group-specific rates. Examples:
18+
19+
- Equalized odds: constrain distances between (TPR, FPR) pairs across groups.
20+
- Equal opportunity: constrain TPR parity.
21+
- Predictive equality: constrain FPR parity.
22+
- Demographic parity: constrain PPR (positive prediction rate) parity.
23+
24+
Relaxations and \(\ell_p\) norms
25+
----------------------------------
26+
27+
For equalized odds, distances between group ROC points are measured with an \(\ell_p\) norm, e.g., \(\ell_\infty\) (default), \(\ell_1\) (sum of absolute differences), or \(\ell_2\).
28+
29+
Costs and performance
30+
---------------------
31+
32+
The optimizer can compute theoretical cost at the global solution point for user-specified false positive and false negative costs. With unit costs, cost equals error rate. See :meth:`error_parity.threshold_optimizer.RelaxedThresholdOptimizer.cost`.
33+

docs/conf.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
extensions = [
2929
'sphinx_rtd_theme',
3030
'sphinx.ext.autodoc',
31+
'sphinx.ext.intersphinx',
3132
'sphinx.ext.coverage',
3233
'sphinx.ext.napoleon',
3334
'sphinx.ext.autosummary',
@@ -48,6 +49,24 @@
4849
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
4950

5051
autoclass_content = 'both'
52+
autosummary_generate = True
53+
autodoc_typehints = 'description'
54+
napoleon_numpy_docstring = True
55+
napoleon_google_docstring = False
56+
napoleon_use_param = True
57+
napoleon_use_rtype = True
58+
59+
autosectionlabel_prefix_document = True
60+
61+
myst_heading_anchors = 3
62+
63+
intersphinx_mapping = {
64+
'python': ('https://docs.python.org/3', None),
65+
'numpy': ('https://numpy.org/doc/stable/', None),
66+
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
67+
'sklearn': ('https://scikit-learn.org/stable/', None),
68+
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
69+
}
5170

5271
# -- Options for HTML output -------------------------------------------------
5372
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

0 commit comments

Comments
 (0)