8000 TST Extend tests for `scipy.sparse.*array` in `sklearn/feature_selection/tests/test_mutual_info.py` by brendanlu · Pull Request #27173 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

TST Extend tests for scipy.sparse.*array in sklearn/feature_selection/tests/test_mutual_info.py #27173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sklearn/feature_selection/tests/test_mutual_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pytest
from scipy.sparse import csr_matrix

from sklearn.feature_selection import mutual_info_classif, mutual_info_regression
from sklearn.feature_selection._mutual_info import _compute_mi
Expand All @@ -9,6 +8,7 @@
assert_allclose,
assert_array_equal,
)
from sklearn.utils.fixes import CSR_CONTAINERS


def test_compute_mi_dd():
Expand Down Expand Up @@ -176,12 +176,13 @@ def test_mutual_info_classif_mixed(global_dtype):
assert mi_nn[2] == mi[2]


def test_mutual_info_options(global_dtype):
@pytest.mark.parametrize("csr_container", CSR_CONTAINERS)
def test_mutual_info_options(global_dtype, csr_container):
X = np.array(
[[0, 0, 0], [1, 1, 0], [2, 0, 1], [2, 0, 1], [2, 0, 1]], dtype=global_dtype
)
y = np.array([0, 1, 2, 2, 1], dtype=global_dtype)
X_csr = csr_matrix(X)
X_csr = csr_container(X)

for mutual_info in (mutual_info_regression, mutual_info_classif):
with pytest.raises(ValueError):
Expand Down
0