Skip to content

Commit 415d212

Browse files
authored
Merge pull request #327 from ntumlgroup/fix_no_label
Fix read_svm_format when no label is associated with an example
2 parents c93b1ed + 32edd37 commit 415d212

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libmultilabel/linear/data_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def _read_libsvm_format(file_path: str) -> dict[str, list[list[int]] | sparse.cs
5757
m = pattern.fullmatch(line)
5858
try:
5959
labels = m[1]
60-
int_labels = [int(s) for s in labels.split(",")]
61-
prob_y.append(int_labels if labels else [])
60+
int_labels = [int(s) for s in labels.split(",")] if labels else []
61+
prob_y.append(int_labels)
6262
features = m[2] or ""
6363
nz = 0
6464
for e in features.split():

0 commit comments

Comments
 (0)