Repository navigation
Faster load_svmfiles, empty files, tabs, nnz overflow guard (0.5.3) - #12
Merged
Merged
Conversation
- load_svmfiles computed the number of columns with Python's builtin max()
over every index: 2.7 s on rcv1_test (33M values), now ndarray.max().
load_svmfiles goes from 9.7 s to 7.3 s on that file.
- An empty file, or one with labels but no values, failed to load
('unable to infer matrix dimensions', 'max() iterable argument is empty');
it now gives a matrix with 0 columns.
- Tabs count as whitespace around separators and at the end of lines; a
trailing tab was read as an index.
- More than INT_MAX values raises ValueError instead of silently wrapping the
C int indptr.
- load_svmfile closes the file when parsing fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XUT7Yj2eYmEyHV5fiicMsP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XUT7Yj2eYmEyHV5fiicMsP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loader fixes for a 0.5.3 release.
Faster
load_svmfiles. The number of columns came from Python's builtinmax()over every index, which took 2.7 s onrcv1_test.multiclass(518,571 rows, 33.5M values). It now usesndarray.max(). Best of 3 runs, uncompressed file, warm cache, Python 3.13:load_svmfilesload_svmfileEmpty files. An empty file, or one with labels but no values, failed with
unable to infer matrix dimensions(load_svmfile) ormax() iterable argument is empty(load_svmfiles). It now loads as a matrix with 0 columns.load_svmfileshandles an empty file mixed with non-empty ones.Tabs. Tabs count as whitespace around
:and at the end of a line. A trailing tab used to raiseinvalid index.Overflow guard. More than
INT_MAXvalues in one file raisesValueErrorinstead of silently wrapping the Cintindptr. This is not covered by a test, since triggering it needs a file of more than 2³¹ values.load_svmfilecloses the file when parsing fails.Version bumped to 0.5.3. Four new tests: 23 in total.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XUT7Yj2eYmEyHV5fiicMsP