From 32edd37ef7f67df00b81ff23b97a313cb92da2d7 Mon Sep 17 00:00:00 2001 From: sammer1107 Date: Wed, 16 Aug 2023 16:31:35 +0800 Subject: [PATCH] Fix read_svm_format when no label --- libmultilabel/linear/data_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultilabel/linear/data_utils.py b/libmultilabel/linear/data_utils.py index 165ea90b..64eb94c6 100644 --- a/libmultilabel/linear/data_utils.py +++ b/libmultilabel/linear/data_utils.py @@ -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():