Skip to content

Commit

Permalink
Merge pull request ASUS-AICS#360 from ntumlgroup/fix-scipy
Browse files Browse the repository at this point in the history
Fixed deprecated/removed scipy API
  • Loading branch information
cjlin1 authored Feb 23, 2024
2 parents 307935e + 764f966 commit 88e59da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libmultilabel/linear/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from array import array
from collections import defaultdict

import numpy as np
import pandas as pd
import scipy
import scipy.sparse as sparse

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

prob_x = scipy.frombuffer(prob_x, dtype="d")
col_idx = scipy.frombuffer(col_idx, dtype="l")
row_ptr = scipy.frombuffer(row_ptr, dtype="l")
prob_x = np.frombuffer(prob_x, dtype="d")
col_idx = np.frombuffer(col_idx, dtype="l")
row_ptr = np.frombuffer(row_ptr, dtype="l")
prob_x = sparse.csr_matrix((prob_x, col_idx, row_ptr))

return {"x": prob_x, "y": prob_y}
Expand Down

0 comments on commit 88e59da

Please sign in to comment.