ความยุติธรรม: การลดอคติ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อระบุแหล่งที่มาของอคติในข้อมูลการฝึกแล้ว เราจะดำเนินการเชิงรุกเพื่อบรรเทาผลกระทบ มี 2 กลยุทธ์หลักที่แมชชีนเลิร์นนิง (ML)
ที่วิศวกรมักใช้เพื่อแก้ไขอคติ:
- กำลังเสริมข้อมูลการฝึก
- กำลังปรับฟังก์ชันการสูญหายของโมเดล
การเสริมข้อมูลการฝึก
หากการตรวจสอบข้อมูลการฝึกอบรมพบปัญหาเกี่ยวกับข้อมูลที่ขาดหายไป ไม่ถูกต้อง หรือบิดเบือน วิธีที่ตรงที่สุดในการแก้ปัญหามักเป็นการรวบรวมข้อมูลเพิ่มเติม
อย่างไรก็ตาม แม้ว่าการเพิ่มข้อมูลการฝึกอบรมจะเป็นวิธีที่เหมาะ แต่ข้อเสียของแนวทางนี้คืออาจไม่สามารถทำได้เนื่องจากไม่มีข้อมูลที่มีอยู่หรือข้อจำกัดด้านทรัพยากรที่ขัดขวางการเก็บรวบรวมข้อมูล เช่น การรวบรวมข้อมูลเพิ่มเติมอาจทําให้สิ้นเปลืองค่าใช้จ่ายหรือเวลามากเกินไป หรือทําไม่ได้เนื่องจากข้อจํากัดทางกฎหมาย/ความเป็นส่วนตัว
การปรับฟังก์ชันการเพิ่มประสิทธิภาพของโมเดล
ในกรณีที่การเก็บรวบรวมข้อมูลเพิ่มเติมสำหรับการฝึกโมเดลไม่สามารถทำได้ อีกวิธีหนึ่งในการลดอคติคือการปรับเปลี่ยนวิธีคำนวณการสูญเสียระหว่างการฝึกโมเดล โดยปกติแล้ว เราจะใช้ฟังก์ชันการเพิ่มประสิทธิภาพ เช่น
การสูญเสียเชิงลอจิสติก เพื่อลงโทษการคาดคะเนของโมเดลที่ไม่ถูกต้อง อย่างไรก็ตาม การสูญหายของบันทึกจะไม่รวมการเป็นสมาชิกกลุ่มย่อย
การพิจารณา ดังนั้น เราจึงเลือกฟังก์ชันการเพิ่มประสิทธิภาพที่ออกแบบมาเพื่อลงโทษข้อผิดพลาดในลักษณะที่คำนึงถึงความเป็นธรรม ซึ่งจะช่วยลดความไม่สมดุลที่เราพบในข้อมูลการฝึก
ไลบรารีการแก้ไขโมเดล TensorFlow มียูทิลิตีสําหรับการใช้เทคนิคการลดอคติ 2 เทคนิคที่แตกต่างกันในระหว่างการฝึกโมเดล ดังนี้
MinDiff:
MinDiff มีเป้าหมายเพื่อปรับสมดุลข้อผิดพลาดของข้อมูล 2 กลุ่มที่แตกต่างกัน (นักเรียนชาย/หญิงเทียบกับนักเรียนที่ไม่ใช่เพศชายหรือหญิง) ด้วยการเพิ่มค่าปรับสำหรับความแตกต่างของข้อมูลการแจกแจงความน่าจะเป็นของทั้ง 2 กลุ่ม
การจับคู่ Logit สมมติฐานเทียบกับความเป็นจริง:
การจับคู่ Logit สมมติฐานเทียบกับความเป็นจริง (CLP) มีจุดประสงค์เพื่อให้มั่นใจว่าการเปลี่ยนแปลงแอตทริบิวต์ที่มีความละเอียดอ่อนของตัวอย่างหนึ่งๆ จะไม่เปลี่ยนแปลงการคาดการณ์ของโมเดลสําหรับตัวอย่างนั้น เช่น หากชุดข้อมูลการฝึกมีตัวอย่าง 2 รายการ
ค่าฟีเจอร์เหมือนกัน แต่ค่าหนึ่งมีค่า gender
เป็น male
และ
อีกค่าหนึ่งมีค่า gender
เป็น nonbinary
CLP จะเพิ่มการลงโทษหาก
การคาดการณ์สำหรับ 2 ตัวอย่างนี้แตกต่างกัน
เทคนิคที่คุณเลือกสําหรับการปรับฟังก์ชันการเพิ่มประสิทธิภาพจะขึ้นอยู่กับกรณีการใช้งานของโมเดล ในส่วนถัดไป เราจะมาดูวิธีประเมินโมเดลอย่างละเอียดเพื่อดูความยุติธรรมโดยพิจารณาจากกรณีการใช้งานเหล่านี้
แบบฝึกหัด: ตรวจสอบความเข้าใจ
ข้อความใดต่อไปนี้เกี่ยวกับเทคนิคการลดอคติเป็นจริง
ทั้ง MinDiff และ CLP จะลงโทษความคลาดเคลื่อนในประสิทธิภาพของโมเดล
เกี่ยวข้องกับแอตทริบิวต์ที่มีความละเอียดอ่อน
เทคนิคทั้ง 2 ประเภทนี้มีจุดมุ่งหมายเพื่อลดอคติด้วยการลงโทษข้อผิดพลาดในการคาดการณ์ที่เกิดจากความไม่สมดุลของการแสดงแอตทริบิวต์ที่ละเอียดอ่อนในข้อมูลการฝึก
MinDiff ลงโทษความแตกต่างในการกระจายโดยรวมของ
การคาดการณ์สำหรับข้อมูลส่วนต่างๆ ในขณะที่ CLP จะลงโทษ
ความคลาดเคลื่อนในการคาดการณ์ของตัวอย่างแต่ละคู่
MinDiff จัดการกับอคติโดยการปรับการแจกแจงคะแนนสำหรับ 2 กลุ่ม
กลุ่มย่อย CLP จัดการอคติโดยการตรวจสอบว่าตัวอย่างแต่ละรายการได้รับการปฏิบัติอย่างเท่าเทียมกัน โดยไม่คำนึงถึงการเป็นสมาชิกของกลุ่มย่อย
การเพิ่มตัวอย่างลงในชุดข้อมูลการฝึกจะช่วยได้เสมอ
ลดอคติในการคาดการณ์ของโมเดล
การเพิ่มตัวอย่างการฝึกอบรมเป็นกลยุทธ์ที่มีประสิทธิภาพสำหรับ
การลดอคติ แต่องค์ประกอบของข้อมูลการฝึกใหม่
เป็นสิ่งสำคัญ หากตัวอย่างการฝึกอบรมเพิ่มเติมแสดง
ข้อมูลเดิมไม่เพียงพอ พวกเขาก็ไม่สามารถช่วยลด
อคติที่มีอยู่เดิม
หากกำลังลดอคติด้วยการเพิ่มข้อมูลการฝึกอบรม คุณไม่ควรใช้ MinDiff หรือ CLP ในระหว่างการฝึกอบรมด้วย
การเสริมข้อมูลการฝึกและการใช้เทคนิค เช่น MinDiff หรือ CLP
อาจเป็นส่วนเสริมได้ ตัวอย่างเช่น วิศวกร ML อาจสามารถ
ในการรวบรวมข้อมูลการฝึกเพิ่มเติม
ให้เพียงพอที่จะลดความคลาดเคลื่อน
ประสิทธิภาพได้ถึง 30% แล้วใช้ MinDiff เพื่อลด
ความคลาดเคลื่อนอีก 50%
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-11-10 UTC
[null,null,["อัปเดตล่าสุด 2024-11-10 UTC"],[[["\u003cp\u003eMachine learning engineers use two primary strategies to mitigate bias in models: augmenting training data and adjusting the model's loss function.\u003c/p\u003e\n"],["\u003cp\u003eAugmenting training data involves collecting additional data to address missing, incorrect, or skewed data, but it can be infeasible due to data availability or resource constraints.\u003c/p\u003e\n"],["\u003cp\u003eAdjusting the model's loss function involves using fairness-aware optimization functions like MinDiff or Counterfactual Logit Pairing to penalize errors based on sensitive attributes and counteract imbalances in training data.\u003c/p\u003e\n"],["\u003cp\u003eMinDiff aims to balance errors between different data slices by penalizing differences in prediction distributions, while Counterfactual Logit Pairing penalizes discrepancies in predictions for similar examples with different sensitive attribute values.\u003c/p\u003e\n"],["\u003cp\u003eChoosing the right bias-mitigation technique depends on the specific use case of the model, and augmenting training data and adjusting the loss function can be used in conjunction for optimal bias reduction.\u003c/p\u003e\n"]]],[],null,["# Fairness: Mitigating bias\n\nOnce a source of [**bias**](/machine-learning/glossary#bias-ethicsfairness)\nhas been identified in the training data, we can take proactive steps to\nmitigate its effects. There are two main strategies that machine learning (ML)\nengineers typically employ to remediate bias:\n\n- Augmenting the training data.\n- Adjusting the model's loss function.\n\nAugmenting the training data\n----------------------------\n\nIf an audit of the training data has uncovered issues with missing, incorrect,\nor skewed data, the most straightforward way to address the problem is often\nto collect additional data.\n\nHowever, while augmenting the training data can be ideal, the downside of\nthis approach is that it can also be infeasible, either due to a lack of\navailable data or resource constraints that impede data collection. For example,\ngathering more data might be too costly or time-consuming, or not viable due to\nlegal/privacy restrictions.\n\nAdjusting the model's optimization function\n-------------------------------------------\n\nIn cases where collecting additional training data is not viable, another\napproach for mitigating bias is to adjust how loss is calculated during model\ntraining. We typically use an optimization function like\n[**log loss**](/machine-learning/glossary#log-loss) to penalize incorrect model\npredictions. However, log loss does not take subgroup membership into\nconsideration. So instead of using log loss, we can choose an optimization\nfunction designed to penalize errors in a fairness-aware fashion that\ncounteracts the imbalances we've identified in our training data.\n\nThe TensorFlow Model Remediation Library provides utilities for applying two\ndifferent bias-mitigation techniques during model training:\n\n- [**MinDiff**](https://www.tensorflow.org/responsible_ai/model_remediation/min_diff/guide/mindiff_overview):\n MinDiff aims to balance the errors for two different slices of data\n (male/female students versus nonbinary students) by adding a penalty for\n differences in the prediction distributions for the two groups.\n\n- [**Counterfactual Logit Pairing**](https://www.tensorflow.org/responsible_ai/model_remediation/counterfactual/guide/counterfactual_overview):\n Counterfactual Logit Pairing (CLP) aims to ensure that changing a sensitive\n attribute of a given example doesn't alter the model's prediction for that\n example. For example, if a training dataset contains two examples whose\n feature values are identical, except one has a `gender` value of `male` and\n the other has a `gender` value of `nonbinary`, CLP will add a penalty if\n the predictions for these two examples are different.\n\nThe techniques you choose for adjusting the optimization function are\ndependent on the use cases for the model. In the next section, we'll take a\ncloser look at how to approach the task of evaluating a model for fairness\nby considering these use cases.\n\n### Exercise: Check your understanding\n\nWhich of the following statements regarding bias-mitigation techniques are true? \nBoth MinDiff and CLP penalize discrepancies in model performance tied to sensitive attributes \nBoth techniques aim to mitigate bias by penalizing prediction errors resulting from imbalances in how sensitive attributes are represented in training data. \nMinDiff penalizes differences in the overall distribution of predictions for different slices of data, whereas CLP penalizes discrepancies in predictions for individual pairs of examples. \nMinDiff addresses bias by aligning score distributions for two subgroups. CLP tackles bias by ensuring that individual examples are not treated differently solely because of their subgroup membership. \nAdding more examples to the training dataset will always help counteract bias in a model's predictions. \nAdding more training examples is an effective strategy for mitigating bias, but the composition of the new training data matters. If the additional training examples exhibit similar imbalances to the original data, they probably won't help mitigate the existing bias. \nIf you are mitigating bias by adding more training data, you shouldn't also apply MinDiff or CLP during training. \nAugmenting training data and applying techniques like MinDiff or CLP can be complementary. For example, an ML engineer might be able to collect enough additional training data to reduce a discrepancy in performance by 30%, and then use MinDiff to further reduce the discrepancy by another 50%.\n| **Key terms:**\n|\n| - [Bias (ethics/fairness)](/machine-learning/glossary#bias-ethicsfairness)\n- [Log Loss](/machine-learning/glossary#log-loss) \n[Help Center](https://support.google.com/machinelearningeducation)"]]