Which of the following best describes representation bias in natural language processing?
Think about how the data itself might not fairly represent all groups or topics.
Representation bias happens when the training data does not fairly represent all groups or topics, leading the model to learn skewed patterns.
In a binary classification NLP task, which metric best captures equality of opportunity between two demographic groups?
Equality of opportunity focuses on equal chances to correctly identify positive cases.
Equality of opportunity requires that the true positive rates are similar across groups, ensuring fair positive predictions.
What is the output of the following Python code that applies simple bias mitigation by equalizing sample counts?
from collections import Counter data = [('male', 'positive'), ('female', 'positive'), ('male', 'negative'), ('male', 'positive'), ('female', 'negative')] # Count samples per gender counts = Counter([d[0] for d in data]) min_count = min(counts.values()) # Equalize samples by truncating balanced_data = [] counts_seen = {'male': 0, 'female': 0} for d in data: gender = d[0] if counts_seen[gender] < min_count: balanced_data.append(d) counts_seen[gender] += 1 print(balanced_data)
Check how many samples each gender has and how many are kept after truncation.
The code truncates each gender's samples to the minimum count (2). It keeps the first 2 samples for 'male' and 'female' respectively.
Which model architecture is best suited to reduce gender bias in a sentiment analysis task on social media text?
Consider architectures that explicitly try to remove bias signals.
Adversarial training with transformers can help remove gender information from learned representations, reducing bias.
Given this code snippet to compute demographic parity difference, what error or issue will it cause?
def demographic_parity_difference(preds, groups): # preds: list of 0/1 predictions # groups: list of group labels (e.g., 'A', 'B') group_pos_rates = {} for g in set(groups): group_preds = [p for p, grp in zip(preds, groups) if grp == g] group_pos_rates[g] = sum(group_preds) / len(group_preds) return abs(group_pos_rates['A'] - group_pos_rates['B']) # Example usage preds = [1, 0, 1, 1, 0] groups = ['A', 'A', 'B', 'B', 'B'] print(demographic_parity_difference(preds, groups))
Check the inputs and how the function handles group labels.
The function calculates positive rates for groups 'A' and 'B' correctly and returns their absolute difference without error.