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.
 
 
 
motief/thoughts/ledgers/CONTINUITY_svd_axis_consist...

56 lines
2.5 KiB

# Session: svd_axis_consistency_fix
Updated: 2026-04-13T23:08:19Z
## Goal
Ensure SVD components tab and compass show consistent party positions by using aligned PCA positions for components 1-2.
## Constraints
- Right-wing parties (PVV, FVD, JA21, SGP) must appear on RIGHT side of all axes in both visualizations
- SVD labels should reflect voting patterns, not semantic content
- Components 1-2 use aligned PCA; Components 3-10 use raw SVD values
## Progress
### Done
- [x] Fix SVD axis label alignment (removed static left_pole/right_pole, derive from runtime flip)
- [x] Fix score mismatch in tijdtraject view (components 3-10 use per-window scores, not Procrustes-aligned)
- [x] Fix PCA alignment consistency between compass and SVD components tab
- [x] Update all 10 component labels based on motion analysis
- [x] Add pool-based motion assignment (10 motions per component)
- [x] Add SVD axis alignment and label consistency tests
### In Progress
- (none)
### Blocked
- (none)
## Key Decisions
- **Components 1-2 use aligned PCA positions**: Consistent with compass visualization, derived from `load_positions()`
- **Components 3-10 use raw SVD scores**: Per-window flip handles orientation, Procrustes not needed
- **New helper `_get_aligned_party_coords()`**: Converts aligned MP positions to party centroids for components 1-2
## Next Steps
1. Run visual verification to confirm compass and SVD tab show consistent party orderings
2. Consider adding tests for the new `_get_aligned_party_coords()` helper
3. Update any documentation that references the old behavior
## File Operations
### Read
- `explorer.py` (components tab, load_positions, trajectory rendering)
- `analysis/political_axis.py` (PCA alignment, compute_party_centroids)
- `analysis/config.py` (SVD_THEMES)
- `analysis/svd_labels.py` (label derivation)
### Modified
- `explorer.py` - Added `_get_aligned_party_coords()`, updated component 1-2 to use aligned positions
## Critical Context
- **Commit 823df6f**: Removed static left_pole/right_pole, fixed tijdtraject score mismatch
- **Commit 12936c5**: Use aligned PCA for components 1-2 (consistent with compass)
- **Commit 036c3f9**: Extended aligned PCA to all SVD components 1-10
- **Commit 3a67100**: Use aligned PCA scores for time trajectory view
- **Related docs**: `docs/solutions/ui-bugs/svd-axis-pole-labels-incorrect-after-flip.md`
## Working Set
- Branch: `main`
- Key files: `explorer.py`, `analysis/config.py`, `analysis/svd_labels.py`, `tests/test_svd_axis_alignment.py`