This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Context: the new `global_dtype` fixture and `SKLEARN_RUN_FLOAT32_TESTS` environment variable | |
Introduction of low-level computational routines for 32bit motivated an extension of tests to run them on 32bit. | |
In this regards, https://github.com/scikit-learn/scikit-learn/pull/22690 introduced a new `global_dtype` fixture as well has the `SKLEARN_RUN_FLOAT32_TESTS` env. variable to make it possible to run the test on 32bit data. | |
Running test on 32bit can be done using `SKLEARN_RUN_FLOAT32_TESTS=1`. | |
For instance, this run the first `global_dtype`-parametrised test: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import sys | |
from time import perf_counter | |
from threadpoolctl import threadpool_limits | |
from sklearn.datasets import make_blobs | |
from sklearn.model_selection import train_test_split | |
from sklearn.neighbors import NearestNeighbors | |
from joblib import Memory | |
import pandas as pd | |
import matplotlib.pyplot as plt |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================= test session starts ============================== | |
platform darwin -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 -- /Users/ogrisel/mambaforge/envs/crash-scipy-dev/bin/python | |
cachedir: .pytest_cache | |
rootdir: /Users/ogrisel | |
collecting ... collected 47225 items | |
mambaforge/envs/crash-scipy-dev/lib/python3.9/site-packages/scipy/_build_utils/tests/test_scipy_version.py::test_valid_scipy_version PASSED [ 0%] | |
mambaforge/envs/crash-scipy-dev/lib/python3.9/site-packages/scipy/_lib/tests/test__gcutils.py::test_set_gc_state PASSED [ 0%] | |
mambaforge/envs/crash-scipy-dev/lib/python3.9/site-packages/scipy/_lib/tests/test__gcutils.py::test_gc_state PASSED [ 0%] | |
mambaforge/envs/crash-scipy-dev/lib/python3.9/site-packages/scipy/_lib/tests/test__gcutils.py::test_assert_deallocated PASSED [ 0%] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from subprocess import check_output | |
import threadpoolctl | |
from pprint import pprint | |
from time import perf_counter | |
from pathlib import Path | |
import sklearn | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.datasets import make_classification | |
from sklearn.model_selection import train_test_split |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from subprocess import check_output | |
import threadpoolctl | |
from pprint import pprint | |
from time import perf_counter | |
from pathlib import Path | |
import sklearn | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.datasets import make_classification | |
from sklearn.model_selection import train_test_split |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
___________________________________________ TestUfuncGenericLoops.test_unary_PyUFunc_O_O_method_full[reciprocal] ____________________________________________ | |
self = <numpy.core.tests.test_ufunc.TestUfuncGenericLoops object at 0x15b5324f0>, ufunc = <ufunc 'reciprocal'> | |
@pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS) | |
def test_unary_PyUFunc_O_O_method_full(self, ufunc): | |
"""Compare the result of the object loop with non-object one""" | |
val = np.float64(np.pi/4) | |
class MyFloat(np.float64): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running from numpy source directory. | |
Processing numpy/random/_bounded_integers.pxd.in | |
Processing numpy/random/_philox.pyx | |
Processing numpy/random/_bounded_integers.pyx.in | |
Processing numpy/random/_sfc64.pyx | |
Processing numpy/random/_mt19937.pyx | |
Processing numpy/random/bit_generator.pyx | |
Processing numpy/random/mtrand.pyx | |
Processing numpy/random/_generator.pyx | |
Processing numpy/random/_pcg64.pyx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
import numpy as np | |
from numpy.random import sample | |
from numpy.testing import assert_allclose | |
from sklearn.preprocessing import scale | |
from sklearn.datasets import make_regression | |
from sklearn.model_selection import train_test_split | |
from scipy.optimize import fmin_l_bfgs_b, check_grad | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.utils.extmath import _incremental_mean_and_var | |
from sklearn.utils.sparsefuncs import _incr_mean_var_axis0 | |
from sklearn.utils.sparsefuncs import _csc_mean_var_axis0 | |
from sklearn.utils.sparsefuncs import _csr_mean_var_axis0 | |
from scipy.sparse import csr_matrix | |
from scipy.sparse import csc_matrix | |
for dtype in [np.float64, np.float32]: | |
print(f"## dtype={dtype.__name__}") |