From fbfa1d1b00f8dbad98bfc346dc3bc6a24ab703a8 Mon Sep 17 00:00:00 2001 From: Julien Cornebise Date: Mon, 30 Mar 2026 20:56:20 +0100 Subject: [PATCH] Fix K-means k divergence: preserve vote-encounter row order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Fix K-means k divergence between Python and Clojure by preserving vote-encounter order for participant rows in the rating matrix - Python was using `natsorted()` (PID-numeric order) while Clojure's NamedMatrix preserves insertion order — different row ordering cascades into different first-k-distinct initialization seeds for group-level k-means - On vw: Python picked k=4 (wrong), Clojure picks k=2 — now both pick k=2 with identical cluster memberships ## Investigation findings The divergence chain: rating_mat row order → PCA projection order → base-cluster ID assignment → group k-means first-k-distinct init → different local optima → different silhouette landscape → different k. PCA components are identical (cosine similarity = 1.0), silhouette implementation matches, k-means algorithm matches — only the data ORDER feeding first-k-distinct differed. ## Changes - `conversation.py`: `update_votes()` preserves vote-encounter order for participant rows instead of `natsorted()` - `conversation.py`: `_apply_moderation()` preserves row order with list comprehension - Column (comment ID) ordering remains `natsorted` — doesn't affect clustering - Re-recorded vw cold-start blob and golden snapshots - Updated ordering tests, removed `test_group_clustering` xfail - Added `scripts/investigate_k_divergence.py` diagnostic tool ## Cold-start blob results | Dataset | Clj k | Py k | Match | |---------|-------|------|-------| | vw | 2 | 2 | exact (sizes [50,17]) | | biodiversity | 2 | 2 | exact (sizes [81,19]) | | bg2018 | 2 | 2 | close ([51,49] vs [52,48]) | | FLI | 2 | 3 | inherent PCA divergence (94.5% NaN, sil gap 0.001) | ## Test plan - [x] All 297 tests pass (0 failures, 58 xfailed) - [x] vw cold-start: k=2 exact match with Clojure blob - [x] biodiversity cold-start: k=2 exact match - [x] Ordering tests updated to expect encounter order - [ ] Re-record private dataset golden snapshots after stack rebase 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Squashed commits - Fix K-means k divergence: preserve vote-encounter order for participant rows - Update plan and journal: K-divergence investigation resolved - Remove investigation script (one-off diagnostic, not production code) - Rename k-divergence doc: investigation record, not a handoff - Update references to renamed investigation doc commit-id:4598a0a1 --- delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md | 71 +- delphi/docs/INVESTIGATION_K_DIVERGENCE.md | 118 ++ delphi/docs/PLAN_DISCREPANCY_FIXES.md | 45 +- delphi/polismath/conversation/conversation.py | 36 +- ...hffkxbd7ifmfbdrd_math_blob_cold_start.json | 1688 +++++++++-------- delphi/tests/test_conversation.py | 72 +- .../tests/test_legacy_clojure_regression.py | 7 +- 7 files changed, 1187 insertions(+), 850 deletions(-) create mode 100644 delphi/docs/INVESTIGATION_K_DIVERGENCE.md diff --git a/delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md b/delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md index 7a5e84d74b..1eb7e69974 100644 --- a/delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md +++ b/delphi/docs/CLJ-PARITY-FIXES-JOURNAL.md @@ -620,7 +620,7 @@ Every fix PR must now include blob comparison tests. Both use silhouette. The divergence comes from upstream PCA/clustering differences (sklearn SVD vs Clojure power iteration). This is independent of all repness fixes (D4-D11). Investigation planned off D15 branch. See -`delphi/docs/HANDOFF_K_DIVERGENCE_INVESTIGATION.md`. +`delphi/docs/INVESTIGATION_K_DIVERGENCE.md`. **Key discovery: `n-trials` in Clojure blob = `S` (total seen, including passes),** not `A+D` (agrees + disagrees). Verified: `prop_test(11, 14)` = blob `p-test` for @@ -661,6 +661,75 @@ adding vectorized blob tests at each stage. --- +## K-Divergence Investigation & Fix (2026-03-17/18) + +### Branch: `jc/clj-parity-kmeans-k-divergence` (PR #2453, Stack 19/25) + +### Investigation + +Wrote `scripts/investigate_k_divergence.py` to isolate the source of divergence +on vw (Python k=4, Clojure k=2). Systematic elimination: + +1. **PCA components**: identical (cosine similarity = 1.000000) — ruled out +2. **Silhouette implementation**: identical scores for both projection sets — ruled out +3. **K-means initialization**: both use first-k-distinct — ruled out +4. **Clojure blob injection**: injecting Clojure projections into Python clustering + still gave k=4 — so it's not about projection values +5. **Participant ordering**: **ROOT CAUSE FOUND** — Python sorted rows by PID via + `natsorted()`, Clojure preserves vote-encounter order (NamedMatrix insertion order). + Different row ordering → different first-k-distinct seeds → different local optima. + +Verified Clojure ordering chain by reading `conversation.clj`, `named_matrix.clj`, +`clusters.clj`: `filter-by-index` preserves original matrix row order, not +set iteration order. The CSV first-appearance order `[2, 3, 4, 6, 8, ...]` matches +the Clojure blob's base-cluster PID order exactly. + +### Fix + +- `conversation.py update_votes()`: replaced `natsorted(existing_rows.union(new_rows))` + with first-appearance order tracking from `vote_updates` +- `conversation.py _apply_moderation()`: replaced `natsorted()` with order-preserving + list comprehension +- Column ordering remains natsorted (doesn't affect clustering) + +### Cold-start blob results + +| Dataset | Clj k | Py k (before) | Py k (after) | Sizes match? | +|---------|-------|---------------|--------------|--------------| +| vw | 2 | 4 | **2** | [50,17] exact | +| biodiversity | 2 | 2 | **2** | [81,19] exact | +| bg2018 | 2 | 2 | **2** | close ([52,48] vs [51,49]) | +| FLI | 2 | 3 | 3 | inherent PCA divergence | + +FLI: 94.5% NaN sparsity, PCA |cos|≈0.9997 (not 1.0), silhouette gap 0.001. Not +fixable without replicating Clojure's power iteration PCA. Low priority. + +### Test results + +- 297 passed, 0 failed, 6 skipped, 58 xfailed +- Removed `test_group_clustering` xfail (now passes on cold-start blobs) +- Added incremental-blob xfail (different in-conv from single-shot) +- Updated 6 ordering tests (expect encounter order, not natsort) +- Re-recorded vw cold-start blob and golden snapshots for vw + biodiversity + +### Session 12 (2026-03-17/18) + +- Created branch off D15, investigated k divergence across all 7 datasets +- Re-recorded vw cold-start blob (confirmed k=2 is genuine, not generation artifact) +- Found root cause: `natsorted()` on participant rows +- Fixed `update_votes()` and `_apply_moderation()` to preserve encounter order +- Rebased branch onto new D15 (other session had rebased the stack) +- Inserted into stack at position 19/25, rebased D10→PR15 with `--onto` +- Created PR #2453 + +### What's Next + +1. Refactor D10-D1 branches (tests, code cleanup) before creating PRs for them. +2. Re-record private dataset golden snapshots. +3. FLI k divergence: accept or investigate Clojure power iteration PCA (low priority). + +--- + ## TDD Discipline **CRITICAL: For every fix, ALWAYS follow this order:** diff --git a/delphi/docs/INVESTIGATION_K_DIVERGENCE.md b/delphi/docs/INVESTIGATION_K_DIVERGENCE.md new file mode 100644 index 0000000000..6c00a5423e --- /dev/null +++ b/delphi/docs/INVESTIGATION_K_DIVERGENCE.md @@ -0,0 +1,118 @@ +# K-Divergence Investigation — RESOLVED + +## Problem (was) + +After all cold-start-relevant formula fixes (D2-D15), Python and Clojure +selected different k values on cold-start blobs. On vw: Python=4, Clojure=2. + +## Root Cause: Participant Row Ordering + +The k divergence was caused by **different participant ordering in the rating +matrix**, which cascades through base-cluster IDs into group-level k-means +initialization via first-k-distinct. + +### The chain + +``` +rating_mat row order + → PCA projection order + → base-cluster ID assignment (map-indexed on input rows) + → group-level k-means first-k-distinct init (first k base-cluster centers) + → different local optima → different silhouette scores → different k +``` + +### Clojure ordering + +Clojure's NamedMatrix preserves **insertion order** (backed by +`java.util.Vector`). When `rowname-subset` filters to `in-conv` participants, +`filter-by-index` (utils.clj:128-133) preserves the **original matrix row +order** (iterates source, checks membership in filter set). So the base-cluster +ordering is the vote-encounter order of participants in the rating matrix. + +### Python ordering (before fix) + +Python used `natsorted()` (conversation.py:232) to sort rating matrix rows +by PID. This gave ascending PID order `[1, 2, 3, 4, 5, ...]` instead of +the vote-encounter order `[2, 3, 4, 6, 8, ...]` that Clojure produces. + +### Impact + +With first-k-distinct initialization, different ordering → different initial +centers → different k-means local optima → different silhouette landscape: + +| k | Python (PID order) | Clojure (encounter order) | +|---|-------------------|--------------------------| +| 2 | sil=0.457 | **sil=0.487 (wins)** | +| 3 | sil=0.481 | sil=0.329 | +| 4 | **sil=0.508 (wins)** | sil=0.362 | + +## Fix + +Changed `update_votes()` and `_apply_moderation()` to preserve vote-encounter +order for participant rows instead of natsort: + +1. `update_votes()`: track first-appearance order from `vote_updates`, append + new PIDs in encounter order (not `natsorted`) +2. `_apply_moderation()`: filter `raw_rating_mat.index` preserving order + (list comprehension instead of `natsorted`) + +Column (comment ID) ordering remains `natsorted` — column permutation doesn't +affect PCA eigenvalues/vectors, only reorders component loadings. + +## Results after fix + +| Dataset | CS blob | Clj k | Py k | Sizes match? | +|---------|---------|-------|------|--------------| +| vw | ✓ | 2 | **2** | [50,17] exact | +| biodiversity | ✓ | 2 | **2** | [81,19] exact | +| bg2018 | ✓ | 2 | **2** | close ([51,49] vs [52,48]) | +| FLI | ✓ | 2 | 3 | **still diverges** | +| engage | empty | — | — | — | +| bg2050 | empty | — | — | — | +| pakistan | empty | — | — | — | + +### FLI: inherent PCA divergence (not fixable) + +FLI has 94.5% NaN sparsity. The PCA components are nearly but not exactly +identical (|cos|≈0.9997 vs 1.000000 for vw). This produces a silhouette +landscape where k=2 and k=3 differ by only 0.001. The tiny PCA difference +tips the balance. Injection test confirms: with Clojure projections injected, +Python picks k=2. This is inherent to the PCA algorithm difference (sklearn +full SVD vs Clojure power iteration) and not fixable without replicating +Clojure's PCA exactly. + +## Investigation Findings (for the record) + +### PCA is NOT the primary cause for most datasets + +- vw: PCA components have cosine similarity = 1.000000 (identical!) +- Projections are exactly negated (sign flip, irrelevant for clustering) +- Silhouette scores are identical for both projection sets + +### Silhouette implementation matches + +- Both use (b-a)/max(a,b) formula, unweighted mean +- Both compute on base-cluster centers (not raw participants) +- Clojure's `weighted-mean` without weights = unweighted mean + +### K-means initialization matches + +- Both use first-k-distinct (Clojure: `init-clusters`, Python: `_get_first_k_distinct_centers`) +- Both sort base clusters by ID +- The only difference was the DATA ORDER feeding into first-k-distinct + +## Files modified + +- `delphi/polismath/conversation/conversation.py` — `update_votes()` and `_apply_moderation()` +- `delphi/tests/test_conversation.py` — updated ordering tests +- `delphi/tests/test_legacy_clojure_regression.py` — removed xfail on `test_group_clustering` + +## Future investigation + +- **FLI k divergence**: Could be resolved by implementing Clojure's power + iteration PCA. Low priority — the silhouette gap is 0.001. +- **Column ordering**: Currently natsorted, Clojure uses insertion order. + Doesn't affect clustering but could affect other comparisons. +- **Multiple k-means restarts**: Using k-means++ with n_init=10 finds the + global optimum (k=4 for vw) regardless of ordering. This would be more + robust than first-k-distinct but would NOT match Clojure. diff --git a/delphi/docs/PLAN_DISCREPANCY_FIXES.md b/delphi/docs/PLAN_DISCREPANCY_FIXES.md index 4b65cd4be7..a5d85a6bc3 100644 --- a/delphi/docs/PLAN_DISCREPANCY_FIXES.md +++ b/delphi/docs/PLAN_DISCREPANCY_FIXES.md @@ -22,6 +22,7 @@ This plan's "PR N" labels map to actual GitHub PRs as follows: | PR 3 (D9) | #2446 | — | Fix D9: z-score thresholds (one-tailed) | | PR 4 (D5) | #2448 | Stack 14/25 | Fix D5: proportion test formula | | PR 5 (D6) | #2449 | Stack 15/25 | Fix D6: two-proportion test pseudocounts | +| (K-inv) | #2453 | Stack 19/25 | Fix K-means k divergence: preserve vote-encounter row order | Future fix PRs will be appended to the stack as they're created. @@ -444,35 +445,29 @@ By this point, we should have good test coverage from all the per-discrepancy te --- -### Investigation: Cold-Start K Divergence (after D15, before D12) +### K-Divergence Fix: Participant Row Ordering — **DONE** (PR #2453) -**Prerequisite**: All cold-start-relevant upstream fixes complete: D2/D2c/D2b (in-conv, -vote counts, sort order), D15 (moderation handling). Note: D1 (PCA sign flips) only -affects incremental updates — on cold start there are no previous components to align to. +**Root cause found and fixed.** Python's `natsorted()` sorted rating matrix rows by +PID, while Clojure's NamedMatrix preserves vote-encounter order (insertion order via +`java.util.Vector`). Different row ordering cascades through base-cluster ID assignment +into group-level k-means first-k-distinct initialization, producing different local +optima and different silhouette landscapes. -After D15, the rating matrix construction, in-conv filtering, and PCA inputs should all -match Clojure. Both implementations use silhouette for k-selection. Yet on vw, Python -selects k=4 while Clojure selects k=2. +**Fix**: `update_votes()` and `_apply_moderation()` now preserve vote-encounter order +for participant rows instead of natsort. Column ordering remains natsorted (doesn't +affect PCA eigenvalues/vectors). -**Investigation steps**: +**Cold-start blob results**: +- vw: k=2 exact match (was k=4), sizes [50,17] exact +- biodiversity: k=2 exact match, sizes [81,19] exact +- bg2018: k=2 match, sizes close ([52,48] vs [51,49]) +- FLI: k=3 vs k=2 — inherent PCA divergence (94.5% NaN sparsity, silhouette gap 0.001) -1. **PCA component comparison**: Feed the same rating matrix to both sklearn TruncatedSVD - and a Python reimplementation of Clojure's power iteration. Quantify divergence - (cosine similarity per component, Frobenius norm). -2. **Projection comparison**: Inject Clojure blob's PCA components into Python's - clustering path. Does k now match? -3. **Base-cluster comparison**: Given the same projections, compare k-means centroids - and member assignments. Check initialization (Clojure uses first-k-distinct centers - from base clusters — does Python match?). -4. **Silhouette score comparison**: Given the same base clusters, compare per-k - silhouette scores. Are the scores close but the winner differs? -5. **All datasets**: Run on all datasets with cold-start blobs, not just vw. +**FLI residual divergence**: Not fixable without replicating Clojure's power iteration +PCA. The silhouette landscape is essentially flat between k=2 and k=3, and any tiny PCA +difference tips the balance. Low priority. -**Outcome**: Either (a) identify a fixable discrepancy that makes k match, or -(b) document the inherent numerical divergence between sklearn SVD and Clojure -power iteration, and establish tolerance bounds for k agreement in tests. - -See `delphi/docs/HANDOFF_K_DIVERGENCE_INVESTIGATION.md` for detailed context. +See `delphi/docs/INVESTIGATION_K_DIVERGENCE.md` for the full investigation. --- @@ -513,7 +508,7 @@ See `delphi/docs/HANDOFF_K_DIVERGENCE_INVESTIGATION.md` for detailed context. | D13 | Subgroup clustering | — | — | **Deferred** (unused) | | D14 | Large conv optimization | — | — | **Deferred** (Python fast enough) | | D15 | Moderation handling | PR 12 | — | **DONE** ✓ | -| K-inv | Cold-start k divergence | (investigation) | — | Branch off D15 (D2+D15 done, clustering independent of repness) | +| K-inv | Cold-start k divergence (row ordering) | (after D15) | **#2453** | **DONE** ✓ (FLI residual: inherent PCA divergence) | | Replay | Replay infrastructure (A/B/C) | — | — | NOT BUILT — D3/D1 used synthetic tests only. Needed for incremental blob comparison. | ### Non-discrepancy PRs in the stack diff --git a/delphi/polismath/conversation/conversation.py b/delphi/polismath/conversation/conversation.py index be4ee58b80..09b96e5b20 100644 --- a/delphi/polismath/conversation/conversation.py +++ b/delphi/polismath/conversation/conversation.py @@ -220,15 +220,35 @@ def update_votes(self, # Step 4: Get new rows and columns by set difference logger.info(f"[{time.time() - start_time:.2f}s] Identifying new rows and columns...") - existing_rows = set(existing_rows) + existing_rows_set = set(existing_rows) existing_cols = set(existing_cols) - new_rows = set(updates_df['row']) - existing_rows + new_rows = set(updates_df['row']) - existing_rows_set new_cols = set(updates_df['col']) - existing_cols - # Natural sort: preserves types and sorts numerically when possible - # Numbers are sorted numerically, alphanumeric strings use natural order (e.g., p1, p2, p10) - all_rows = natsorted(existing_rows.union(new_rows)) + # Row order: preserve first-appearance order from votes. + # + # Clojure builds the rating matrix incrementally — each new participant + # gets a row appended in the order they first appear in the vote stream + # (conversation.clj, named_matrix.clj: NamedMatrix preserves insertion + # order via IndexHash backed by java.util.Vector). The base-cluster IDs + # are assigned by map-indexed on this row order, so the order directly + # determines group-level k-means initialization via first-k-distinct. + # + # Using natsort (PID-numeric order) instead would change the k-means + # seed points and produce different silhouette scores / different k. + # See delphi/docs/HANDOFF_K_DIVERGENCE_INVESTIGATION.md for the full + # analysis showing this is the root cause of k divergence on vw. + new_rows_ordered = [] + for pid, _, _ in vote_updates: + if pid in new_rows and pid not in existing_rows_set: + existing_rows_set.add(pid) + new_rows_ordered.append(pid) + all_rows = list(existing_rows) + new_rows_ordered + + # Column order: natsort is fine — column permutation doesn't affect PCA + # eigenvalues/vectors (only reorders the component loadings), so it has + # no effect on clustering k. all_cols = natsorted(existing_cols.union(new_cols)) logger.info(f"[{time.time() - start_time:.2f}s] Found {len(new_rows)} new rows and {len(new_cols)} new columns") @@ -304,8 +324,10 @@ def _apply_moderation(self) -> None: matrix structure so that tids, column indices, and dimensions match between Python and Clojure. """ - # Filter out moderated participants (remove rows) - keep_ptpts = natsorted(list(set(self.raw_rating_mat.index) - set(self.mod_out_ptpts))) + # Filter out moderated participants (remove rows). + # Preserve raw_rating_mat row order (vote encounter order) — see + # update_votes() comment on why row order matters for Clojure parity. + keep_ptpts = [p for p in self.raw_rating_mat.index if p not in self.mod_out_ptpts] self.rating_mat = self.raw_rating_mat.loc[keep_ptpts].copy() # Zero out moderated-out comments (keep columns, set values to 0) diff --git a/delphi/real_data/r6vbnhffkxbd7ifmfbdrd-vw/r6vbnhffkxbd7ifmfbdrd_math_blob_cold_start.json b/delphi/real_data/r6vbnhffkxbd7ifmfbdrd-vw/r6vbnhffkxbd7ifmfbdrd_math_blob_cold_start.json index 4869bea4ac..aa4f75e7aa 100644 --- a/delphi/real_data/r6vbnhffkxbd7ifmfbdrd-vw/r6vbnhffkxbd7ifmfbdrd_math_blob_cold_start.json +++ b/delphi/real_data/r6vbnhffkxbd7ifmfbdrd-vw/r6vbnhffkxbd7ifmfbdrd_math_blob_cold_start.json @@ -197,7 +197,7 @@ "8": 72, "49": 112 }, - "meta-tids": null, + "meta-tids": [], "pca": { "center": [ -0.8108108108108122, @@ -328,642 +328,642 @@ ], "comps": [ [ - 0.08250283054660007, - 0.055101758870821416, - 0.13505042396140907, - 0.12334770167084604, - 0.010493623631475105, - 0.11966925757532437, - 0.06475172466175352, - 0.08964682989951978, - 0.08766071549480045, - 0.08030333286417979, - 0.11592701842846069, - 0.052144868343715796, - 0.09030208884868757, - 0.08903322436368608, - 0.08984353795972425, - 0.11527393784577111, - 0.13908823262344888, - 0.17602910980232797, - 0.12221617493335714, - 0.09302353227314375, - 0.019177209829343324, - 0.16208202802301966, - 0.08541788562011295, - 0.13440639585167838, - 0.05674109875144368, - 0.09483722734589418, - 0.07396270808008018, - -0.009624405328808216, - 0.09925597287089899, - 0.07048236520952116, - 0.03149188026836379, - 0.09380953333084976, - 0.11172875393577839, - -0.0056877942740932545, - 0.07801580212990604, - 0.1061780604981554, - 0.09567753256362002, - 0.0380411530846819, - 0.07018735041006718, - 0.0959078838699559, - 0.14773154554021592, - 0.03866784041535128, - 0.12419192966747229, - 0.13137743928734658, - 0.1313858064142846, - 0.007473518619612597, - 0.06798400326672438, - 0.16873876689390843, - 0.128413505136328, - 0.18274978365472402, - 0.05993106673489661, - 0.06915515325069979, - 0.05107476899090733, - 0.16547063200654039, - 0.043822162679040835, - 0.06268316994853554, - 0.07530117564232015, - 0.09713314259866035, - 0.10047708726305825, - 0.10586889907925712, - 0.10730717378226151, - 0.0847168627837386, - 0.12596846129358, - 0.09660612037588857, - 0.05249945489179897, - 0.10615132490233997, - 0.0034564405326991993, - 0.08411874010287025, - 0.06391964840398005, - 0.09108675221740965, - 0.12983001644988404, - 0.1171454235839908, - 0.1240473548846134, - 0.1318411882305713, - 0.1276562639623921, - 0.023882138096499257, - 0.028652269585939097, - 0.12181251066834912, - 0.10972597568037099, - 0.036167030642226476, - -0.036842976770444985, - 0.08838696286890875, - 0.07857949244143468, - 0.12486836407473645, - 0.019134039200530154, - -0.007688473709264935, - 0.10158879242748256, - 0.11815422164456349, - 0.10318912307457279, - 0.09661045667806412, - 0.09137412504081584, - 0.12635877148327473, - 0.06999154103620371, - 0.0899770241222003, - 0.10302154574140011, - 0.05723127678957459, - 0.0017223313350659016, - 0.07463609628304316, - 0.0692106730402406, - 0.04378243352089107, - 0.09981495960619326, - 0.015452193111755691, - -0.06990908779860372, - 0.10322015155661042, - 0.028760741146297182, - 0.054701669543543524, - 0.011398222317496539, - 0.03545282073328294, - 0.03421905704740286, - 0.03935605951285059, - -0.010895623376877809, - 0.039736769115714186, - 0.04029893533541766, - 0.10638250882197703, - -0.013563294600367952, - 0.022084292867330282, - 0.03597649385701216, - -0.04862457165456948, - 0.09977732123059299, - 0.03748499825674783, - -0.04509888510728335, - 0.1003516029372767, - -0.02553952518720356, - -8.676297907352849e-05, - 0.002074487020904763 + 0.0825028305464962, + 0.05510175887049544, + 0.13505042396215686, + 0.12334770167020948, + 0.010493623631677742, + 0.11966925757498371, + 0.06475172466142785, + 0.08964682989977692, + 0.08766071549460829, + 0.0803033328637208, + 0.11592701842790201, + 0.052144868343960406, + 0.09030208884922253, + 0.08903322436366676, + 0.08984353796025242, + 0.11527393784503628, + 0.13908823262430844, + 0.17602910980281575, + 0.12221617493316383, + 0.09302353227358605, + 0.019177209829820064, + 0.16208202802371582, + 0.08541788561961913, + 0.1344063958523083, + 0.05674109875154187, + 0.09483722734511467, + 0.07396270808156992, + -0.009624405328371173, + 0.09925597287158144, + 0.07048236520922892, + 0.03149188026878346, + 0.09380953333027353, + 0.11172875393631955, + -0.005687794274328114, + 0.07801580212972313, + 0.10617806049762774, + 0.09567753256414459, + 0.0380411530846102, + 0.07018735040996178, + 0.09590788386986668, + 0.14773154554046616, + 0.0386678404143976, + 0.12419192966709525, + 0.1313774392868234, + 0.13138580641390432, + 0.007473518619650532, + 0.06798400326679299, + 0.16873876689506662, + 0.12841350513713945, + 0.1827497836554544, + 0.05993106673460063, + 0.06915515325032447, + 0.05107476899161839, + 0.1654706320073508, + 0.04382216267976646, + 0.06268316994929571, + 0.07530117564423483, + 0.09713314260095547, + 0.10047708726408036, + 0.10586889907859401, + 0.10730717378126603, + 0.08471686278361948, + 0.12596846129259787, + 0.09660612037689842, + 0.052499454891758016, + 0.10615132490167276, + 0.0034564405327745197, + 0.08411874010208019, + 0.06391964840382726, + 0.09108675221692428, + 0.12983001644885242, + 0.11714542358331648, + 0.12404735488407072, + 0.13184118822960053, + 0.1276562639614762, + 0.02388213809674599, + 0.028652269586614203, + 0.12181251066921218, + 0.1097259756797236, + 0.03616703064117623, + -0.03684297677054204, + 0.08838696286870547, + 0.07857949244204686, + 0.12486836407402552, + 0.019134039201031513, + -0.007688473709589414, + 0.10158879242785387, + 0.11815422164359098, + 0.10318912307591213, + 0.09661045667746618, + 0.09137412504115043, + 0.12635877148492386, + 0.06999154103565498, + 0.08997702412246827, + 0.10302154574075657, + 0.057231276789178186, + 0.001722331334817131, + 0.07463609628276159, + 0.06921067304027527, + 0.043782433521602306, + 0.09981495960565354, + 0.015452193112248871, + -0.06990908779801003, + 0.10322015155615537, + 0.02876074114580023, + 0.05470166954360931, + 0.011398222317684312, + 0.03545282073291142, + 0.03421905704672899, + 0.03935605951240107, + -0.01089562337606464, + 0.039736769116220795, + 0.04029893533518528, + 0.10638250882142275, + -0.013563294599929518, + 0.022084292866951374, + 0.03597649385653378, + -0.04862457165358563, + 0.09977732123013469, + 0.03748499825643051, + -0.04509888510712007, + 0.10035160293678859, + -0.02553952518658927, + -8.676297889136039e-05, + 0.0020744870207908095 ], [ - -0.014775271798221058, - -0.04524924305207084, - 0.10292697594917367, - -0.0872329412505286, - 0.028385640830282603, - -0.04640633598286524, - -0.0453664147509731, - 0.03478922536056457, - -0.02678695650068525, - -0.06362121232591343, - -0.07651450724435992, - 0.033419831186713864, - 0.07316770655680979, - -0.0024577074397407373, - 0.07244894343157361, - -0.10052654061988375, - 0.11799737046066255, - 0.06699756872448447, - -0.02608152837353889, - 0.05955370080436979, - 0.06613594285949713, - 0.09565542964416895, - -0.0672705131211367, - 0.08576941282289859, - 0.013032479283465303, - -0.10650795272779127, - 0.20383998912919468, - 0.060055028710193595, - 0.09287855975255042, - -0.03991120815621033, - 0.057775263714759856, - -0.07874243748997939, - 0.07440293797541521, - -0.032436377685662855, - -0.025425937914813894, - -0.07237948519610764, - 0.07141501959968467, - -0.009908328758549825, - -0.01500442552573571, - -0.012966513183218353, - 0.034874370232448985, - -0.13017832171354943, - -0.05164204820050629, - -0.07151763764234202, - -0.051970646530239445, - 0.005109311320306459, - 0.008738463412884744, - 0.1594877416740574, - 0.11149821261132639, - 0.10010197936427913, - -0.04010555840031776, - -0.051761945849774636, - 0.09748257894779351, - 0.11104387144107172, - 0.10064482158012537, - 0.10396032425760247, - 0.26222293044282935, - 0.3142796529262507, - 0.1404849917518646, - -0.09050397346677762, - -0.13615277330391568, - -0.01690122037428826, - -0.1343650231148984, - 0.13768965900307806, - -0.006071191417156059, - -0.09117833995276658, - 0.010404096967146635, - -0.1079701557217969, - -0.02145285723790535, - -0.06624281412893246, - -0.1413165622495084, - -0.09198056091915147, - -0.07433655950011304, - -0.13293107000557786, - -0.12529661682254226, - 0.033677129475385946, - 0.09206470408287182, - 0.11900209109239782, - -0.08861159423685594, - -0.14324117741559853, - -0.014054310393301161, - -0.02854707336625086, - 0.08364717307462875, - -0.09733682391787957, - 0.0681924902810189, - -0.044711794241139254, - 0.04993534539548474, - -0.13313946093227788, - 0.18256473507145612, - -0.08173461684049398, - 0.04528571077298926, - 0.22539867966418817, - -0.07590517327176874, - 0.03690356190998005, - -0.08806644223738992, - -0.053743981538314875, - -0.03448321963765035, - -0.03933672749118207, - 0.004364272718192026, - 0.09677275175127335, - -0.07403831525938565, - 0.06708592804537626, - 0.08121864028492452, - -0.062406377502708846, - -0.06768778879403815, - 0.008786524403003124, - 0.026533920995393222, - -0.050317502169763974, - -0.09188620719260103, - -0.06101512945165308, - 0.11174615829740085, - 0.06922009724651342, - -0.03118219528913531, - -0.07576856172198487, - 0.060195962649602, - -0.05134444983327648, - -0.0649577448104656, - 0.13482155670256965, - -0.06254577725997577, - -0.04271198418791368, - 0.02252062644771153, - -0.06663935228766617, - 0.0839839585949962, - 0.02493867650795035, - -0.015606353873676848 + -0.014775266047476438, + -0.04524923657125967, + 0.1029269712620157, + -0.08723294048811403, + 0.02838563256854775, + -0.04640633795642342, + -0.045366406752745975, + 0.03478922880769064, + -0.026786950931413298, + -0.0636212042110629, + -0.07651450726272599, + 0.033419832816337154, + 0.07316770771098347, + -0.0024577106934942756, + 0.07244894090726416, + -0.10052654161523447, + 0.11799736709771938, + 0.06699756749994787, + -0.026081532048059703, + 0.059553711429772414, + 0.06613593358050365, + 0.09565542607844131, + -0.06727051695993436, + 0.08576941918820788, + 0.01303248320399024, + -0.10650795606084715, + 0.20383998910390086, + 0.060055026469869946, + 0.09287856524801676, + -0.039911210536242615, + 0.05777525834689488, + -0.07874243920516656, + 0.07440293252476636, + -0.032436374805382286, + -0.0254259339469245, + -0.07237948257701018, + 0.07141502375919256, + -0.009908328398522397, + -0.015004419712754062, + -0.012966505765242942, + 0.03487436497169753, + -0.1301783254972707, + -0.05164204827805439, + -0.0715176387339991, + -0.05197064791700453, + 0.0051093120518838405, + 0.008738469765378107, + 0.15948773288753548, + 0.11149820827152934, + 0.10010197845654491, + -0.04010556299034796, + -0.05176194167059531, + 0.09748257757095416, + 0.11104386994321716, + 0.100644807572833, + 0.10396032581875427, + 0.26222292970123384, + 0.31427965126085966, + 0.1404849857867396, + -0.09050397585691289, + -0.13615277420714528, + -0.016901214020326745, + -0.13436502377615114, + 0.13768966471387198, + -0.006071186834090067, + -0.09117834168215709, + 0.01040409616853402, + -0.10797015811106317, + -0.02145285233385482, + -0.06624281665584346, + -0.14131656126851858, + -0.09198056443933778, + -0.07433655891799376, + -0.13293106914112574, + -0.12529661755340524, + 0.033677130062413796, + 0.09206470800570356, + 0.1190020828549335, + -0.08861159473169787, + -0.14324118275615613, + -0.014054303464657029, + -0.0285470660207292, + 0.08364717517480083, + -0.09733682392850167, + 0.0681924948479449, + -0.044711790555857736, + 0.04993535450956087, + -0.13313946052604067, + 0.1825647430436441, + -0.08173461869480306, + 0.04528571582455339, + 0.22539868350282335, + -0.07590516504141623, + 0.036903558936758396, + -0.08806644290104457, + -0.05374398614775759, + -0.0344832149637197, + -0.039336719243912514, + 0.004364276635381028, + 0.09677275641187522, + -0.07403831380532785, + 0.06708593196387529, + 0.08121864083932978, + -0.06240637638840436, + -0.06768779229722165, + 0.008786526420260982, + 0.026533912014134003, + -0.05031750783407992, + -0.09188621063739405, + -0.0610151347988737, + 0.11174615377894882, + 0.06922009855180318, + -0.031182201628535626, + -0.0757685628738861, + 0.060195960720804007, + -0.05134445551513776, + -0.0649577500655378, + 0.1348215550281611, + -0.06254577942979596, + -0.04271199172875212, + 0.02252062460761913, + -0.06663935434458056, + 0.08398395923782552, + 0.024938676219731334, + -0.015606353865682937 ] ], "comment-projection": [ [ - -0.17450994082005378, - -0.16307375097568094, - -0.815351206593268, - -0.29033036400460566, - -0.12683489605554885, - -0.699379281746956, - -0.11785172163118723, - -0.31779674062133356, - -0.23335157000314694, - -0.21264123683380118, - -0.2528982376925942, - -0.44080287550293756, - -0.23479256880917493, - -0.5098501439752493, - -0.44881078963378207, - -0.2514735229826634, - -0.893328729940538, - -1.297133933018934, - -0.4554727918349877, - -0.7020234281358957, - -0.1846288734323407, - -0.9454602589317328, - -0.6785533376320535, - -0.7993133982316449, - -0.1762179915642454, - -0.8835936964292559, - -0.3954874073342079, - 0.03862712100194474, - -0.5800785633841726, - -0.9346245756972363, - -0.41220283913763356, - -0.2151430702208329, - -1.1405423621036306, - 0.013044404757852894, - -0.10903039805102674, - -0.6080303147380698, - -0.26742683341463014, - -0.165399508244103, - -0.127744861249134, - -0.4514874692871092, - -0.9694695666004096, - -0.1285274482203016, - -0.7713933249815034, - -0.37575089936278333, - -0.612057488377017, - -0.009549311808322362, - -0.31297587317904246, - -1.0106554103953667, - -0.6343820008794308, - -1.3041732099744996, - -0.1763288673464543, - -0.10173396293617044, - -0.1570341511733045, - -1.367404540128284, - -0.37970867185163476, - -0.3319669635397043, - -0.5942772265478091, - -0.7376478443279495, - -1.191450894780027, - -0.47909653997057455, - -0.5682934777512313, - -0.1894326640249622, - -0.3778554228302989, - -0.44311354298054184, - -0.06521797217763742, - -0.14835098648956152, - -0.003133311888365262, - -0.34931969623878906, - -0.2654389751542015, - -0.26671879379593805, - -0.3894385567463921, - -0.38937789652093485, - -0.4059194896844424, - -0.5430634246908744, - -0.3805974452980868, - -0.08344075661220277, - -0.2815127655470421, - -0.79937918128667, - -0.1711777259433467, - -0.1415258933555887, - 0.4330409516203316, - -0.3293987621660502, - -0.30055501678608265, - -0.3589896218275338, - -0.14669147086810685, - 0.02667716357141846, - -0.3878331998389681, - -0.28562256370359085, - -0.7416575155714398, - -0.5777480947438772, - -0.31620759698640377, - -1.1121523080668805, - -0.1637851851700304, - -0.5559328407049928, - -0.2591585768529846, - -0.09844078872353433, - -0.002602195908773881, - -0.248081788311506, - -0.07737988484324543, - -0.3263349919102597, - -0.42921737471316135, - -0.129570578247524, - 1.1518424294092138, - -0.5770181888210291, - -0.1543463334873497, - -0.12741317873134753, - -0.09557699971716543, - -0.0825780387018071, - -0.13307154379814984, - -0.09166960874714732, - 0.05847205086704303, - -0.2665623508468536, - -0.18022231766172414, - -0.37844310213645066, - 0.053074785269237604, - -0.08230330014394052, - -0.11830277331821024, - 0.6251851236794541, - -0.24250964443960782, - -0.1396983403975823, - 0.3559206099153123, - -0.21370762458935036, - 0.2039575515416257, - 0.00011412230537576535, - -0.028991837482400487 + -0.17450994081983404, + -0.16307375097471621, + -0.8153512065977826, + -0.2903303640031074, + -0.12683489605799808, + -0.6993792817449651, + -0.11785172163059449, + -0.3177967406222451, + -0.23335157000263537, + -0.2126412368325858, + -0.2528982376913754, + -0.44080287550500535, + -0.23479256881056584, + -0.5098501439751386, + -0.44881078963642057, + -0.25147352298106035, + -0.8933287299460588, + -1.2971339330225284, + -0.4554727918342673, + -0.7020234281392336, + -0.18462887343693055, + -0.9454602589357937, + -0.6785533376281306, + -0.799313398235391, + -0.1762179915645503, + -0.8835936964219933, + -0.39548740734217364, + 0.03862712100019069, + -0.5800785633881611, + -0.9346245756933611, + -0.4122028391431267, + -0.21514307021951132, + -1.1405423621091548, + 0.013044404758391522, + -0.10903039805077112, + -0.6080303147350482, + -0.26742683341609635, + -0.16539950824379124, + -0.12774486124894216, + -0.45148746928668926, + -0.9694695666020517, + -0.12852744821713166, + -0.7713933249791615, + -0.37575089936128697, + -0.6120574883752455, + -0.009549311808370833, + -0.3129758731793583, + -1.0106554104023036, + -0.6343820008834394, + -1.3041732099797119, + -0.17632886734558348, + -0.10173396293561832, + -0.15703415117549074, + -1.3674045401349808, + -0.3797086718579222, + -0.3319669635437301, + -0.5942772265629197, + -0.7376478443453791, + -1.1914508947921472, + -0.47909653996757373, + -0.5682934777459592, + -0.18943266402469583, + -0.3778554228273529, + -0.4431135429851738, + -0.06521797217758654, + -0.14835098648862904, + -0.003133311888433541, + -0.34931969623550824, + -0.265438975153567, + -0.2667187937945168, + -0.38943855674329764, + -0.38937789651869353, + -0.4059194896826666, + -0.5430634246868756, + -0.3805974452953561, + -0.08344075661306483, + -0.2815127655536751, + -0.7993791812923338, + -0.17117772594233677, + -0.14152589335147897, + 0.43304095162147244, + -0.32939876216529257, + -0.3005550167884241, + -0.3589896218254899, + -0.14669147087195053, + 0.026677163572544325, + -0.3878331998403856, + -0.28562256370123995, + -0.7416575155810661, + -0.5777480947403014, + -0.3162075969875617, + -1.1121523080813953, + -0.16378518516874632, + -0.5559328407066486, + -0.25915857685136573, + -0.0984407887228525, + -0.002602195908398024, + -0.24808178831057015, + -0.07737988484328419, + -0.326334991915561, + -0.4292173747108405, + -0.12957057825165944, + 1.151842429399432, + -0.5770181888184853, + -0.15434633348468277, + -0.12741317873150076, + -0.09557699971873998, + -0.08257803870094176, + -0.13307154379552932, + -0.09166960874610029, + 0.05847205086267911, + -0.26656235085025204, + -0.18022231766068492, + -0.3784431021344789, + 0.05307478526752196, + -0.08230330014252842, + -0.11830277331663716, + 0.6251851236668043, + -0.24250964443849396, + -0.13969834039639972, + 0.3559206099140237, + -0.21370762458831088, + 0.20395755153672002, + 0.00011412230513615345, + -0.028991837480807938 ], [ - 0.031252646606486925, - 0.1339152133167008, - -0.6214096303402632, - 0.20532503843518626, - -0.3430930944940836, - 0.27121109118417824, - 0.08256938499422944, - -0.12332731052197178, - 0.0713064948165027, - 0.16846739475594852, - 0.16691867264711116, - -0.28251212734534764, - -0.19024182048695723, - 0.014074099876269808, - -0.3619165968757177, - 0.21930163743312586, - -0.7578674277594905, - -0.4936957297567811, - 0.0972001173338709, - -0.4494356661721099, - -0.6367247755119722, - -0.5579792428729831, - 0.5343919586768601, - -0.5100697804846895, - -0.040474318879425285, - 0.9923292601819813, - -1.0899566944527557, - -0.24102817592483577, - -0.542807248290513, - 0.5292387092526685, - -0.7562307341512978, - 0.1805881466067914, - -0.7595153408289801, - 0.07438968763999934, - 0.03553382848075821, - 0.41448224763093455, - -0.19961104804921845, - 0.043080521259092855, - 0.027308884659551835, - 0.06104001033436506, - -0.22885863998160627, - 0.4326977489231988, - 0.32076425076014686, - 0.20454666197014143, - 0.24210395515881028, - -0.006528438531665386, - -0.040228996314922265, - -0.9552466927529957, - -0.5508179154191104, - -0.714366480449392, - 0.11799836165618195, - 0.07614686155773573, - -0.2997193005802267, - -0.9176365142301582, - -0.8720635677164305, - -0.5505687284279669, - -2.0694645802212897, - -2.386700381506882, - -1.6658620754770195, - 0.40956447945171265, - 0.7210583441826489, - 0.03779227765961311, - 0.40304177808727704, - -0.6315557688813295, - 0.007541998173985747, - 0.12742560388123192, - -0.009431460025556443, - 0.4483674143653267, - 0.08908723032031601, - 0.19397116542201642, - 0.4238936384025959, - 0.30573279122454294, - 0.24325112232542967, - 0.5475527268367874, - 0.37356233675459716, - -0.11766304811566378, - -0.904549267132335, - -0.780936158584243, - 0.13823828951737496, - 0.5605197672871763, - 0.16519001667543992, - 0.10638866100935127, - -0.31993815086411614, - 0.27983797070696576, - -0.5227990073943498, - 0.15513922446078252, - -0.19063702133893792, - 0.32184744338621785, - -1.3121587218664792, - 0.48878786808320934, - -0.15671488810373596, - -1.9838564341924996, - 0.17762350529257895, - -0.2280126755124126, - 0.22153787030178337, - 0.09244245853935824, - 0.05209920486002856, - 0.13075075182558749, - -0.004879405235112602, - -0.721301504285197, - 0.31837443434528145, - -0.5625326079117035, - -1.3381819000214301, - 0.3488622558139264, - 0.36325079277628264, - -0.020465901928203967, - -0.22249369145740547, - 0.11720141178081847, - 0.35732835735180235, - 0.14211872615608973, - -0.5996928148258572, - -0.46434252855705044, - 0.13945101670836035, - 0.2695376322668699, - -0.23555396279721014, - 0.19134946682422346, - 0.21360284273718466, - -1.733453452310907, - 0.15201805397702886, - 0.15917816683011882, - -0.1777328881163386, - 0.14191440161121657, - -0.6706922872783544, - -0.03280269172979645, - 0.21810542589036624 + 0.03125263444251514, + 0.1339151941367289, + -0.6214096020420927, + 0.20532503664064855, + -0.34309299463570125, + 0.2712111027181823, + 0.08256937043701353, + -0.1233273227419848, + 0.07130647999118048, + 0.16846737326802527, + 0.1669186726871773, + -0.2825121411212503, + -0.19024182348790003, + 0.014074118508940046, + -0.361916584265603, + 0.21930163960451302, + -0.7578674061601524, + -0.49369572073334195, + 0.09720013102800143, + -0.4494357463591485, + -0.6367246861783241, + -0.5579792220733063, + 0.5343919891719834, + -0.5100698183391159, + -0.040474331055203434, + 0.9923292912358959, + -1.0899566943175065, + -0.24102816693339682, + -0.5428072804074942, + 0.5292387408128559, + -0.7562306638903553, + 0.18058815054040686, + -0.759515285188013, + 0.07438968103435509, + 0.03553382293546419, + 0.4144822326326323, + -0.19961105967539644, + 0.04308051969372602, + 0.027308874079603602, + 0.06103997541416028, + -0.2288586054585908, + 0.43269776149985256, + 0.3207642512418214, + 0.2045466650923756, + 0.2421039616190207, + -0.006528439466440676, + -0.04022902555970135, + -0.9552466401264056, + -0.5508178939798613, + -0.7143664739714491, + 0.11799837516094454, + 0.07614685540975608, + -0.29971929634700545, + -0.9176365018522932, + -0.872063446346556, + -0.5505687366957495, + -2.069464574368615, + -2.3867003688595805, + -1.6658620047429475, + 0.40956449026797265, + 0.7210583489661082, + 0.037792263451723235, + 0.403041780070773, + -0.631555795075634, + 0.007541992480626246, + 0.12742560629812863, + -0.009431459301602892, + 0.44836742428722715, + 0.08908720995527679, + 0.1939711728212774, + 0.42389363546001557, + 0.3057328029252368, + 0.24325112042056388, + 0.5475527232760464, + 0.37356233893360963, + -0.11766305016665467, + -0.9045493056747341, + -0.7809361045269263, + 0.13823829028935183, + 0.5605197881854135, + 0.16518993523830014, + 0.10638863363420833, + -0.31993815889696586, + 0.27983797073750366, + -0.5227990424067738, + 0.1551392116737377, + -0.19063705613353704, + 0.3218474424041919, + -1.312158779165475, + 0.4887878791723148, + -0.15671490558508477, + -1.9838564679784165, + 0.17762348603296854, + -0.2280126571420389, + 0.22153787197125743, + 0.09244246646784074, + 0.052099197798388924, + 0.13075072441261334, + -0.0048794096146630465, + -0.7213015390232722, + 0.3183744280926429, + -0.5625326407693166, + -1.3381819091559721, + 0.3488622495847749, + 0.3632508115763381, + -0.02046590662687657, + -0.22249361614725746, + 0.11720142497435546, + 0.3573283707479612, + 0.1421187386110364, + -0.5996927905772991, + -0.46434253731320035, + 0.13945104505902042, + 0.2695376363646213, + -0.23555395524959413, + 0.19134948799927026, + 0.2136028600176239, + -1.7334534307823817, + 0.15201805925079565, + 0.1591781949331644, + -0.17773287359432088, + 0.1419144059915979, + -0.6706922924119617, + -0.032802691350692144, + 0.21810542577864794 ] ], "comment-extremity": [ - 0.17728634286071962, - 0.21101263614991372, - 1.025157314158525, - 0.3555982166314358, - 0.3657867716948606, - 0.7501245468041962, - 0.1438983378283437, - 0.3408876557901826, - 0.24400322011389422, - 0.271288699908539, - 0.3030170983728366, - 0.5235649693675583, - 0.3021911657050927, - 0.5100443604226104, - 0.5765542021230959, - 0.3336647133608262, - 1.1714944548720498, - 1.3879091878683019, - 0.4657288126277741, - 0.8335642216885532, - 0.6629526835722641, - 1.0978323809654944, - 0.8637183554319605, - 0.948194647504572, - 0.18080639103662752, - 1.3287043241379304, - 1.1594894933298496, - 0.24410374037804597, - 0.7944374415236005, - 1.074065504924476, - 0.8612758581709675, - 0.2808889804868148, - 1.3702920975863107, - 0.07552471199987039, - 0.11467467316572251, - 0.7358643878063862, - 0.3337089776039652, - 0.17091790028942622, - 0.13063125490061406, - 0.455595015101019, - 0.9961162169438948, - 0.45138303786166567, - 0.8354264577996903, - 0.4278178061921544, - 0.6582011046647684, - 0.011567621435467976, - 0.3155507397181792, - 1.3906547388108104, - 0.8401433800170327, - 1.4870061297805204, - 0.21216852455825438, - 0.12707534670340692, - 0.33836575443596617, - 1.6467701565828545, - 0.951143281329181, - 0.6429058948279753, - 2.153102197013378, - 2.4980918824828615, - 2.04808488329579, - 0.6302987842605511, - 0.918086386224092, - 0.19316570723162924, - 0.5524648363887223, - 0.7715000331691865, - 0.06565261328705425, - 0.19556405527837342, - 0.009938313820937645, - 0.5683815518162147, - 0.2799899714937266, - 0.3297934626082442, - 0.575628531397553, - 0.4950633150709289, - 0.47322483094007156, - 0.7711886098117519, - 0.5332946979006872, - 0.14424615334866253, - 0.9473430285992441, - 1.1175277890320494, - 0.22002644965509283, - 0.5781107056695696, - 0.46347837855662105, - 0.3461532777656291, - 0.43896894935021585, - 0.4551734157760846, - 0.542989124898433, - 0.1574161682372852, - 0.432153982744942, - 0.43030922103861136, - 1.5072545842603606, - 0.7567737052550841, - 0.35291188779252314, - 2.274328276178588, - 0.24161062996814517, - 0.6008752812095466, - 0.34094309779538595, - 0.13504146409644888, - 0.052164150243197316, - 0.28042883730955925, - 0.07753357449390792, - 0.7916883143189354, - 0.5344060583492073, - 0.5772620459646901, - 1.765636366790253, - 0.6742809976277562, - 0.39468206079525076, - 0.1290463918757947, - 0.24215368180822314, - 0.14337120840410786, - 0.3813024924342356, - 0.16911844811280846, - 0.6025366817766018, - 0.5354152320542966, - 0.22787424129189943, - 0.4646178179565334, - 0.24145931794164652, - 0.20829894783339198, - 0.2441755937848545, - 1.8427472182040314, - 0.2862174285070493, - 0.21178601253443513, - 0.397829687279196, - 0.25653585751760394, - 0.7010184213310843, - 0.03280289024797419, - 0.22002387016736152 + 0.17728634071619692, + 0.2110126239769591, + 1.0251572970088891, + 0.3555982155940332, + 0.3657866780326157, + 0.750124550972514, + 0.14389832947487574, + 0.3408876602120238, + 0.24400321578091436, + 0.2712886865638153, + 0.30301709839389007, + 0.5235649768026834, + 0.3021911675953909, + 0.5100443609366476, + 0.5765541942094852, + 0.33366471478676557, + 1.171494440903138, + 1.3879091846619172, + 0.4657288154851087, + 0.8335642649260863, + 0.6629525977741361, + 1.0978323703974437, + 0.8637183742965441, + 0.9481946678710589, + 0.18080639376252747, + 1.3287043473253999, + 1.1594894932054283, + 0.2441037314996163, + 0.7944374634707586, + 1.074065520472179, + 0.8612757964819991, + 0.28088898301478865, + 1.3702920667506469, + 0.0755247054935922, + 0.11467467144717929, + 0.7358643793559607, + 0.333708984559444, + 0.17091789989456774, + 0.1306312526886546, + 0.4555950104220419, + 0.9961162090137983, + 0.45138304991679823, + 0.8354264579824681, + 0.4278178076836312, + 0.6582011070393593, + 0.011567621963068764, + 0.31555074344685813, + 1.3906547026664222, + 0.8401433659639799, + 1.48700612667305, + 0.21216853206825792, + 0.12707534301893528, + 0.338365750687257, + 1.6467701496910465, + 0.9511431700527212, + 0.6429059019103789, + 2.1531021913922217, + 2.4980918704046577, + 2.0480848257694797, + 0.6302987912866129, + 0.9180863899777226, + 0.1931657044516385, + 0.5524648378337349, + 0.771500054614703, + 0.0656526126329659, + 0.19556405685246733, + 0.00993831313392724, + 0.5683815596410831, + 0.27998996501337603, + 0.32979346695904066, + 0.5756285292285392, + 0.4950633222950819, + 0.4732248299593927, + 0.7711886072807692, + 0.5332946994250933, + 0.14424615502217525, + 0.9473430654025616, + 1.1175277512604742, + 0.22002645013932498, + 0.5781107259309025, + 0.46347834953238565, + 0.34615326935128143, + 0.43896895520648166, + 0.4551734157932471, + 0.5429891586100186, + 0.15741615563538922, + 0.43215399809523203, + 0.43030922030255, + 1.507254634147432, + 0.7567737124146278, + 0.35291189555637004, + 2.2743283056565455, + 0.2416106158082974, + 0.6008752742401179, + 0.34094309887894564, + 0.13504146952338436, + 0.05216414319033081, + 0.28042882452735435, + 0.0775335747695641, + 0.79168834597073, + 0.5344060546223101, + 0.5772620779848356, + 1.7656363737069727, + 0.6742809944027156, + 0.3946820780970846, + 0.1290463926211244, + 0.24215361261298407, + 0.14337121918890733, + 0.3813025049872055, + 0.16911845857875835, + 0.6025366576420691, + 0.5354152396498196, + 0.22787425864068492, + 0.46461782033214616, + 0.24145931057824496, + 0.20829896728484756, + 0.24417560890088155, + 1.8427471979480763, + 0.2862174313071501, + 0.2117860336558784, + 0.3978296807902415, + 0.2565358599399439, + 0.7010184262411839, + 0.03280288986887135, + 0.2200238700564075 ] }, "zid": 39321, @@ -990,8 +990,8 @@ 62 ], "center": [ - 3.4635879670323155, - 1.1914859639558009 + 3.463587967041019, + 1.1914859669351303 ] }, { @@ -1049,8 +1049,8 @@ 66 ], "center": [ - -1.3116736323917184, - -0.41092268190149467 + -1.3116736323947193, + -0.41092268218564015 ] } ], @@ -1350,8 +1350,8 @@ 35 ], "center": [ - 11.392906408097755, - -3.198346385405354 + 11.392906408074346, + -3.1983464548444083 ], "parent-id": 0 }, @@ -1367,8 +1367,8 @@ 62 ], "center": [ - 2.789531771377093, - -0.0033198613670838584 + 2.789531771377101, + -0.0033198138348869816 ], "parent-id": 0 }, @@ -1385,8 +1385,8 @@ 52 ], "center": [ - 2.0710575279642756, - 3.3343991484536137 + 2.071057527988615, + 3.33439913055378 ], "parent-id": 0 } @@ -1409,8 +1409,8 @@ 65 ], "center": [ - -0.20606848688908333, - 1.3873049164191464 + -0.2060684868789706, + 1.3873048815425468 ], "parent-id": 1 }, @@ -1433,8 +1433,8 @@ 63 ], "center": [ - -2.891718244161656, - -1.1718184560740152 + -2.891718244170204, + -1.1718184357002455 ], "parent-id": 1 }, @@ -1463,8 +1463,8 @@ 66 ], "center": [ - -1.3245782660371663, - -0.5828883334501634 + -1.3245782660414183, + -0.5828883289225242 ], "parent-id": 1 }, @@ -1477,14 +1477,140 @@ 57 ], "center": [ - 0.9661902405223957, - -2.2826420095162527 + 0.9661902405057214, + -2.2826420023846645 ], "parent-id": 1 } ] }, - "mod-in": null, + "mod-in": [ + 0, + 121, + 65, + 70, + 62, + 74, + 110, + 7, + 59, + 86, + 20, + 72, + 58, + 60, + 27, + 1, + 69, + 101, + 24, + 102, + 55, + 85, + 39, + 88, + 46, + 4, + 77, + 106, + 119, + 95, + 54, + 92, + 104, + 15, + 48, + 50, + 116, + 75, + 99, + 21, + 31, + 113, + 32, + 40, + 91, + 117, + 108, + 56, + 33, + 13, + 22, + 90, + 109, + 36, + 41, + 118, + 89, + 100, + 122, + 43, + 61, + 29, + 44, + 93, + 6, + 111, + 28, + 64, + 103, + 51, + 25, + 34, + 17, + 3, + 12, + 2, + 66, + 107, + 23, + 47, + 35, + 82, + 76, + 97, + 19, + 57, + 68, + 11, + 115, + 9, + 5, + 112, + 83, + 14, + 45, + 53, + 78, + 26, + 123, + 16, + 81, + 120, + 79, + 38, + 98, + 124, + 87, + 30, + 73, + 96, + 10, + 18, + 105, + 52, + 114, + 67, + 71, + 42, + 80, + 37, + 63, + 94, + 8, + 49, + 84 + ], "subgroup-repness": { "0": { "0": [ @@ -28270,142 +28396,142 @@ ] ], "x": [ - 2.223129999238736, - -1.3361161440812546, - -3.8195283728278877, - 1.6265368544275989, - -3.3819480290999007, - -0.7251988296345168, - 2.392807776967736, - -3.6566848766450954, - -2.580866465631867, - -2.7907878722830772, - 2.4379324398319886, - -1.4316289688201365, - -0.9095953127015104, - -0.4798379116673418, - 0.7669550526123194, - -2.334350148428726, - 0.40507977116090965, - 0.6372984682534456, - -1.976053432047583, - -2.0336873651969087, - -2.394824563343252, - -0.9842080826780432, - -1.5614650876203628, - -1.6748621749072206, - -3.742590363445005, - -0.8089658719867934, - -2.3459627725912484, - 4.1637263109451865, - -2.073450234389162, - -0.4856083301342579, - 1.3912992096837866, - 0.6824890202120091, - 14.047471957387804, - -2.723583383491658, - -3.8618523619326557, - 8.738340858807705, - 1.3993805876812537, - -1.5534653254114072, - 2.4323321936087536, - 3.534387991094276, - -0.8138387597543127, - -0.2517368041160817, - -2.42080227494301, - -1.0242477777920902, - 1.3566039284982638, - -1.463762213269331, - -0.22353403086585766, - 0.4889657977077493, - 0.23785997632656108, - 2.8628960654140956, - 2.3219121445553172, - -1.2808074580185778, - 1.6266732464376399, - -1.1623138454654751, - -1.9426480265147028, - 5.19923175845314, - -0.6602636391648835, - 1.2939255564885703, - -1.8344034651105374, - 0.33586176989872046, - -1.366378163122316, - -1.318394325491435, - 2.120632933036427, - -2.396586568402896, - -0.8287989050654353, - 0.1294188426888646, - -0.9001981533616068 + 2.2231299992628393, + -1.3361161440802853, + -3.8195283728375165, + 1.6265368544462049, + -3.3819480291052373, + -0.7251988296389096, + 2.392807777006058, + -3.6566848766554534, + -2.580866465636739, + -2.7907878722857986, + 2.4379324398592384, + -1.4316289688245996, + -0.9095953126941094, + -0.4798379116516469, + 0.7669550526162964, + -2.334350148434741, + 0.4050797711805566, + 0.6372984682588219, + -1.9760534320518546, + -2.0336873652168728, + -2.3948245633501397, + -0.9842080826703025, + -1.5614650876343557, + -1.6748621749066517, + -3.7425903634519235, + -0.8089658719751235, + -2.345962772605255, + 4.1637263109333515, + -2.073450234388031, + -0.4856083301076437, + 1.3912992096901307, + 0.6824890201986138, + 14.047471957385197, + -2.723583383502468, + -3.8618523619394565, + 8.738340858763497, + 1.3993805876539307, + -1.5534653254210173, + 2.43233219361826, + 3.534387991120911, + -0.81383875975404, + -0.25173680410795024, + -2.4208022749510407, + -1.0242477777930103, + 1.3566039285068696, + -1.4637622132685644, + -0.22353403087374651, + 0.488965797693909, + 0.23785997633638806, + 2.862896065425807, + 2.321912144578856, + -1.2808074580303075, + 1.6266732464542584, + -1.1623138454715052, + -1.9426480265177306, + 5.199231758439622, + -0.6602636391619409, + 1.2939255564764323, + -1.8344034651133565, + 0.33586176990621697, + -1.366378163121182, + -1.3183943255003463, + 2.1206329330256666, + -2.3965865684102146, + -0.8287989050765119, + 0.12941884270334614, + -0.9001981533623554 ], "y": [ - 3.308555561979538, - 0.13449610551441923, - -1.318426027767265, - 2.5542787998128333, - -0.736923898870232, - -0.6002255312521826, - 5.248383205594115, - -1.417609637095525, - -0.6673052696875588, - -0.3712370960420423, - 3.733508966180956, - -0.60798715331307, - 1.0192664533998188, - 2.146045491742444, - 0.551832781363142, - -0.8242642079959726, - 2.7004003663372975, - 0.7330169557585786, - -0.5821928662472879, - -2.7418062851347527, - -0.9427896099935302, - 1.0631220614512469, - -1.9321153399004571, - 0.0757203458293371, - -0.9489470512417967, - 1.5998093786714758, - -1.918031033396838, - -1.6403163909049674, - 0.1569634434707026, - 3.6448113808718468, - 0.8648268792293394, - -1.8377199635649335, - -0.37963972203479823, - -1.4809040946135505, - -0.9323943950827616, - -6.01705304877591, - -3.743366541627327, - -1.3148702091319922, - 1.298384841526324, - 3.6419137946962667, - 0.03579241059900898, - 1.1093294109259988, - -1.0993250442671052, - -0.12095447288295244, - 1.1845706030464926, - 0.10254102515816717, - -1.0752314472878817, - -1.8951770097238174, - 1.3622823435371665, - 1.6016111476343926, - 3.223631812852815, - -1.6076341891685284, - 2.264520680175086, - -0.8288660590938816, - -0.419938796640025, - -1.850930923990432, - 0.4024159342368938, - -1.6543045231489328, - -0.38897666167745587, - 1.02923342446468, - 0.15639296666726116, - -1.217228633241614, - -1.4813851861107363, - -1.0054947338472808, - -1.521339128142224, - 1.9864933806064664, - -0.10211247826261353 + 3.3085554548290266, + 0.13449607924558915, + -1.3184260147293156, + 2.554278749025347, + -0.7369238177950143, + -0.6002255404216142, + 5.248383210761447, + -1.4176096360567991, + -0.667305273043934, + -0.37123710631057527, + 3.7335089148228136, + -0.6079872104107457, + 1.019266387821162, + 2.14604549762102, + 0.5518327180307204, + -0.8242642023493534, + 2.700400264074815, + 0.7330169776205552, + -0.5821929063569498, + -2.7418061920375907, + -0.9427896080041931, + 1.0631220284534924, + -1.9321151610084184, + 0.07572036314547675, + -0.9489470247359404, + 1.599809336183811, + -1.9180310428041958, + -1.6403161822332932, + 0.1569634208279719, + 3.6448113516668963, + 0.8648269120134887, + -1.8377199105366215, + -0.37963949396447033, + -1.4809040816922132, + -0.9323943682130689, + -6.017053415724346, + -3.7433664854017374, + -1.3148702139662045, + 1.2983848840937229, + 3.641913857600807, + 0.03579243059570221, + 1.1093294572337336, + -1.0993250405290265, + -0.1209545254538361, + 1.1845705571586063, + 0.10254104268797788, + -1.0752314959981886, + -1.8951770119862457, + 1.3622821658400868, + 1.6016111461761346, + 3.2236318028074966, + -1.6076341816926452, + 2.264520790508487, + -0.8288660311276317, + -0.4199387416900493, + -1.850930904978948, + 0.40241593248230356, + -1.6543046016140543, + -0.3889766381903791, + 1.0292333877909803, + 0.15639296248284304, + -1.2172286640404957, + -1.4813851090739205, + -1.0054946915022178, + -1.5213390804008824, + 1.9864933377658, + -0.10211248667800285 ], "count": [ 1, @@ -28477,7 +28603,7 @@ 1 ] }, - "mod-out": null, + "mod-out": [], "group-votes": { "0": { "n-members": 17, @@ -34353,5 +34479,5 @@ 123, 124 ], - "lastVoteTimestamp": 1768430707909 + "lastVoteTimestamp": 1773762860935 } \ No newline at end of file diff --git a/delphi/tests/test_conversation.py b/delphi/tests/test_conversation.py index 2d57fa6123..7ca0c59f14 100644 --- a/delphi/tests/test_conversation.py +++ b/delphi/tests/test_conversation.py @@ -115,22 +115,22 @@ def test_text_vote_values(self): # This behavior is different from the test expectation - the implementation skips null votes assert 'p2' not in updated_conv.raw_rating_mat.index or 'c1' not in updated_conv.raw_rating_mat.columns or pd.isna(updated_conv.raw_rating_mat.loc['p2', 'c1']) - @pytest.mark.parametrize("test_desc,ptpt_ids,comment_ids,expected_ptpt_types,expected_ptpts_sorted,expected_comment_types,expected_comments_sorted", [ + @pytest.mark.parametrize("test_desc,ptpt_ids,comment_ids,expected_ptpt_types,expected_ptpts_ordered,expected_comment_types,expected_comments_sorted", [ ( "integer_ids", [1, 10, 2, 100, 5, 50], [3, 30, 20, 4], ['int', 'int', 'int', 'int', 'int', 'int'], - [1, 2, 5, 10, 50, 100], # Natural/numeric order + [1, 10, 2, 100, 5, 50], # Vote encounter order (not sorted) ['int', 'int', 'int', 'int'], - [3, 4, 20, 30] # Natural/numeric order + [3, 4, 20, 30] # Natural/numeric order (columns still natsorted) ), ( "numeric_strings", ['1', '10', '2', '100', '5', '50'], ['3', '30', '20', '4'], ['str', 'str', 'str', 'str', 'str', 'str'], - ['1', '2', '5', '10', '50', '100'], # Natural/numeric order + ['1', '10', '2', '100', '5', '50'], # Vote encounter order ['str', 'str', 'str', 'str'], ['3', '4', '20', '30'] # Natural/numeric order ), @@ -139,7 +139,7 @@ def test_text_vote_values(self): ['user1', 'user10', 'user2', 'user100'], ['comment1', 'comment10', 'comment2'], ['str', 'str', 'str', 'str'], - ['user1', 'user2', 'user10', 'user100'], # Natural order + ['user1', 'user10', 'user2', 'user100'], # Vote encounter order ['str', 'str', 'str'], ['comment1', 'comment2', 'comment10'] # Natural order ), @@ -148,7 +148,7 @@ def test_text_vote_values(self): ['p1', 'p10', 'p2', 'p100', 'p5', 'p50'], ['c1', 'c10', 'c2', 'c20'], ['str', 'str', 'str', 'str', 'str', 'str'], - ['p1', 'p2', 'p5', 'p10', 'p50', 'p100'], # Natural order + ['p1', 'p10', 'p2', 'p100', 'p5', 'p50'], # Vote encounter order ['str', 'str', 'str', 'str'], ['c1', 'c2', 'c10', 'c20'] # Natural order ), @@ -157,7 +157,7 @@ def test_text_vote_values(self): [1.0, 10.0, 2.0, 100.0, 5.0, 50.0], [3.0, 30.0, 20.0, 4.0], ['float', 'float', 'float', 'float', 'float', 'float'], - [1.0, 2.0, 5.0, 10.0, 50.0, 100.0], # Numeric order + [1.0, 10.0, 2.0, 100.0, 5.0, 50.0], # Vote encounter order ['float', 'float', 'float', 'float'], [3.0, 4.0, 20.0, 30.0] # Numeric order ), @@ -166,15 +166,17 @@ def test_text_vote_values(self): ['omega', 'alpha', 'theta', 'beta', 'zeta', 'gamma'], ['gamma', 'zeta', 'alpha', 'omega', 'beta', 'theta'], ['str', 'str', 'str', 'str', 'str', 'str'], - ['alpha', 'beta', 'gamma', 'omega', 'theta', 'zeta'], + ['omega', 'alpha', 'theta', 'beta', 'zeta', 'gamma'], # Vote encounter order ['str', 'str', 'str', 'str', 'str', 'str'], ['alpha', 'beta', 'gamma', 'omega', 'theta', 'zeta'] ), ], ids=lambda test_desc, *args: test_desc if isinstance(test_desc, str) else str(test_desc)) - def test_natural_sorting_homogeneous_types(self, test_desc, ptpt_ids, comment_ids, expected_ptpt_types, expected_ptpts_sorted, expected_comment_types, expected_comments_sorted): - """Test natural sorting with homogeneous ID types (all same type). + def test_natural_sorting_homogeneous_types(self, test_desc, ptpt_ids, comment_ids, expected_ptpt_types, expected_ptpts_ordered, expected_comment_types, expected_comments_sorted): + """Test row/column ordering with homogeneous ID types. - Types should be preserved and IDs should be sorted in natural order. + Participant rows preserve vote encounter order (matching Clojure's + NamedMatrix insertion order). Comment columns are natsorted. + Types should be preserved in both cases. """ conv = Conversation('test_conv') @@ -206,9 +208,9 @@ def test_natural_sorting_homogeneous_types(self, test_desc, ptpt_ids, comment_id assert result_comment_types == expected_comment_types, \ f"[{test_desc}] TYPE CHECK FAILED (comments): got {result_comment_types}, expected {expected_comment_types}" - # Check that IDs are sorted correctly (natural order) - assert result_ptpts == expected_ptpts_sorted, \ - f"[{test_desc}] SORT CHECK FAILED (participants): got {result_ptpts}, expected {expected_ptpts_sorted}" + # Check that participant rows are in vote encounter order + assert result_ptpts == expected_ptpts_ordered, \ + f"[{test_desc}] ORDER CHECK FAILED (participants): got {result_ptpts}, expected {expected_ptpts_ordered}" assert result_tids == expected_comments_sorted, \ f"[{test_desc}] SORT CHECK FAILED (comments): got {result_tids}, expected {expected_comments_sorted}" @@ -243,18 +245,17 @@ def test_natural_sorting_mixed_types(self): pids = list(updated_conv.raw_rating_mat.index) tids = list(updated_conv.raw_rating_mat.columns) - # Expected natural order: - # Numbers first (sorted numerically): 1, 2, 10 - # Then strings (sorted alphabetically): 'alpha', 'beta', 'gamma' - expected_pids = [1, 2, 10, 'alpha', 'beta', 'gamma'] + # PIDs in vote encounter order: alpha, 2, gamma, 10, 1, beta + expected_pids = ['alpha', 2, 'gamma', 10, 1, 'beta'] + # TIDs still natsorted: 1, 2, 10, alpha, beta, zeta expected_tids = [1, 2, 10, 'alpha', 'beta', 'zeta'] - # Check natural ordering - assert pids == expected_pids, f"Mixed PIDs must be sorted naturally: {pids} != {expected_pids}" + # Check ordering + assert pids == expected_pids, f"Mixed PIDs must be in encounter order: {pids} != {expected_pids}" assert tids == expected_tids, f"Mixed TIDs must be sorted naturally: {tids} != {expected_tids}" - # Check that types are preserved - expected_pid_types = ['int', 'int', 'int', 'str', 'str', 'str'] + # Check that types are preserved (encounter order interleaves types) + expected_pid_types = ['str', 'int', 'str', 'int', 'int', 'str'] expected_tid_types = ['int', 'int', 'int', 'str', 'str', 'str'] assert [type(p).__name__ for p in pids] == expected_pid_types, f"PID types not preserved" assert [type(t).__name__ for t in tids] == expected_tid_types, f"TID types not preserved" @@ -288,11 +289,11 @@ def test_natural_sorting_numeric_only_with_export(self): assert all(isinstance(t, int) for t in tids), \ f"Not all TIDs are ints: {[type(t).__name__ for t in tids]}" - # Check natural order (numeric) - expected_pids = [1, 3, 5] - expected_tids = [5, 10, 20] # Natural/numeric order + # PIDs in vote encounter order: 5, 3, 1 + expected_pids = [5, 3, 1] + expected_tids = [5, 10, 20] # Columns still natsorted - assert pids == expected_pids, f"PIDs not in natural order: {pids} != {expected_pids}" + assert pids == expected_pids, f"PIDs not in encounter order: {pids} != {expected_pids}" assert tids == expected_tids, f"TIDs not in natural order: {tids} != {expected_tids}" # Check exported data maintains same order and types @@ -321,16 +322,16 @@ def test_incremental_updates_maintain_sorting(self): # Skip PCA - only testing sorting conv = conv.update_votes(votes1, recompute=False) - # Check initial sorting in internal matrix (natural/numeric order) + # Check initial ordering in internal matrix tids = list(conv.raw_rating_mat.columns) pids = list(conv.raw_rating_mat.index) - # Expected natural order for integers + # PIDs in encounter order: 5, 3. TIDs natsorted: 5, 10 expected_initial_tids = [5, 10] - expected_initial_pids = [3, 5] + expected_initial_pids = [5, 3] - assert tids == expected_initial_tids, f"Initial tids not sorted naturally: {tids} != {expected_initial_tids}" - assert pids == expected_initial_pids, f"Initial pids not sorted naturally: {pids} != {expected_initial_pids}" + assert tids == expected_initial_tids, f"Initial tids not sorted: {tids} != {expected_initial_tids}" + assert pids == expected_initial_pids, f"Initial pids not in encounter order: {pids} != {expected_initial_pids}" # Check types are preserved assert all(isinstance(t, int) for t in tids), f"TID types not preserved" @@ -357,12 +358,13 @@ def test_incremental_updates_maintain_sorting(self): tids = list(conv.raw_rating_mat.columns) pids = list(conv.raw_rating_mat.index) - # Expected natural order (numeric): [1, 3, 5, 10, 20] and [1, 3, 4, 5, 9] + # TIDs natsorted: [1, 3, 5, 10, 20] + # PIDs: existing [5, 3] + new in encounter order [1, 9, 4] = [5, 3, 1, 9, 4] expected_tids = [1, 3, 5, 10, 20] - expected_pids = [1, 3, 4, 5, 9] + expected_pids = [5, 3, 1, 9, 4] - assert tids == expected_tids, f"Tids order incorrect (should be natural/numeric): {tids} != {expected_tids}" - assert pids == expected_pids, f"Pids order incorrect (should be natural/numeric): {pids} != {expected_pids}" + assert tids == expected_tids, f"Tids order incorrect: {tids} != {expected_tids}" + assert pids == expected_pids, f"Pids order incorrect (should be encounter order): {pids} != {expected_pids}" # Check types are still preserved assert all(isinstance(t, int) for t in tids), f"TID types not preserved after update" diff --git a/delphi/tests/test_legacy_clojure_regression.py b/delphi/tests/test_legacy_clojure_regression.py index 6d72ec6532..d0c3782790 100644 --- a/delphi/tests/test_legacy_clojure_regression.py +++ b/delphi/tests/test_legacy_clojure_regression.py @@ -187,7 +187,6 @@ def test_pca_components_match_clojure(self, conversation_data): check.less_equal(norm_angle_deg, 10.0, f"PC{i+1} angle difference should be ≤10° (got {norm_angle_deg:.2f}°)") - @pytest.mark.xfail(raises=AssertionError, strict=True, reason="D2/D3: Wrong participant threshold and missing k-smoother produce different cluster counts") def test_group_clustering(self, conversation_data): """ Test that group clustering matches the Clojure implementation. @@ -201,6 +200,12 @@ def test_group_clustering(self, conversation_data): conv = conversation_data['conv'] clojure_output = conversation_data['clojure_output'] dataset_name = conversation_data['dataset_name'] + blob_type = conversation_data['blob_type'] + + # Incremental blobs are progressive snapshots — in-conv sets differ + # from single-shot computation, so clustering comparison is not valid. + if blob_type == 'incremental': + pytest.xfail("Incremental blobs have different in-conv from single-shot") print(f"\n[{dataset_name}] Testing group clustering...")