Skip to content

Commit

Permalink
Merge pull request #327 from ntumlgroup/fix_no_label
Browse files Browse the repository at this point in the history
Fix read_svm_format when no label is associated with an example
  • Loading branch information
cjlin1 authored Sep 2, 2023
2 parents c93b1ed + 32edd37 commit 415d212
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmultilabel/linear/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def _read_libsvm_format(file_path: str) -> dict[str, list[list[int]] | sparse.cs
m = pattern.fullmatch(line)
try:
labels = m[1]
int_labels = [int(s) for s in labels.split(",")]
prob_y.append(int_labels if labels else [])
int_labels = [int(s) for s in labels.split(",")] if labels else []
prob_y.append(int_labels)
features = m[2] or ""
nz = 0
for e in features.split():
Expand Down

0 comments on commit 415d212

Please sign in to comment.