הוגנות: זיהוי הטיה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כשאתם מכינים את הנתונים לאימון ולבדיקה של המודל, חשוב לשים לב לבעיות של הוגנות ולבדוק אם יש מקורות פוטנציאליים של הטיה, כדי שתוכלו לצמצם באופן יזום את ההשפעות שלהן לפני שתפעילו את המודל בסביבת הייצור.
איפה יכולות להיות הטיות? ריכזנו כאן כמה נורות אדומות שכדאי לחפש במערך הנתונים.
ערכים חסרים של מאפיינים
אם במערך הנתונים יש מאפיין אחד או יותר שחסרים להם ערכים במספר גדול של דוגמאות, יכול להיות שזה סימן לכך שמאפיינים מרכזיים מסוימים של מערך הנתונים לא מיוצגים מספיק.
תרגיל: בדקו את ההבנה שלכם
אתם מאומנים מודל לחיזוי התאמת כלבים מאומצים לצורכי אימוץ על סמך מגוון מאפיינים, כולל גזע, גיל, משקל, מזג וכמות הפרווה שנושרת מדי יום. המטרה היא לוודא שהמודל מניב ביצועים טובים באותה מידה בכל סוגי הכלבים, ללא קשר למאפיינים הפיזיים או ההתנהגותיים שלהם
אתם מגלים של-1,500 מתוך 5,000 הדוגמאות בקבוצת האימון חסרים ערכים של מזג. אילו מהגורמים הבאים הם מקורות פוטנציאליים של הטיה שצריך לבדוק?
סביר יותר שנתוני המזג יהיו חסרים לגבי גזעים מסוימים של כלבים.
אם הזמינות של נתוני המזג תלויה בגזע הכלב, יכול להיות שהחיזויים לגבי התאמה לאימוץ של גזעי כלבים מסוימים יהיו פחות מדויקים.
סביר יותר שנתוני המזג יהיו חסרים לגבי כלבים מתחת לגיל 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 |
שלווה |
בינונית |
הכלב המבוגר ביותר שגילו אומת על ידי ספר השיאים של גינס היה Bluey, כלב מסוג אוסטרלי קנאי שחי עד גיל 29 שנים ו-5 חודשים. בהתחשב בעובדה, נראה שהלברדור רטריבר הוא למעשה בן 35, ויש סבירות גבוהה יותר שגילו של הכלב חושב או תועד באופן לא מדויק (אולי הוא בעצם בן 3.5). השגיאה הזו יכולה להעיד גם על בעיות דיוק רחבות יותר בנתוני הגיל במערך הנתונים שמצריכות בדיקה נוספת.
הטיה בנתונים
כל סוג של הטיה בנתונים, שבו קבוצות או מאפיינים מסוימים מיוצגים בצורה לא פרופורציונלית בהשוואה לשכיחות שלהם בעולם האמיתי, עלול להטות את המודל.
כשבודקים את ביצועי המודל, חשוב לא רק לבחון את התוצאות באופן מצטבר, אלא גם לפלח את התוצאות לפי קבוצות משנה. לדוגמה, במקרה של המודל שלנו לאימוץ כלבי הצלה, כדי לשמור על הוגנות, זה לא מספיק רק לבדוק את הדיוק הכולל. אנחנו צריכים גם לבדוק את הביצועים לפי תת-קבוצות, כדי לוודא שהמודל מניב ביצועים דומים לכל גזע של כלבים, קבוצת גיל וקבוצת גדלים.
בהמשך המודול, בקטע בדיקת מודל לזיהוי הטיה, נבחן לעומק שיטות שונות לבדיקת מודלים לפי קבוצות משנה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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)"]]