公平性: バイアスを特定する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
モデルのトレーニングと評価用にデータを準備する際は、公平性の問題を念頭に置き、バイアスの潜在的な原因を監査して、モデルを本番環境にリリースする前にその影響を事前に軽減できるようにすることが重要です。
バイアスが潜んでいる可能性のある場所はどこですか?データセットで注意すべき危険信号は次のとおりです。
欠損している特徴値
データセットに、多数のサンプルで欠損値がある特徴が 1 つ以上ある場合、データセットの特定の重要な特性が過小評価されていることを示している可能性があります。
演習: 理解度を確認する
品種、年齢、体重、気質、1 日に抜ける毛の量など、さまざまな特徴に基づいて、保護犬の養子縁組の可能性を予測するモデルをトレーニングしています。目標は、犬の身体的または行動的な特徴に関係なく、すべての種類の犬に対してモデルが同等のパフォーマンスを発揮することです。
トレーニング セット内の 5,000 個のサンプルのうち、1,500 個のサンプルに気質の値がないことがわかりました。次のうち、調査すべきバイアスの潜在的な原因はどれですか。
特定の犬種では、気質に関するデータが欠落している可能性が高いです。
気質データの可用性が犬種と相関している場合、特定の犬種の養子縁組の予測の精度が低下する可能性があります。
12 か月未満の犬は、気質データが欠落している可能性が高い
気質データの可用性が年齢と相関している場合、子犬と成犬では養子縁組の予測の精度が低下する可能性があります。
大都市から救助された犬には、性格に関するデータがありません。
一見すると、これはバイアスの潜在的な原因には見えません。データの欠落は、犬の品種、年齢、体重などに関係なく、大都市のすべての犬に等しく影響するためです。しかし、犬の居住地がこれらの身体的特徴の代用として効果的に機能する可能性があることを考慮する必要があります。たとえば、大都市の犬が田舎の犬よりもかなり小さい傾向がある場合、体重の軽い犬や特定の小型犬の飼いやすさの予測の精度が低下する可能性があります。
データセットから気質データがランダムに欠落している。
気質データが本当に無作為に欠落している場合は、偏りの原因となる可能性はありません。ただし、気質データがランダムに欠落しているように見えることがありますが、詳細な調査で差異の説明が明らかになる可能性があります。そのため、データのギャップがランダムであると想定するのではなく、徹底的なレビューを行って他の可能性を排除することが重要です。
想定外の特徴値
データを探索する際は、特に特徴的でない、または異常であるとして際立った特徴値を含む例も探す必要があります。このような予期しない特徴値は、データ収集中に発生した問題や、バイアスをもたらす可能性のある不正確さを示している可能性があります。
演習:理解度をチェックする
救助犬の養子縁組モデルをトレーニングするための次の架空の例を確認します。
品種 |
年齢(年) |
体重(ポンド) |
気性 |
shedding_level |
トイプードル |
2 |
12 |
わくわくする |
低 |
ゴールデン レトリバー |
7 |
65 |
冷静 |
高 |
ラブラドール レトリバー |
35 |
73 |
冷静 |
高 |
フレンチ ブルドッグ |
0.5 |
11 |
冷静 |
中 |
不明な混合種 |
4 |
45 |
興奮しやすい |
高 |
バセット ハウンド |
9 |
48 |
冷静 |
中 |
特徴データに問題はありますか。
回答を確認する
品種 |
年齢(年) |
体重(ポンド) |
気性 |
shedding_level |
トイプードル |
2 |
12 |
わくわくする |
低 |
ゴールデン レトリバー |
7 |
65 |
冷静 |
高 |
ラブラドール レトリバー |
35 |
73 |
冷静 |
高 |
フレンチ ブルドッグ |
0.5 |
11 |
冷静 |
中 |
不明な混合種 |
4 |
45 |
興奮しやすい |
高 |
バセット ハウンド |
9 |
48 |
冷静 |
中 |
ギネス世界記録で年齢が確認された最長寿の犬は、29 年 5 か月生きたオーストラリアン キャトルドッグの Bluey です。そのため、ラブラドール レトリバーが実際に 35 歳であるという事実はあまり考えられません。また、犬の年齢が計算または正確に記録されていない可能性が高いと言えます(犬は実際には 3.5 歳)。このエラーは、データセット内の年齢データの精度に関する広範な問題を示している可能性があり、さらに調査する必要があります。
データスキュー
データに偏りがあり、特定のグループや特性が実際の割合よりも過小または過大に表現されている場合、モデルにバイアスが生じる可能性があります。
モデルのパフォーマンスを監査する際は、結果を集計で確認するだけでなく、サブグループ別に結果を分類することが重要です。たとえば、Google の「レスキュー ドッグ」導入可能性モデルの場合、公平性を確保するために、全体的な精度に目を向けるだけでは不十分です。また、サブグループ別のパフォーマンスを監査して、犬の品種、年齢グループ、サイズグループごとにモデルのパフォーマンスが同等であることを確認する必要があります。
このモジュールの後半のバイアスの評価では、サブグループごとにモデルを評価するさまざまな方法について詳しく説明します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-11-10 UTC。
[null,null,["最終更新日 2024-11-10 UTC。"],[[["\u003cp\u003eTraining data should represent real-world prevalence to avoid bias in machine learning models.\u003c/p\u003e\n"],["\u003cp\u003eMissing or unexpected feature values in the dataset can be indicative of potential sources of bias.\u003c/p\u003e\n"],["\u003cp\u003eData skew, where certain groups are under- or over-represented, can introduce bias and should be addressed.\u003c/p\u003e\n"],["\u003cp\u003eEvaluating model performance by subgroup ensures fairness and equal performance across different characteristics.\u003c/p\u003e\n"],["\u003cp\u003eAuditing for bias requires a thorough review of data and model outcomes to mitigate potential negative impacts.\u003c/p\u003e\n"]]],[],null,["# Fairness: Identifying bias\n\nAs you prepare your data for model training and evaluation, it's important to\nkeep issues of fairness in mind and audit for potential sources of\n[**bias**](/machine-learning/glossary#bias-ethicsfairness), so you can\nproactively mitigate its effects before releasing your model into production.\n\nWhere might bias lurk? Here are some red flags to look out for in your dataset.\n\nMissing feature values\n----------------------\n\nIf your dataset has one or more features that have missing values for a large\nnumber of examples, that could be an indicator that certain key characteristics\nof your dataset are under-represented.\n\n### Exercise: Check your understanding\n\nYou're training a model to predict adoptability of rescue dogs based on a variety of features, including breed, age, weight, temperament, and quantity of fur shed each day. Your goal is to ensure the model performs equally well on all types of dogs, irrespective of their physical or behavioral characteristics \n\n\u003cbr /\u003e\n\nYou discover that 1,500 of the 5,000 examples in the training set are\nmissing temperament values. Which of the following are potential sources\nof bias you should investigate? \nTemperament data is more likely to be missing for certain breeds of dogs. \nIf the availability of temperament data correlates with dog breed, then this might result in less accurate adoptability predictions for certain dog breeds. \nTemperament data is more likely to be missing for dogs under 12 months in age \nIf the availability of temperament data correlates with age, then this might result in less accurate adoptability predictions for puppies versus adult dogs. \nTemperament data is missing for all dogs rescued from big cities. \nAt first glance, it might not appear that this is a potential source of bias, since the missing data would affect all dogs from big cities equally, irrespective of their breed, age, weight, etc. However, we still need to consider that the location a dog is from might effectively serve as a proxy for these physical characteristics. For example, if dogs from big cities are significantly more likely to be smaller than dogs from more rural areas, that could result in less accurate adoptability predictions for lower-weight dogs or certain small-dog breeds. \nTemperament data is missing from the dataset at random. \nIf temperament data is truly missing at random, then that would not be a potential source of bias. However, it's possible temperament data might appear to be missing at random, but further investigation might reveal an explanation for the discrepancy. So it's important to do a thorough review to rule out other possibilities, rather than assume data gaps are random.\n\nUnexpected feature values\n-------------------------\n\nWhen exploring data, you should also look for examples that contain feature values\nthat stand out as especially uncharacteristic or unusual. These unexpected feature\nvalues could indicate problems that occurred during data collection or other\ninaccuracies that could introduce bias.\n\n### Exercise: Check your understanding\n\nReview the following hypothetical set of examples for training a rescue-dog\nadoptability model.\n\n| breed | age (yrs) | weight (lbs) | temperament | shedding_level |\n|---------------------|-----------|--------------|-------------|----------------|\n| toy poodle | 2 | 12 | excitable | low |\n| golden retriever | 7 | 65 | calm | high |\n| labrador retriever | 35 | 73 | calm | high |\n| french bulldog | 0.5 | 11 | calm | medium |\n| unknown mixed breed | 4 | 45 | excitable | high |\n| basset hound | 9 | 48 | calm | medium |\n\nCan you identify any problems with the feature data? \nClick here to see the answer \n\n| breed | age (yrs) | weight (lbs) | temperament | shedding_level |\n|---------------------|-----------|--------------|-------------|----------------|\n| toy poodle | 2 | 12 | excitable | low |\n| golden retriever | 7 | 65 | calm | high |\n| labrador retriever | 35 | 73 | calm | high |\n| french bulldog | 0.5 | 11 | calm | medium |\n| unknown mixed breed | 4 | 45 | excitable | high |\n| basset hound | 9 | 48 | calm | medium |\n\nThe oldest dog to have their age verified by *Guinness World Records*\nwas [Bluey](https://wikipedia.org/wiki/Bluey_(long-lived_dog)),\nan Australian Cattle Dog who lived to be 29 years and 5 months. Given that, it\nseems quite implausible that the labrador retriever is actually 35 years old,\nand more likely that the dog's age was either calculated or recorded\ninaccurately (maybe the dog is actually 3.5 years old). This error could\nalso be indicative of broader accuracy issues with age data in the dataset\nthat merit further investigation.\n\nData skew\n---------\n\nAny sort of skew in your data, where certain groups or characteristics may be\nunder- or over-represented relative to their real-world prevalence, can\nintroduce bias into your model.\n\nWhen auditing model performance, it's important not only to look at results in\naggregate, but to break out results by subgroup. For example, in the case of\nour rescue-dog adoptability model, to ensure fairness, it's not sufficient to\nsimply look at overall accuracy. We should also audit performance by subgroup\nto ensure the model performs equally well for each dog breed, age group, and\nsize group.\n\nLater in this module, in [Evaluating for Bias](/machine-learning/crash-course/fairness/evaluating-for-bias), we'll\ntake a closer look at different methods for evaluating models by subgroup.\n| **Key terms:**\n|\n- [Bias (ethics/fairness)](/machine-learning/glossary#bias-ethicsfairness) \n[Help Center](https://support.google.com/machinelearningeducation)"]]