공정성: 편향 완화
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
학습 데이터에서 편향의 원인을 파악한 후에는 사전에 조치를 취하여 그 영향을 완화할 수 있습니다. 편향을 완화하기 위해 머신러닝 (ML) 엔지니어가
일반적으로 사용하는 두 가지 주요 전략은 다음과 같습니다
- 학습 데이터 증강
- 모델의 손실 함수를 조정합니다.
학습 데이터 증강
학습 데이터 감사에서 누락되거나 잘못되었거나 왜곡된 데이터 문제가 발견된 경우 문제를 해결하는 가장 직접적인 방법은 추가 데이터를 수집하는 것입니다.
하지만 학습 데이터를 보강하는 것이 이상적일 수 있지만, 사용 가능한 데이터가 부족하거나 데이터 수집을 방해하는 리소스 제약으로 인해 불가능할 수도 있다는 단점이 있습니다. 예를 들어 더 많은 데이터를 수집하는 데 너무 많은 비용이나 시간이 들거나 법적/개인 정보 보호 제한으로 인해 실행할 수 없는 경우도 있습니다.
모델의 최적화 함수 조정
추가 학습 데이터를 수집할 수 없는 경우 편향을 완화하는 또 다른 방법은 모델 학습 중에 손실이 계산되는 방식을 조정하는 것입니다. 일반적으로 잘못된 모델 예측에 페널티를 주기 위해 로그 손실과 같은 최적화 함수를 사용합니다. 하지만 로그 손실은 하위 그룹 멤버십을 고려하지 않습니다. 따라서 로그 손실을 사용하는 대신 학습 데이터에서 확인한 불균형을 상쇄하는 공정성을 고려한 방식으로 오류를 불이익을 주도록 설계된 최적화 함수를 선택할 수 있습니다.
TensorFlow 모델 수정 라이브러리는 모델 학습 중에 두 가지 편향 완화 기법을 적용하기 위한 유틸리티를 제공합니다.
MinDiff:
MinDiff는 두 그룹의 예측 분포 차이에 대한 페널티를 추가하여 두 가지 데이터 슬라이스(남성/여성 학생과 비이성애 학생)의 오류 균형을 맞추는 것을 목표로 합니다.
반사실적 로지트 페어링: 반사실적 로지트 페어링 (CLP)은 특정 예시의 민감한 속성을 변경해도 해당 예시의 모델 예측이 변경되지 않도록 하는 것을 목표로 합니다. 예를 들어 학습 데이터 세트에 특성 값이 동일한 2개의 예가 있지만, 한 개의 gender
값이 male
이고 다른 한 개의 gender
값이 nonbinary
인 경우, 이 두 예의 예측이 서로 다르면 CLP에서 페널티를 추가합니다.
최적화 함수를 조정하는 데 선택하는 기법은 모델의 사용 사례에 따라 다릅니다. 다음 섹션에서는 이러한 사용 사례를 고려하여 모델의 공정성을 평가하는 작업에 접근하는 방법을 자세히 살펴봅니다.
연습문제: 학습 내용 점검하기
편향 완화 기법에 관한 다음 설명 중 참인 것은 무엇인가요?
MinDiff와 CLP는 모두 민감한 속성과 연결된 모델 실적의 불일치를 처벌합니다.
두 기술 모두 민감한 속성이 학습 데이터에 표현되는 방식의 불균형으로 인한 예측 오류에 불이익을 주어 편향을 완화하는 것을 목표로 합니다.
MinDiff는 데이터의 여러 슬라이스에 대한 예측의 전체 분포 차이에 페널티를 적용하는 반면, CLP는 개별 예시 쌍의 예측 불일치에 페널티를 적용합니다.
MinDiff는 두 하위 그룹의 점수 분포를 정렬하여 편향을 해결합니다. CLP는 하위 그룹 구성원 자격으로 개별 예가 다르게 취급되지 않도록 하여 편향을 해결합니다.
학습 데이터 세트에 예시를 더 추가하면 항상 모델 예측의 편향을 상쇄하는 데 도움이 됩니다.
학습 예시를 더 추가하는 것은 편향을 완화하는 효과적인 전략이지만 새 학습 데이터의 구성이 중요합니다. 추가 학습 예시가 원본 데이터와 비슷한 불균형을 나타낸다면 기존 편향을 완화하는 데 도움이 되지 않을 수 있습니다.
학습 데이터를 더 추가하여 편향을 완화하는 경우 학습 중에 MinDiff 또는 CLP를 적용해서는 안 됩니다.
학습 데이터를 보강하고 MinDiff 또는 CLP와 같은 기법을 적용하는 것은 상호 보완적일 수 있습니다. 예를 들어 ML 엔지니어가 성능 불일치를 30% 줄이기 위해 충분한 양의 추가 학습 데이터를 수집한 다음 MinDiff를 사용하여 불일치를 50% 더 줄일 수 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 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)"]]