You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
| session | updated |
|---|---|
| ses_2b4f | 2026-04-01T21:57:48.280Z |
Session Summary
Goal
Analyze how the SVD Components tab in explorer.py computes party positions, focusing on: data loading flow, window_size default, X/Y coordinate computation, and whether positions are individual MPs or party centroids.
Constraints & Preferences
- Provide exact file:line references for all code paths
- Trace data flow through multiple files and functions
- Answer 4 specific questions about the SVD Components tab implementation
Progress
Done
- Analyzed
build_svd_components_tab()atexplorer.py:2449-2867 - Traced
load_positions()atexplorer.py:603-656— default window_size is "quarterly" - Traced
load_party_axis_scores()atexplorer.py:836-853 - Traced
_load_mp_vectors_by_party()atexplorer.py:778-832 - Analyzed
compute_2d_axes()atanalysis/political_axis.py:131-476 - Analyzed
compute_party_bootstrap_cis()atanalysis/political_axis.py:624-695 - Analyzed
compute_party_centroids()atexplorer_helpers.py:246-317 - Documented complete data flow with file:line references
In Progress
- (none — analysis complete)
Blocked
- (none)
Key Decisions
- Window size: The SVD Components tab uses
"quarterly"as the default window_size (viaload_positions()at line 604) - Position type for components 1-2: Party centroids computed as mean(x), mean(y) from individual MP PCA projections (line 2747)
- Position type for components 3-10: Mean SVD vector per party, with component value extracted by index
- Data source:
svd_vectorstable filtered byentity_type='mp'andwindow_id='current_parliament'
Next Steps
- (No pending work — analysis was completed)
Critical Context
- For components 1 and 2: Party positions come from
load_positions()which performs PCA on Procrustes-aligned MP SVD vectors, then computes party centroids by averaging x/y coordinates of all MPs in that party - For components 3-10: Party positions come from
load_party_axis_scores()which computes mean SVD vector per party fromwindow='current_parliament' - Bootstrap CIs: Computed via
_cached_bootstrap_cis()atexplorer.py:873-880usingcompute_party_bootstrap_cis()fromanalysis/political_axis.py - MP→Party mapping: Via
mp_metadatatable, normalized using_PARTY_NORMALIZEdict atexplorer.py:471-480
File Operations
Read
/home/sgeboers/Projects/stemwijzer/explorer.py(full file: lines 1-3094)/home/sgeboers/Projects/stemwijzer/analysis/political_axis.py(full file: lines 1-695)/home/sgeboers/Projects/stemwijzer/explorer_helpers.py(full file: lines 1-317)
Modified
- (none)