docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
---
|
||||
id: wiki-2026-0508-algorithmic-fairness
|
||||
title: Algorithmic Fairness
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [AI fairness, ML bias, fair ML, algorithmic bias, group fairness]
|
||||
duplicate_of: none
|
||||
source_trust_level: B
|
||||
confidence_score: 0.85
|
||||
verification_status: conceptual
|
||||
tags: [fairness, bias, ml-ethics, disparate-impact, audit, ai-governance, compas, gender-shades]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-09
|
||||
github_commit: pending
|
||||
---
|
||||
|
||||
# Algorithmic Fairness
|
||||
|
||||
## 📌 한 줄 통찰
|
||||
> **"매 group 의 differential impact 의 measure + mitigate"**. 매 ML system 의 bias = data + algorithm + deployment. **Pre-processing / In-processing / Post-processing** 의 3 stage 의 fairness intervention.
|
||||
|
||||
## 📖 핵심
|
||||
|
||||
### 매 fairness 의 definition
|
||||
|
||||
#### 1. Group fairness
|
||||
- **Demographic parity**: 매 group 의 same positive rate.
|
||||
- **Equal opportunity**: 매 group 의 same TPR.
|
||||
- **Equalized odds**: TPR + FPR 둘 다 same.
|
||||
- **Calibration**: 매 score 의 same meaning.
|
||||
|
||||
→ 매 mathematically incompatible (impossibility theorem).
|
||||
|
||||
#### 2. Individual fairness
|
||||
- 매 similar individual 의 similar treatment.
|
||||
- "Similar" 의 definition 어려움.
|
||||
|
||||
#### 3. Counterfactual fairness
|
||||
- 매 prediction 의 unchanged if protected attribute 변경.
|
||||
- 매 causal model 필요.
|
||||
|
||||
### 매 famous case
|
||||
|
||||
#### COMPAS (recidivism)
|
||||
- ProPublica 2016.
|
||||
- 매 black defendant 의 false positive rate 2x.
|
||||
- 매 risk score 의 racial bias.
|
||||
|
||||
#### Gender Shades (face recognition)
|
||||
- Joy Buolamwini, Timnit Gebru 2018.
|
||||
- 매 dark-skinned female 의 error rate 35% (vs light male 1%).
|
||||
|
||||
#### Amazon hiring AI (2018)
|
||||
- 매 resume + woman keyword 의 penalty.
|
||||
- 매 historical bias 의 reproduce.
|
||||
|
||||
→ 매 abandon.
|
||||
|
||||
#### Apple Card (2019)
|
||||
- 매 credit limit 의 woman 의 lower (same financial profile).
|
||||
|
||||
#### Healthcare risk score (2019)
|
||||
- 매 black patient 의 lower risk score (same need).
|
||||
- 매 historical 의 healthcare expenditure (proxy bias).
|
||||
|
||||
### 매 source of bias
|
||||
|
||||
#### Data
|
||||
- **Historical**: 매 past discrimination.
|
||||
- **Representation**: 매 underrepresented group.
|
||||
- **Measurement**: 매 different signal quality per group.
|
||||
|
||||
#### Algorithm
|
||||
- 매 objective function 의 majority bias.
|
||||
- 매 feature selection.
|
||||
- 매 hyperparameter tuning.
|
||||
|
||||
#### Deployment
|
||||
- 매 user feedback loop.
|
||||
- 매 differential adoption.
|
||||
- 매 contextual mismatch.
|
||||
|
||||
### 매 mitigation strategy
|
||||
|
||||
#### Pre-processing (data)
|
||||
- 매 reweight sample.
|
||||
- 매 generate synthetic minority.
|
||||
- 매 protected attribute 의 remove (often insufficient — proxy).
|
||||
|
||||
#### In-processing (training)
|
||||
- 매 fairness constraint 의 add to loss.
|
||||
- Adversarial debiasing.
|
||||
- 매 prejudice remover.
|
||||
|
||||
#### Post-processing (output)
|
||||
- 매 threshold 의 group-specific.
|
||||
- 매 score calibration.
|
||||
- Rejection option classification.
|
||||
|
||||
### 매 audit / measurement
|
||||
|
||||
#### Disparate impact
|
||||
- 4/5 rule (US EEOC).
|
||||
- 매 minority 의 selection rate < 80% of majority = potential discrimination.
|
||||
|
||||
#### AIF360 (IBM)
|
||||
- 매 70+ fairness metric.
|
||||
- 매 9 mitigation algorithm.
|
||||
- Open source.
|
||||
|
||||
#### Aequitas (Univ. Chicago)
|
||||
- 매 audit toolkit.
|
||||
|
||||
#### Google What-If Tool
|
||||
- 매 interactive exploration.
|
||||
|
||||
### 매 regulation
|
||||
- **EU AI Act**: 매 high-risk 의 bias check.
|
||||
- **NYC Local Law 144**: hiring AI 의 annual audit.
|
||||
- **EEOC** (US): employment discrimination.
|
||||
- **GDPR Article 22**: 매 automated decision 의 human review.
|
||||
|
||||
### 매 organizational practice
|
||||
|
||||
#### Pre-deployment
|
||||
- 매 audit.
|
||||
- 매 disparate impact analysis.
|
||||
- 매 adversarial test.
|
||||
- 매 model card 의 disclosure.
|
||||
|
||||
#### Production
|
||||
- 매 monitoring.
|
||||
- 매 user feedback.
|
||||
- 매 quarterly review.
|
||||
|
||||
#### Incident
|
||||
- 매 user 의 complaint.
|
||||
- 매 root cause.
|
||||
- 매 remediation.
|
||||
|
||||
## 💻 Code
|
||||
|
||||
### Disparate impact (AIF360)
|
||||
```python
|
||||
from aif360.datasets import BinaryLabelDataset
|
||||
from aif360.metrics import BinaryLabelDatasetMetric, ClassificationMetric
|
||||
|
||||
# Wrap your dataset
|
||||
dataset = BinaryLabelDataset(
|
||||
df=df,
|
||||
label_names=['hired'],
|
||||
protected_attribute_names=['gender'],
|
||||
favorable_label=1,
|
||||
unfavorable_label=0,
|
||||
)
|
||||
|
||||
# Pre-train metric
|
||||
metric = BinaryLabelDatasetMetric(
|
||||
dataset,
|
||||
unprivileged_groups=[{'gender': 0}],
|
||||
privileged_groups=[{'gender': 1}],
|
||||
)
|
||||
print(f"Disparate impact: {metric.disparate_impact()}")
|
||||
# < 0.8 = potential bias (4/5 rule)
|
||||
|
||||
# After model: classification metric
|
||||
classified = BinaryLabelDataset(...) # with predictions
|
||||
clf_metric = ClassificationMetric(
|
||||
dataset, classified,
|
||||
unprivileged_groups=[{'gender': 0}],
|
||||
privileged_groups=[{'gender': 1}],
|
||||
)
|
||||
print(f"Equal opportunity diff: {clf_metric.equal_opportunity_difference()}")
|
||||
print(f"Avg odds diff: {clf_metric.average_odds_difference()}")
|
||||
```
|
||||
|
||||
### Reweighting (pre-processing)
|
||||
```python
|
||||
from aif360.algorithms.preprocessing import Reweighing
|
||||
|
||||
rw = Reweighing(
|
||||
unprivileged_groups=[{'gender': 0}],
|
||||
privileged_groups=[{'gender': 1}],
|
||||
)
|
||||
dataset_rw = rw.fit_transform(dataset)
|
||||
|
||||
# Train on reweighted data
|
||||
model = train(dataset_rw)
|
||||
```
|
||||
|
||||
### Adversarial debiasing (in-processing)
|
||||
```python
|
||||
from aif360.algorithms.inprocessing import AdversarialDebiasing
|
||||
import tensorflow as tf
|
||||
|
||||
sess = tf.Session()
|
||||
debiased = AdversarialDebiasing(
|
||||
privileged_groups=[{'gender': 1}],
|
||||
unprivileged_groups=[{'gender': 0}],
|
||||
scope_name='debiased',
|
||||
debias=True,
|
||||
sess=sess,
|
||||
)
|
||||
debiased.fit(dataset_train)
|
||||
preds = debiased.predict(dataset_test)
|
||||
```
|
||||
|
||||
### Threshold optimization (post-processing)
|
||||
```python
|
||||
from aif360.algorithms.postprocessing import EqOddsPostprocessing
|
||||
|
||||
eq_odds = EqOddsPostprocessing(
|
||||
unprivileged_groups=[{'gender': 0}],
|
||||
privileged_groups=[{'gender': 1}],
|
||||
)
|
||||
eq_odds.fit(dataset_val, predictions_val)
|
||||
predictions_balanced = eq_odds.predict(predictions_test)
|
||||
```
|
||||
|
||||
### Fairness in CI
|
||||
```python
|
||||
def fairness_test(model, X_test, y_test, groups):
|
||||
"""매 release 의 fairness gate."""
|
||||
accuracies = {}
|
||||
for group_value in np.unique(groups):
|
||||
mask = groups == group_value
|
||||
accuracies[group_value] = model.score(X_test[mask], y_test[mask])
|
||||
|
||||
disparity = max(accuracies.values()) - min(accuracies.values())
|
||||
if disparity > 0.05:
|
||||
raise FairnessFailure(f"Disparity: {disparity:.2%}")
|
||||
```
|
||||
|
||||
### Counterfactual test
|
||||
```python
|
||||
def counterfactual_test(model, instance, protected_attr='gender'):
|
||||
"""매 attribute 의 flip 의 prediction change."""
|
||||
pred_original = model.predict([instance])
|
||||
|
||||
flipped = instance.copy()
|
||||
flipped[protected_attr] = 1 - flipped[protected_attr]
|
||||
pred_flipped = model.predict([flipped])
|
||||
|
||||
if pred_original != pred_flipped:
|
||||
return f"Bias detected: {protected_attr} flip changes prediction"
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
|
||||
| Risk level | Mitigation |
|
||||
|---|---|
|
||||
| Low (spam filter) | Audit log + monitor |
|
||||
| Medium (recommendation) | + Disparate impact check |
|
||||
| High (hiring, lending) | + Pre/in/post-processing |
|
||||
| Critical (criminal justice, medical) | + Strict regulation + human review |
|
||||
|
||||
**기본값**: 4/5 rule check + per-group accuracy + counterfactual test + disclosure.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[AI-Ethics]] · [[AI Accountability]]
|
||||
- 변형: [[Group-Fairness]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 ML system 의 deployment review. 매 audit. 매 high-risk 의 design.
|
||||
**언제 X**: Specific legal advice (lawyer). Specific implementation 의 detail.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **"Just remove protected attribute"**: 매 proxy 의 still bias.
|
||||
- **Single fairness metric**: 매 trade-off 의 ignore.
|
||||
- **No audit**: silent bias.
|
||||
- **Historical data 의 trust**: 매 past discrimination 의 amplify.
|
||||
- **Disparate impact 의 fix only**: 매 individual 의 unfair still.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified.
|
||||
- 신뢰도 B (academic + industry consensus).
|
||||
- Related: [[AI Accountability]] · [[AI 거버넌스 정책(AI Usage Policy)|AI-Governance-Policy]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-09 | Manual cleanup — fairness type + famous case + AIF360 code + 결정 |
|
||||
Reference in New Issue
Block a user