Skip to content

Add canonical test cases to swedj - #370

Merged
cmalinmayor merged 6 commits into
feat/swedjfrom
feat/swedj-refactor
Oct 21, 2026
Merged

cmalinmayor merged 6 commits into
feat/swedjfrom
feat/swedj-refactor

Conversation

@msschwartz21

@msschwartz21 msschwartz21 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Builds on #357

This is a WIP. I'm leaving tests failing when i can't figure out why SWEDJ is arriving at its answer and it disagrees with what I assumed the correct answer would be.

Here's my running list of weird observations as I go through the standard test cases.

  • Skip edges are ignored in the edge analysis of pred graphs. Gt skip edges are untouched.
  • Skip edges are allowed and included in the analysis of divisions, see div_daughter_gap and div_daughter_dual_gap
  • Swedj tolerates less matching information than we do for shifted divisions (see div_shift_bad_match_daughter and div_shift_bad_match_pred). Otherwise we seem to be in agreement for shifted divisions according to our test cases.

@msschwartz21

msschwartz21 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

I asked Claude to do a comparison of traccuracy and the royer lab implementation on all of the test cases.
compare_swedj_royer.py
Our implementation does agree with theirs, but we need to resolve the cases where they're written intention doesn't match the implementation.

Counts are edge_tp/edge_fp/edge_fn/div_tp/div_fp/div_fn; threshold=2.0

case                          traccuracy (hand)   traccuracy (dist)   royer                 status
--------------------------------------------------------------------------------------------------
empty_gt                      0/0/0/0/0/0         0/0/0/0/0/0         ERR                   ERROR
empty_pred                    0/0/2/0/0/0         0/0/2/0/0/0         0/0/2/0/0/0           ok
good_matched                  2/0/0/0/0/0         2/0/0/0/0/0         2/0/0/0/0/0           ok
fn_node_matched(0)            1/0/1/0/0/0         1/0/1/0/0/0         1/0/1/0/0/0           ok
fn_edge_matched(0)            1/0/1/0/0/0         1/0/1/0/0/0         1/0/1/0/0/0           ok
fp_node_matched(0)            2/0/0/0/0/0         2/0/0/0/0/0         2/0/0/0/0/0           ok
fp_edge_matched(0)            2/0/0/0/0/0         2/0/0/0/0/0         2/0/0/0/0/0           ok
crossover_edge                1/1/3/0/0/0         1/1/3/0/0/0         1/1/3/0/0/0           ok
gap_close_gt_gap              1/2/1/0/0/0         1/2/1/0/0/0         1/2/1/0/0/0           ok
gap_close_pred_gap            1/0/2/0/0/0         1/0/2/0/0/0         1/0/2/0/0/0           ok
gap_close_matched_gap         1/0/1/0/0/0         1/0/1/0/0/0         1/0/1/0/0/0           ok
gap_close_offset              0/1/2/0/0/0         0/1/2/0/0/0         0/1/2/0/0/0           ok
all_basic_errors              1/3/6/0/0/0         1/3/6/0/0/0         1/3/6/0/0/0           ok
empty_pred_div(1)             0/0/3/0/0/1         0/0/3/0/0/1         0/0/3/0/0/1           ok
empty_gt_div(1)               0/0/0/0/0/0         0/0/0/0/0/0         ERR                   ERROR
good_div(0)                   4/0/0/1/0/0         4/0/0/1/0/0         4/0/0/1/0/0           ok
good_div(1)                   3/0/0/1/0/0         3/0/0/1/0/0         3/0/0/1/0/0           ok
good_div(2)                   4/0/0/1/0/0         4/0/0/1/0/0         4/0/0/1/0/0           ok
fp_div(0)                     3/1/0/0/1/0         3/1/0/0/1/0         3/1/0/0/1/0           ok
fp_div(1)                     2/1/0/0/1/0         2/1/0/0/1/0         2/1/0/0/1/0           ok
one_child(0)                  3/0/1/0/0/1         3/0/1/0/0/1         3/0/1/0/0/1           ok
one_child(1)                  2/0/1/0/0/1         2/0/1/0/0/1         2/0/1/0/0/1           ok
no_children(0)                2/0/2/0/0/1         2/0/2/0/0/1         2/0/2/0/0/1           ok
no_children(1)                1/0/2/0/0/1         1/0/2/0/0/1         1/0/2/0/0/1           ok
wrong_child(0)                3/1/2/0/1/1         3/1/2/0/1/1         3/1/2/0/1/1           ok
wrong_child(1)                2/1/1/0/1/1         2/1/1/0/1/1         2/1/1/0/1/1           ok
wrong_children(0)             0/4/4/1/0/0         0/4/4/1/0/0         0/4/4/1/0/0           ok
wrong_children(1)             1/2/2/0/1/1         1/2/2/0/1/1         1/2/2/0/1/1           ok
div_daughter_gap              4/0/2/1/0/0         4/0/2/1/0/0         4/0/2/1/0/0           ok
div_daughter_dual_gap         2/0/4/1/0/0         2/0/4/1/0/0         2/0/4/1/0/0           ok
div_parent_gap                3/0/3/1/0/0         3/0/3/1/0/0         3/0/3/1/0/0           ok
div_parent_daughter_gap       1/0/5/1/0/0         1/0/5/1/0/0         1/0/5/1/0/0           ok
div_shifted_one_side_skip     4/0/2/1/0/0         4/0/2/1/0/0         4/0/2/1/0/0           ok
div_1early_end                6/2/1/1/0/0         6/2/1/1/0/0         6/2/1/1/0/0           ok
div_1early_mid                5/2/1/1/0/0         5/2/1/1/0/0         5/2/1/1/0/0           ok
div_2early_end                5/2/1/0/1/1         5/2/1/0/1/1         5/2/1/0/1/1           ok
div_2early_mid                4/2/1/0/1/1         4/2/1/0/1/1         4/2/1/0/1/1           ok
div_1late_end                 6/1/2/1/0/0         6/1/2/1/0/0         6/1/2/1/0/0           ok
div_1late_mid                 5/1/2/1/0/0         5/1/2/1/0/0         5/1/2/1/0/0           ok
div_2late_end                 5/1/3/0/1/1         5/1/3/0/1/1         5/1/3/0/1/1           ok
div_2late_mid                 4/1/3/0/1/1         4/1/3/0/1/1         4/1/3/0/1/1           ok
div_shift_min_match           0/6/7/1/0/0         0/6/7/1/0/0         0/6/7/1/0/0           ok
div_shift_bad_match_pred      0/5/7/0/0/1         0/5/7/0/0/1         0/5/7/0/0/1           ok
div_shift_bad_match_daughter  0/4/7/0/0/1         0/4/7/0/0/1         0/4/7/0/0/1           ok

Errors:
  edge:empty_gt royer: SchemaError: datatypes of join keys don't match - `match_node_id`: i64 on left does not match `node_id`: null on right (and no other type was available to cast to)
  division:empty_gt_div(1) royer: SchemaError: datatypes of join keys don't match - `match_node_id`: i64 on left does not match `node_id`: null on right (and no other type was available to cast to)

44 cases: 0 disagree, 8 differ only via the hand mapping, 2 errored, 34 agree

@msschwartz21
msschwartz21 marked this pull request as ready for review October 21, 2026 17:39
@msschwartz21 msschwartz21 added the 🧪 tests Test case related issues label Oct 21, 2026

@cmalinmayor cmalinmayor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍅

@cmalinmayor
cmalinmayor merged commit 93e095b into feat/swedj Oct 21, 2026
17 of 18 checks passed
@cmalinmayor
cmalinmayor deleted the feat/swedj-refactor branch October 21, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧪 tests Test case related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants