Quiz 2

Ethics & Bias in Social Media

1892 words
9 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Ethics & Bias in Social Media ## 🎯 Learning Objectives - Identify sources of bias in social media data and algorithms - Apply fairness metrics to evaluate algorithmic systems - Understand IRB requirements for social media research - Evaluate ethical dilemmas in platform design - Develop responsible data practices...

Ethics & Bias in Social Media

🎯 Learning Objectives

  • Identify sources of bias in social media data and algorithms
  • Apply fairness metrics to evaluate algorithmic systems
  • Understand IRB requirements for social media research
  • Evaluate ethical dilemmas in platform design
  • Develop responsible data practices for social media research

1. Algorithmic Bias

1.1 Intuition

Bias in algorithms isn't about the code being prejudiced — it's about the data and design choices reflecting existing societal biases. Think of it like a hiring manager: even with good intentions, if they only interview candidates from their own network, they'll miss diverse talent. Algorithms similarly reflect the biases in their training data, design decisions, and deployment context.

1.2 Sources of Bias

(Diagram)
Bias TypeDescriptionSocial Media Example
Historical biasExisting societal biases in dataImage search: "CEO" shows mostly men
Representation biasSome groups underrepresentedSpeech recognition works worse for non-native speakers
Measurement biasPoor proxy for target conceptLikes as proxy for "quality" — rewards clickbait
Amplification biasAlgorithm magnifies differencesRecommendation engine promotes extreme content
Feedback loopSystem output affects future inputContent moderation flags certain speech → less of it → flag it more

1.3 Worked Example: Gender Bias in Word Embeddings

python
import gensim.downloader as api
glove = api.load("glove-twitter-25")
# Test gender bias
pairs = [
    ("doctor", "nurse"),
    ("computer", "cooking"),
    ("engineer", "teacher"),
    ("programmer", "homemaker"),
]
for male_job, female_job in pairs:
    # Measure stereotypical association
    similarity_m = glove.similarity(male_job, "man")
    similarity_f = glove.similarity(male_job, "woman")
    diff = similarity_m - similarity_f
    print(f"{male_job}: man={similarity_m:.3f}, woman={similarity_f:.3f}, bias={diff:.3f}")
Output:
pseudo
doctor: man=0.412, woman=0.315, bias=0.097
computer: man=0.352, woman=0.283, bias=0.069
engineer: man=0.401, woman=0.298, bias=0.103
programmer: man=0.387, woman=0.271, bias=0.116
All male-associated jobs show higher similarity to "man" than "woman" — a clear gender bias learned from social media text.

2. Fairness Metrics

2.1 Defining Fairness

Fairness can be defined in multiple ways — and they often conflict mathematically.
Fairness DefinitionMeaningSocial Media Application
Demographic parityEqual selection rates across groupsContent promotion equally across demographics
Equal opportunityEqual true positive rates across groupsHate speech detection catches equally across groups
Equalized oddsEqual TPR and FPR across groupsModeration decisions equally accurate
Individual fairnessSimilar individuals treated similarlySimilar content gets similar treatment

2.2 The Impossibility Theorem

Theorem: Unless base rates are identical across groups, you cannot simultaneously satisfy demographic parity and equal opportunity.
python
def demonstrate_fairness_impossibility():
    """
    Show that demographic parity and equal opportunity conflict
    when base rates differ.
    """
    # Group A: 10% hate speech, Group B: 1% hate speech
    groups = {
        'A': {'total': 1000, 'hate_speech': 100},  # 10%
        'B': {'total': 1000, 'hate_speech': 10},     # 1%
    }
    # Model that catches 80% of hate speech in both groups
    tp_rate = 0.8
    fp_rate = 0.05
    for group, data in groups.items():
        tp = int(data['hate_speech'] * tp_rate)
        fp = int((data['total'] - data['hate_speech']) * fp_rate)
        total_flagged = tp + fp
        print(f"Group {group}:")
        print(f"  Total flagged: {total_flagged} ({total_flagged/data['total']*100:.1f}%)")
        print(f"  TP: {tp}, FP: {fp}")
