Skip to content

Commit 88e59da

Browse files
authored
Merge pull request #360 from ntumlgroup/fix-scipy
Fixed deprecated/removed scipy API
2 parents 307935e + 764f966 commit 88e59da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libmultilabel/linear/data_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from array import array
77
from collections import defaultdict
88

9+
import numpy as np
910
import pandas as pd
10-
import scipy
1111
import scipy.sparse as sparse
1212

1313
__all__ = ["load_dataset"]
@@ -78,9 +78,9 @@ def _read_libsvm_format(file_path: str) -> dict[str, list[list[int]] | sparse.cs
7878
except:
7979
raise ValueError(f"invalid svm format at line {i + 1} of the file '{file_path}'")
8080

81-
prob_x = scipy.frombuffer(prob_x, dtype="d")
82-
col_idx = scipy.frombuffer(col_idx, dtype="l")
83-
row_ptr = scipy.frombuffer(row_ptr, dtype="l")
81+
prob_x = np.frombuffer(prob_x, dtype="d")
82+
col_idx = np.frombuffer(col_idx, dtype="l")
83+
row_ptr = np.frombuffer(row_ptr, dtype="l")
8484
prob_x = sparse.csr_matrix((prob_x, col_idx, row_ptr))
8585

8686
return {"x": prob_x, "y": prob_y}

0 commit comments

Comments
 (0)