Skip to content

fix adaptors - #199

Merged
clemsgrs merged 4 commits into
mainfrom
fix-knn-regressor-preprocess-unpack
Jun 9, 2026
Merged

fix adaptors#199
clemsgrs merged 4 commits into
mainfrom
fix-knn-regressor-preprocess-unpack

Conversation

@clemsgrs

@clemsgrs clemsgrs commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes four issues in vision adaptors:

  • KNNRegressor.fit incorrectly unpacked the return value of preprocess_features, which returns a single array.
  • Non-survival LinearProbingRegressor and MultiLayerPerceptronRegressor passed [B] labels to MSELoss against [B, 1] model outputs, causing unintended broadcasting.
  • Survival LinearProbingRegressor and MultiLayerPerceptronRegressor computed cumulative survival along dim=0. During training, logits are [num_shots, nbins], so this ran the cumulative product
    across shots instead of survival bins. This now uses dim=-1.
  • 2D segmentation inference stitched patch predictions with swapped axes. Task 9 image-size is [width, height], while NumPy masks are [height, width]; inference now allocates (height, width),
    writes patches with [y, x] indexing, and no longer transposes the final mask.

Impact

  • the KNNRegressor bug can cause fitting to fail for 3+ shots, or behave incorrectly with exactly 2 shots.

  • the non-survival MSE broadcasting issue is serious for non-survival regression because it changes the objective from per-sample regression to effectively pushing all predictions toward the batch mean label. However, the practical impact should be limited as our sole regression task is a survival prediction task, so we have not used these non-survival regression heads.

  • the survival axis issue affects the training objective for survival regression heads. Prediction did not generally crash because case-level test embeddings are passed one case at a time as a 1D vector, where dim=0 happened to be the bin axis. Training, however, uses all shots as [num_shots, nbins], so the survival/censoring part of the loss was batch-order dependent.

  • the 2D segmentation issue affects segmentation-upsampling for Task 9. On square-ish data this can be partially masked by the final transpose, but local patch content is transposed and non-square images or edge patches can be cropped/placed incorrectly.

@clemsgrs

clemsgrs commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot review the changes in this PR

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown

@copilot review the changes in this PR

I've reviewed the changes in the last 4 commits. No significant issues, bugs, logic errors, or security vulnerabilities were found in the updated code.

@clemsgrs
clemsgrs merged commit c02e70c into main Jun 9, 2026
7 of 10 checks passed
@clemsgrs
clemsgrs deleted the fix-knn-regressor-preprocess-unpack branch June 9, 2026 15:00
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.

2 participants