Output:
pseudo
Group A: Total flagged: 125 (12.5%), TP: 80, FP: 45
Group B: Total flagged: 57 (5.7%), TP: 8, FP: 49
Group A has 12.5% flagged, Group B has 5.7% — violates demographic parity. But making them equal would require different thresholds, reducing accuracy for one group.

2.3 Bias Mitigation Strategies

StageApproachExample
Pre-processingDebias training dataBalance dataset demographics
In-processingAdd fairness constraintsRegularization for equal opportunity
Post-processingAdjust model outputsCalibrate thresholds per group

3. Research Ethics

3.1 Historical Ethical Failures

StudyWhat HappenedEthical Violation
Facebook Emotional Contagion (2014)Manipulated 700K users' news feeds to study emotional spreadNo informed consent, no IRB
OKCupid Data Release (2016)Researchers published 70K user profiles with sensitive dataNo anonymization, no consent
Tastes, Ties, and Time (2009)Used Facebook data from one university, published identifiable dataRe-identification possible

3.2 IRB Framework

When do you need IRB approval? (Diagram)

3.3 Key Ethical Principles

PrincipleMeaningApplication in Social Media Research
Respect for personsTreat participants as autonomous agentsGet consent, respect privacy settings
BeneficenceMaximize benefits, minimize harmConsider potential misuse of findings
JusticeFair distribution of benefits/burdensDon't exploit vulnerable populations
TransparencyOpen about methods and intentionsDisclose data collection methods

4. Platform Ethics

4.1 Content Moderation Dilemmas

(Diagram)
ApproachProsCons
Remove harmful contentClear signal, protects usersCensorship risk, inconsistent application
Label disputed contentPreserves speech, adds contextLabel fatigue, may backfire
Demote in algorithmReduces reach without removingOpaque, hard to appeal
Rate limit sharingSlows viral spreadMay affect legitimate content

4.2 The Filter Bubble

Algorithms that personalize content can trap users in filter bubbles — information ecosystems that reinforce existing beliefs and exclude opposing views. Mechanism:
  1. User clicks on content A
  2. Algorithm learns user likes content A
  3. Algorithm shows more content similar to A
  4. User never sees content B (opposing views)
  5. User's beliefs become more extreme

5. Common Pitfalls

Pitfall 1: Assuming "Public" Data Means "No Ethics Required"

The mistake: Thinking that data available through public APIs is ethically free to use. Why students make it: Public APIs imply consent — the platform allows access. How to catch it: Public ≠ consented. Users may not expect their tweets to be used for research, even if technically public. Correct approach: Consider: Would users be surprised? Would they object? Anonymize aggressively. Get IRB guidance. Follow platform terms.

Pitfall 2: Confusing Statistical Parity with Fairness

The mistake: Aiming for equal outcomes across groups without considering base rates. Why students make it: Equality sounds fair, and demographic parity is easy to measure. How to catch it: Different groups have different base rates (e.g., different rates of hate speech). Forcing equal flagging rates means either over-flagging or under-flagging one group. Correct approach: Consider multiple fairness definitions. Engage domain experts. Measure both errors (false positives and false negatives) per group. Accept that perfect fairness across all definitions is mathematically impossible.

Pitfall 3: Ignoring Feedback Loops

The mistake: Evaluating an algorithm in isolation without considering how deployment changes future data. Why students make it: Static evaluation is standard ML practice. How to catch it: A content moderation system that removes certain speech → less of that speech in training data → system becomes more aggressive in removing it (feedback loop). The system changes the distribution it's trying to learn. Correct approach: Simulate deployment dynamics. Monitor distribution shifts. Periodically retrain with fresh data. Use bandit algorithms that explore as well as exploit.

6. Key Concepts Reference

ConceptDefinitionWhy It Matters
Algorithmic biasSystematic and unfair discrimination by algorithmsCauses real-world harm
Demographic parityEqual outcomes across groupsIntuitive but conflicts with accuracy
Equal opportunityEqual true positive ratesFocuses on fairness of correct predictions
IRBInstitutional Review Board for research ethicsLegal requirement for human subjects
Filter bubbleAlgorithmic isolation from opposing viewsPolarizes society
Feedback loopSystem output affects future inputCauses runaway bias
Representation biasSome groups underrepresented in dataSystem performs poorly for minorities

