アルゴリズムの設計や学習過程で生じる偏り
AI・データの利用は社会に影響します。 公平性・透明性・プライバシーを最初から設計に組み込みましょう。
本ページでは アルゴリズムバイアス を、 定義・前提条件・使い方・落とし穴の順に整理して解説します。 厳密な定義より、 まず何を、 いつ、 どう使うかを理解することを優先してください。
アルゴリズムの設計や学習過程で生じる偏り
英語名 Algorithm Bias。 同義・関連語:AIバイアス。
この用語を理解・使用するときは、 次のような前提を意識してください:
SSDSE-B-2026 のような公的統計データを Python で扱う際の基本パターン:
1 2 3 4 5 6 7 8 9 10 11 12 | import pandas as pd import numpy as np # データ読み込み df = pd.read_csv('data/raw/SSDSE-B-2026.csv', encoding='utf-8', skiprows=1) print(df.shape) print(df.dtypes) print(df.describe()) # 「アルゴリズムバイアス」の文脈で扱う場合の例: # 分野: 倫理 # 関連手法は同カテゴリの他用語を参照してください。 |
具体的なコードは AI倫理・公平性 を参照してください。
分析結果を報告するときに含めるべき情報:
アルゴリズムバイアス とは、 AI システムが特定のグループに不利な判定を行う現象。 採用 AI が女性応募者を不利に扱った Amazon の事例、 米国の COMPAS(再犯予測)が黒人被告に高リスクを付ける傾向など、 重大な事例が国際的に報告されてきました。
| 群 | サンプル数 | 高齢化率 平均 | 差分 |
|---|---|---|---|
| 大都市 6 都府県 | 6 | 26.5% | −2.6 |
| 地方 41 道県 | 41 | 31.5% | +2.4 |
| DI (a/b) | — | 0.84 | 許容域内 |
1 2 3 4 5 6 7 | # 簡単な差分指標 : 都道府県別の平均との乖離
import pandas as pd
df = pd.read_csv('data/raw/SSDSE-B-2026.csv', encoding='utf-8', skiprows=1)
df['高齢化率'] = df['A1301'] / df['A1101'] * 100
national = df['高齢化率'].mean()
df['差分'] = df['高齢化率'] - national
print(df[['Prefecture','差分']].sort_values('差分').head()) |
1 2 3 4 5 6 | # Disparate Impact (DI) : 都市群 vs 地方群
city = ['東京都','大阪府','愛知県','神奈川県','埼玉県','千葉県']
g_city = df[df['Prefecture'].isin(city)]['高齢化率'].mean()
g_rural = df[~df['Prefecture'].isin(city)]['高齢化率'].mean()
di = g_city / g_rural
print(f'DI = {di:.3f} (0.8〜1.25 が許容域)') |
1 2 3 4 | # サンプリングバイアスの確認 : 各群のサイズ
sizes = df.groupby(df['Prefecture'].isin(city))['A1101'].sum()
print(sizes)
print(f'都市/地方 人口比 = {sizes[True] / sizes[False]:.2f}') |
1 2 3 4 5 6 7 8 9 10 | # 予測モデルでの公平性チェック (sklearn)
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import numpy as np
df['high_aging'] = (df['高齢化率'] > 30).astype(int)
X = df[['A1101']].values
y = df['high_aging'].values
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.3, random_state=0)
m = LogisticRegression().fit(Xtr, ytr)
print('係数:', m.coef_, '切片:', m.intercept_) |
| 群 | サンプル数 | 平均高齢化率 | 差分(vs全国) |
|---|---|---|---|
| 関東 | 7 | 27.8% | -1.3 |
| 近畿 | 6 | 29.3% | +0.2 |
| 東北 | 6 | 34.2% | +5.1 |
| 中国 | 5 | 32.4% | +3.3 |
| 沖縄 | 1 | 22.8% | -6.3 |
1 2 3 4 5 6 7 8 | import pandas as pd
df = pd.read_csv('data/raw/SSDSE-B-2026.csv', encoding='utf-8', skiprows=1)
df['高齢化率'] = df['A1301']/df['A1101']*100
df['urban'] = df['A1101'] >= 2_000_000
df['high'] = (df['高齢化率'] >= 30).astype(int)
p_urban = df[df['urban']]['high'].mean()
p_rural = df[~df['urban']]['high'].mean()
print(f'DP差 = {p_urban - p_rural:+.3f}') |
1 2 3 4 5 6 7 | from sklearn.metrics import roc_auc_score
import numpy as np
scores = df['高齢化率'].values # 仮スコア
for grp in [True, False]:
mask = df['urban'].values == grp
auc = roc_auc_score(df['high'][mask], scores[mask]) if mask.sum() > 1 else None
print(f'urban={grp}: AUC={auc}') |
1 2 3 4 5 6 | from sklearn.utils import resample rural = df[~df['urban']] urban = df[df['urban']] urban_up = resample(urban, n_samples=len(rural), random_state=0) balanced = pd.concat([rural, urban_up]) print(balanced['urban'].value_counts()) |
2016 年の ProPublica 記事「Machine Bias」が COMPAS(米国の再犯予測)の人種差を指摘。 学界・社会で大議論を呼びました。
2018 年 MIT の Buolamwini らによる Gender Shades 研究が、 商用顔認識システムの肌色/性別による精度差を定量化。 IBM や Microsoft は数か月後に改良版を発表。
EU AI Act(2024)は高リスク AI に対してバイアス監査を義務化。 米国も「Algorithmic Accountability Act」が議論されています。