Skip to content

Commit

Permalink
Add new pages and dependencies for drift metrics and local explainers
Browse files Browse the repository at this point in the history
  • Loading branch information
ruivieira committed Dec 11, 2023
1 parent db44698 commit d602570
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 3 deletions.
1 change: 1 addition & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ output:
antora:
extensions:
- require: '@antora/lunr-extension'
- require: '@djencks/asciidoctor-mathjax'
3 changes: 3 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* xref:main.adoc[]
* xref:features.adoc[]
** xref:bias-metrics.adoc[]
** xref:drift-metrics.adoc[]
** xref:local-explainers.adoc[]
* Tutorials
** xref:installing-opendatahub.adoc[]
** xref:bias-monitoring.adoc[]
Expand Down
42 changes: 42 additions & 0 deletions docs/modules/ROOT/pages/bias-metrics.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
= Bias metrics
// Settings
:idprefix:
:idseparator: -
:example-caption!:
:stem: latexmath

== Demographic Parity

=== Statistical Parity Difference (SPD)

The Statistical Parity Difference (SPD) is the difference in the probability of prediction between the privileged and unprivileged groups. Typically:

* stem:[SPD=0] means that the model is behaving fairly in regards of the selected attribute (e.g. race, gender)
* Values between stem:[-0.1<SPD<0.1] mean that the model is reasonably fair and the score can be attributed to other factors, such as sample size.
* An SPD outside this range would be an indicator of an unfair model relative to the protected attributes.
* A negative value of statistical parity difference indicates that the unprivileged group is at a disadvantage
* A positive value indicates that the privileged group is at a disadvantage.

The formal definition of SPD is

[stem]
++++
SPD=p(y=1|Du)-p(y=1|Dp)
++++

where y=1 is the favourable outcome and Du, Dp are respectively the privileged and unprivileged group data.

=== Disparate Impact Ratio (DIR)

Similarly to the Statistical Parity Difference, the Disparate Impact Ratio (DIR) measures imbalances in positive outcome predictions across privileged and unprivileged groups.
Instead of calculating the difference, this metric calculates the ratio of such selection rates. Typically:

* stem:[DIR=1] means that the model is fair with regards to the protected attribute.
* stem:[0.8<DIR<1.2] means that the model is reasonably fair.

The formal definition of the Disparate Impact Ratio is:

[stem]
++++
DIR=p(y=1|Du)p(y=1|Dp)
++++
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/bias-monitoring.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ hold with us. Both models use the following information about the applicant to m
* Length of Employment (in days)

What we want to verify is that neither of our models are not biased over the gender field of `Is Male-Identifying?`.
To do this, we will monitor our models with link:Statistical-Parity-Difference.md[Statistical Parity Difference] (SPD)
To do this, we will monitor our models with xref:bias-metrics.adoc#statistical-parity-difference-spd[Statistical Parity Difference] (SPD)
metric, which will tell us how the difference between how often male-identifying and non-male-identifying applicants are
given favorable predictions (_i.e._, they are predicted to pay back their loans).
Ideally, the SPD value would be 0, indicating that both groups have equal likelihood of getting a good outcome.
Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/drift-metrics.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= Drift metrics
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/local-explainers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= Local explainers
74 changes: 73 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"@antora/site-generator": "3.1.5"
},
"dependencies": {
"@antora/lunr-extension": "^1.0.0-alpha.8"
"@antora/lunr-extension": "^1.0.0-alpha.8",
"@djencks/asciidoctor-mathjax": "^0.0.9"
}
}
6 changes: 6 additions & 0 deletions ui-bundle/partials/head-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<script async src="https://www.googletagmanager.com/gtag/js?id={{this}}"></script>
<script>function gtag(){dataLayer.push(arguments)};window.dataLayer=window.dataLayer||[];gtag('js',new Date());gtag('config','{{this}}')</script>
{{/with}}
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>

<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
{{!--
<script>var uiRootPath = '{{{uiRootPath}}}'</script>
--}}
1 change: 1 addition & 0 deletions ui-bundle/partials/head-styles.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">

0 comments on commit d602570

Please sign in to comment.