FIX MLKNNClassificationVoter errors possibly due to scipy deprecations
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python, scikit-learn
- Lĩnh vực
- machine-learning, testing
Hướng nghiên cứu
Start with proglearn/tests/test_voter.py, lines 81–104, and the MLKNNClassificationVoter.fit path identified in proglearn/voters.py at line 364. Reproduce test_correct_vote and trace how its labels reach the failing sparse matrix indexing in scikit-multilearn. Done when the test passes with the reported SciPy error resolved.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
My issue is about fixing test errors on MLKNNClassificationVoter.
Reproducing code example:
Error message
__ TestKNNClassificationVoter.TestMLKNNClassificationVoter.test_correct_vote ___
x = 0.0
def isintlike(x):
"""Is x appropriate as an index into a sparse matrix? Returns True
if it can be cast safely to a machine int.
"""
# Fast-path check to eliminate non-scalar values. operator.index would
# catch this case too, but the exception catching is slow.
if np.ndim(x) != 0:
return False
try:
> operator.index(x)
E TypeError: 'numpy.float64' object cannot be interpreted as an integer
venv/lib/python3.9/site-packages/scipy/sparse/_sputils.py:208: TypeError
During handling of the above exception, another exception occurred:
self = <proglearn.tests.test_voter.TestKNNClassificationVoter.TestMLKNNClassificationVoter object at 0x7fb8e1d44130>
def test_correct_vote(self):
# set random seed
np.random.seed(0)
# generate training data and classes
X = np.concatenate(
(
np.random.normal(0, 0.5, (100, 100)),
np.random.normal(1, 0.5, (100, 100)),
)
)
Y = np.concatenate((np.zeros((100, 1)), np.ones((100, 1))))
# train model
mlkcv = MLKNNClassificationVoter(5)
> mlkcv.fit(X, Y)
proglearn/tests/test_voter.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
proglearn/voters.py:364: in fit
self.mlknn_.fit(X_flattened, y_flattened)
venv/lib/python3.9/site-packages/skmultilearn/adapt/mlknn.py:218: in fit
self._cond_prob_true, self._cond_prob_false = self._compute_cond(X, self._label_cache)
venv/lib/python3.9/site-packages/skmultilearn/adapt/mlknn.py:180: in _compute_cond
cn[label, deltas[0, label]] += 1
venv/lib/python3.9/site-packages/scipy/sparse/_lil.py:211: in __getitem__
return IndexMixin.__getitem__(self, key)
venv/lib/python3.9/site-packages/scipy/sparse/_index.py:47: in __getitem__
row, col = self._validate_indices(key)
venv/lib/python3.9/site-packages/scipy/sparse/_index.py:161: in _validate_indices
if isintlike(col):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = 0.0
def isintlike(x):
"""Is x appropriate as an index into a sparse matrix? Returns True
if it can be cast safely to a machine int.
"""
# Fast-path check to eliminate non-scalar values. operator.index would
# catch this case too, but the exception catching is slow.
if np.ndim(x) != 0:
return False
try:
operator.index(x)
except (TypeError, ValueError):
try:
loose_int = bool(int(x) == x)
except (TypeError, ValueError):
return False
if loose_int:
msg = "Inexact indices into sparse matrices are not allowed"
> raise ValueError(msg)
E ValueError: Inexact indices into sparse matrices are not allowed
venv/lib/python3.9/site-packages/scipy/sparse/_sputils.py:216: ValueError
=============================== warnings summary ===============================
venv/lib/python3.9/site-packages/sklearn/utils/multiclass.py:14
/home/circleci/project/venv/lib/python3.9/site-packages/sklearn/utils/multiclass.py:14: DeprecationWarning: Please use `spmatrix` from the `scipy.sparse` namespace, the `scipy.sparse.base` namespace is deprecated.
from scipy.sparse.base import spmatrix
venv/lib/python3.9/site-packages/sklearn/utils/optimize.py:18
/home/circleci/project/venv/lib/python3.9/site-packages/sklearn/utils/optimize.py:18: DeprecationWarning: Please use `line_search_wolfe2` from the `scipy.optimize` namespace, the `scipy.optimize.linesearch` namespace is deprecated.
from scipy.optimize.linesearch import line_search_wolfe2, line_search_wolfe1
venv/lib/python3.9/site-packages/sklearn/utils/optimize.py:18
/home/circleci/project/venv/lib/python3.9/site-packages/sklearn/utils/optimize.py:18: DeprecationWarning: Please use `line_search_wolfe1` from the `scipy.optimize` namespace, the `scipy.optimize.linesearch` namespace is deprecated.
from scipy.optimize.linesearch import line_search_wolfe2, line_search_wolfe1
proglearn/tests/test_voter.py::TestKNNClassificationVoter::TestMLKNNClassificationVoter::test_correct_vote
/home/circleci/project/venv/lib/python3.9/site-packages/sklearn/utils/validation.py:70: FutureWarning: Pass n_neighbors=5 as keyword args. From version 1.0 (renaming of 0.25) passing these as positional arguments will result in an error
warnings.warn(f"Pass {args_msg} as keyword args. From version "
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
------ generated xml file: /home/circleci/project/test-reports/junit.xml -------
---------- coverage: platform linux, python 3.9.13-final-0 -----------
Coverage XML written to file coverage.xml
Version information
- CircleCI Pytest
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 39
- Fork
- 44
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của neurodata/ProgLearn
-
FIX migrate Netlify image from Xenial to FocalCó thể đã có người làm @PSSF23 đã nhận 1550 ngày trước. Đang mở
-
DOC fix typos in model attribute titlesCó thể đã có người làm @PSSF23 đã nhận 1684 ngày trước. Đang mở
-
Investigate combined honest trees + isotonic calibrationCó thể làm lại được @jzheng17 đã nhận 1751 ngày trước và không có pull request nào đang mở. Đang mởndd sklearn
-
ndd
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Scene Segmentation with SynFCó thể làm lại được @amyvanee đã nhận 1853 ngày trước và không có pull request nào đang mở. Đang mởndd
neurodata/ProgLearn#509 · 20 bình luận · 1 người được giao ·
Tất cả issue của neurodata/ProgLearn
Issue tương tự
-
type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
srbhr/Resume-Matcher#1107 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xCó thể đã có người làm @NimaVaziri đã nhận hôm nay. Đang mởPytorch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
lakshaychhaba0001-sys/openbench-ai#230 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày