Skip to content

Feature/identity asymmetry survey#96

Merged
Lioo7 merged 5 commits intomasterfrom
feature/identity-asymmetry-survey
Jan 28, 2026
Merged

Feature/identity asymmetry survey#96
Lioo7 merged 5 commits intomasterfrom
feature/identity-asymmetry-survey

Conversation

@Lioo7
Copy link
Copy Markdown
Collaborator

@Lioo7 Lioo7 commented Jan 28, 2026

Implement Identity Asymmetry Stress Test Strategy

Overview

This PR introduces the Identity Asymmetry Strategy, a new experimental survey condition designed to isolate "Project Identity Bias" from "Magnitude Bias." It allows researchers to determine if users favor specific budget categories (e.g., Health) over others (e.g., Education) when the mathematical utility of the allocations is identical.

Core Implementation

  1. IdentityAsymmetryStrategy:
    • Identifies the largest pair of equal values in a user's ideal budget.
    • Generates a deterministic $n$-step stress test (default $n=10$) by shifting funds between the identified subjects.
    • Mathematical Integrity: To ensure the budget sum always remains exactly 100, the algorithm rounds the magnitude of the shift to the nearest integer before applying it to the vectors.
  2. Dynamic Suitability Rules:
    • Added the min_equal_value_pair rule.
    • The system now validates that a user’s ideal budget contains a pair of identical values large enough to support the requested number of stress-test steps.

Analysis & Visualization

  • Identity Consistency Score: Implemented a new metric in the Analysis Engine that calculates the strength of a user's bias (Max Wins / Total Questions).
  • Aggregate Heatmap: The survey response dashboard now features a bucketed distribution table (50%–100%) to visualize bias intensity across the entire participant pool.
  • The "Pain Curve": Individual user reports now include a visualization tracking the user’s choice at every magnitude step, identifying the "breaking point" where numerical loss finally overrides identity bias.

Testing

  • Created tests/services/pair_generation/test_identity_asymmetry_strategy.py.
  • Verified rounding logic, sum constraints, and metadata persistence.

Production Setup

To activate this survey in production, run the following SQL command:

INSERT IGNORE INTO surveys (story_code, active, suitability_rules, pair_generation_config)
VALUES (
    {story_code}, 
    True,
    '{"min_equal_value_pair": 10}', 
    '{"strategy": "identity_asymmetry", "params": {"num_pairs": 10}}'
);

Lioo7 added 5 commits January 28, 2026 15:50
- Added IdentityAsymmetryStrategy to isolate project identity bias from magnitude.
- Implemented deterministic 10-step magnitude shift algorithm with integer rounding.
- Added suitability rules for equal-value pair detection (min_val >= 10).
- Created Analysis Engine for Identity Consistency and 'Pain Curve' mapping.
- Added HTML visualizations: Aggregate Bias Heatmap and User-specific Pain Curve.
- Added comprehensive test suite for the new strategy.
- Replaced single 'Average Consistency' row with a bucketed distribution table (50-100%) for clearer bias analysis.
- Updated breakdown table to hide 'Preferred Subject' when consistency is <= 50% (indifferent), preventing misleading data interpretation.
- Fixed logic to hide 'Dominant Preference' subject name when user consistency is <= 50% (Indifferent).
- Removed redundant generic 'Survey Summary' table for Identity Asymmetry strategy to avoid data duplication.
@Lioo7 Lioo7 merged commit 24f9da2 into master Jan 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant