Skip to content

Fix output dimension in simple_mlp_predict - #24

Merged
rcannood merged 2 commits into
mainfrom
fix/simple-mlp-predict-output-dim
Jul 29, 2026
Merged

Fix output dimension in simple_mlp_predict#24
rcannood merged 2 commits into
mainfrom
fix/simple-mlp-predict-output-dim

Conversation

@rcannood

Copy link
Copy Markdown
Member

Describe your changes

simple_mlp_predict sizes the MLP output layer with input_test_mod1.n_vars -- the source modality's width. But training sizes it with y.shape[1], i.e. train_mod2.n_vars:

net = MLP(X.shape[1], y.shape[1], ymean, config)   # simple_mlp_train

So MLP.load_from_checkpoint(..., out_dim=input_test_mod1.n_vars, ...) raises a state-dict size mismatch on fc3 whenever n_vars(mod1) != n_vars(mod2) -- which is every real dataset (GEX 13953 vs ADT 134). The GEX2ATAC branch has the same mixup: ymean has length n_vars(mod2) but is broadcast against np.ones([n_obs, input_test_mod1.n_vars]).

input_train_mod2 is already read in on line 49, so it's a two-line change.

The reason this never showed up in CI is worth a note: in resources_test the two modalities happen to have identical widths -- 134x134 for bmmc_cite, 1500x1500 for bmmc_multiome -- so viash test can't distinguish n_vars(mod1) from n_vars(mod2) and passes. I'll follow up with a fixture that has unequal widths so this class of bug can't hide again.

Part of a series of PRs coming out of a pre-run review of the benchmark.

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

rcannood added 2 commits July 28, 2026 15:28
The model predicts mod2, so out_dim must be input_train_mod2.n_vars,
not input_test_mod1.n_vars. Same mixup in the GEX2ATAC branch, where
ymean (length n_vars(mod2)) is broadcast against n_vars(mod1).
@rcannood
rcannood merged commit d956cd3 into main Jul 29, 2026
@rcannood
rcannood deleted the fix/simple-mlp-predict-output-dim branch July 29, 2026 09:59
@rcannood rcannood mentioned this pull request Jul 29, 2026
8 tasks
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