Skip to content

v1.5.1: Fix do_predict crash when a test batch holds a single example (#127)

Latest

Choose a tag to compare

@github-actions github-actions released this 23 Nov 19:33
· 1 commit to main since this release
0214b04
do_predict flattened each batch with .squeeze(). For a batch of one example this turns person_id,
index_date, logits and labels into scalars: iterating over the timestamps raises
"TypeError: 'float' object is not iterable", the fallback then raises "object of type 'float' has no
len()", and building the prediction DataFrame from scalars would fail as well. Use .reshape(-1), which
keeps a 1-D array for any batch size and gives the same result for batches of two or more.

Seen in MEDS-DEV's integration tests, where small demo datasets can leave a single test example.


Claude-Session: https://claude.ai/code/session_01NJQdbGWvxMLCYYDmaTniS4

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>