-
-
Notifications
You must be signed in to change notification settings - Fork 24
✨ stats: improve zscore and gzscore
#816
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
Changes from 2 commits
593f6c3
3ac1b7a
0fb2e32
5ee69f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # type-tests for `zscore` from `stats/_stats_py.pyi` | ||
|
|
||
| from typing import assert_type | ||
|
|
||
| import numpy as np | ||
| import optype.numpy as onp | ||
|
|
||
| from scipy.stats import zscore | ||
|
|
||
| py_i_1d: list[int] | ||
| py_i_2d: list[list[int]] | ||
|
|
||
| py_f_1d: list[float] | ||
| py_f_2d: list[list[float]] | ||
|
|
||
| bool_1d: onp.Array1D[np.bool_] | ||
| bool_2d: onp.Array2D[np.bool_] | ||
|
|
||
| i16_1d: onp.Array1D[np.int16] | ||
| i16_2d: onp.Array2D[np.int16] | ||
|
|
||
| f32_1d: onp.Array1D[np.float32] | ||
| f32_2d: onp.Array2D[np.float32] | ||
|
|
||
| f64_1d: onp.Array1D[np.float64] | ||
| f64_2d: onp.Array2D[np.float64] | ||
|
|
||
| c64_1d: onp.Array1D[np.complex64] | ||
| c64_2d: onp.Array2D[np.complex64] | ||
|
|
||
| c128_1d: onp.Array1D[np.complex128] | ||
| c128_2d: onp.Array2D[np.complex128] | ||
|
|
||
| ### | ||
|
|
||
| assert_type(zscore(py_i_1d), onp.Array1D[np.float64]) | ||
| assert_type(zscore(py_f_1d), onp.Array1D[np.float64]) | ||
| assert_type(zscore(bool_1d), onp.Array1D[np.float64]) | ||
|
Check failure on line 38 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(i16_1d), onp.Array1D[np.float64]) | ||
|
Check failure on line 39 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(f32_1d), onp.Array1D[np.float32]) | ||
|
Check failure on line 40 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(f64_1d), onp.Array1D[np.float64]) | ||
|
Check failure on line 41 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(c64_1d), onp.Array1D[np.complex64]) | ||
|
Check failure on line 42 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(c128_1d), onp.Array1D[np.complex128]) | ||
|
Check failure on line 43 in tests/stats/test_zscore.pyi
|
||
|
|
||
| assert_type(zscore(py_i_2d), onp.Array2D[np.float64]) | ||
| assert_type(zscore(py_f_2d), onp.Array2D[np.float64]) | ||
| assert_type(zscore(bool_2d), onp.Array2D[np.float64]) | ||
|
Check failure on line 47 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(i16_2d), onp.Array2D[np.float64]) | ||
|
Check failure on line 48 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(f32_2d), onp.Array2D[np.float32]) | ||
|
Check failure on line 49 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(f64_2d), onp.Array2D[np.float64]) | ||
|
Check failure on line 50 in tests/stats/test_zscore.pyi
|
||
| assert_type(zscore(c64_2d), onp.Array2D[np.complex64]) | ||
| assert_type(zscore(c128_2d), onp.Array2D[np.complex128]) | ||
|
|
||
| assert_type(zscore(py_i_1d, axis=None), onp.Array1D[np.float64]) | ||
| assert_type(zscore(py_f_1d, axis=None), onp.Array1D[np.float64]) | ||
| assert_type(zscore(bool_1d, axis=None), onp.Array1D[np.float64]) | ||
| assert_type(zscore(i16_1d, axis=None), onp.Array1D[np.float64]) | ||
| assert_type(zscore(f32_1d, axis=None), onp.Array1D[np.float32]) | ||
| assert_type(zscore(f64_1d, axis=None), onp.Array1D[np.float64]) | ||
| assert_type(zscore(c64_1d, axis=None), onp.Array1D[np.complex64]) | ||
| assert_type(zscore(c128_1d, axis=None), onp.Array1D[np.complex128]) | ||
|
|
||
| assert_type(zscore(py_i_2d, axis=None), onp.Array2D[np.float64]) | ||
| assert_type(zscore(py_f_2d, axis=None), onp.Array2D[np.float64]) | ||
| assert_type(zscore(bool_2d, axis=None), onp.Array2D[np.float64]) | ||
| assert_type(zscore(i16_2d, axis=None), onp.Array2D[np.float64]) | ||
| assert_type(zscore(f32_2d, axis=None), onp.Array2D[np.float32]) | ||
| assert_type(zscore(f64_2d, axis=None), onp.Array2D[np.float64]) | ||
| assert_type(zscore(c64_2d, axis=None), onp.Array2D[np.complex64]) | ||
| assert_type(zscore(c128_2d, axis=None), onp.Array2D[np.complex128]) | ||
Uh oh!
There was an error while loading. Please reload this page.