7. 📝 Practice Questions

Q1: A hate speech detection model has 90% accuracy overall but 60% accuracy for African American English (AAE) tweets. What type of bias is this?
Answer: This is representation bias combined with measurement bias. AAE is underrepresented in training data (representation bias), and the features used to detect hate speech may misclassify legitimate AAE expressions as hate speech (measurement bias). The model's high overall accuracy masks this disparity — a classic case where aggregate metrics hide per-group failures. Q2: Why is it mathematically impossible to satisfy both demographic parity and equal opportunity when base rates differ?
Answer: Demographic parity requires equal prediction rates (P(Ŷ=1|A) = P(Ŷ=1|B)). Equal opportunity requires equal true positive rates (P(Ŷ=1|Y=1,A) = P(Ŷ=1|Y=1,B)). If base rates differ (P(Y=1|A) ≠ P(Y=1|B)), satisfying both creates a contradiction: the prediction rate depends on both the true positive rate and the base rate. You can match one but not both simultaneously unless base rates are identical. Q3: You scrape 10,000 public tweets about a sensitive health topic. What ethical obligations do you have?
Answer: (1) Check platform terms of service — does scraping violate them? (2) Anonymize user handles and any identifiable information before analysis. (3) Do not quote individual tweets in a way that identifies users. (4) Consider whether users would expect their tweets to be used for this purpose. (5) Store data securely with access controls. (6) Consult IRB — some institutions consider this human subjects research. (7) Consider potential harm if findings could stigmatize the health condition. Q4: Explain the Facebook Emotional Contagion study and its ethical problems.
Answer: Facebook manipulated the news feeds of 689,003 users to show either more positive or more negative content, measuring whether this affected users' own posting sentiment. Ethical problems: (1) No informed consent — users didn't know they were in an experiment. (2) No IRB approval — Facebook's internal review was insufficient. (3) Potential harm — manipulating users' emotions could cause psychological distress. (4) Deception — users were misled about why they saw certain content. The study was published in PNAS and sparked major debate about research ethics in social media. Q5: What is a filter bubble and how does algorithmic amplification contribute to it?
Answer: A filter bubble is a state of intellectual isolation resulting from algorithmic personalization. The algorithm shows users content they're likely to engage with (based on past behavior). If a user clicks political content from one perspective, the algorithm learns to show more of that perspective and less from opposing views. Over time, the user sees an increasingly narrow range of content, which can polarize their beliefs. The algorithm optimizes for engagement, not information diversity, so it naturally creates filter bubbles. Q6: A recommendation system suggests extreme content because it increases engagement. How would you fix this?
Answer: (1) Change the optimization metric — instead of pure engagement, use a weighted metric that penalizes content beyond a certain extremeness threshold. (2) Add diversity constraints — ensure recommendations include diverse perspectives. (3) Implement content scoring — give lower scores to content flagged as potentially problematic. (4) Audit regularly — check that recommendations don't push users toward extreme content. (5) Give users control — allow them to adjust their recommendation preferences. The key insight is that engagement-optimized systems naturally find extreme content (which is highly engaging) — you must explicitly counter this. Q7: Your model for content recommendation has different accuracy for different demographic groups. List three approaches to mitigate this.
Answer: (1) Pre-processing: Collect more representative training data from underrepresented groups. Augment the minority group data. (2) In-processing: Add fairness constraints to the loss function (e.g., penalize differences in error rates across groups). Use adversarial debiasing where a secondary model tries to predict the protected attribute from the predictions. (3) Post-processing: Calibrate thresholds per group so that error rates are balanced. Adjust predictions using techniques like equalized odds post-processing. Q8: What's the difference between "fairness through unawareness" and "fairness through awareness"?
Answer: "Fairness through unawareness" removes protected attributes (race, gender) from the model input, assuming that if the model doesn't see these attributes, it can't discriminate. This fails because other features (zip code, name, interests) can proxy for protected attributes. "Fairness through awareness" explicitly measures and addresses disparities, using techniques like demographic parity or equal opportunity constraints. Awareness is more effective because it acknowledges that bias exists even without explicit protected attributes.

8. 🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.