bs-python-utils 0.9.2__tar.gz → 1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/PKG-INFO +12 -7
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/README.md +9 -4
- bs_python_utils-1.0/bs_python_utils/Timer.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bivariate_quantiles.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_altair.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_logging.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_mathstr.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_mem.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_opt.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_plots.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_seaborn.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bs_sparse_gaussian.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bsmplutils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bsnputils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bssputils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bsstats.py +1 -0
- bs_python_utils-1.0/bs_python_utils/bsutils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/chebyshev.py +1 -0
- bs_python_utils-1.0/bs_python_utils/distance_covariances.py +1 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_altair.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_distance_covariances.py +5 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_mem.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_mpl.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_opt.py +3 -3
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_seaborn.py +5 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_sklearn.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_sparse_gaussian.py +2 -1
- bs_python_utils-1.0/bs_python_utils/pandas_utils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/sklearn_utils.py +1 -0
- bs_python_utils-1.0/bs_python_utils/streamlit_utils.py +1 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils.egg-info/PKG-INFO +12 -7
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils.egg-info/requires.txt +2 -2
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/pyproject.toml +3 -3
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bivariate_quantiles.py +3 -3
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bs_opt.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bs_sparse_gaussian.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bsnputils.py +2 -2
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bssputils.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bsstats.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_bsutils.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_chebyshev.py +3 -3
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_nptri.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_random_draws.py +1 -1
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/tests/test_sklearn_utils.py +4 -3
- bs_python_utils-0.9.2/bs_python_utils/Timer.py +0 -81
- bs_python_utils-0.9.2/bs_python_utils/bivariate_quantiles.py +0 -238
- bs_python_utils-0.9.2/bs_python_utils/bs_altair.py +0 -1111
- bs_python_utils-0.9.2/bs_python_utils/bs_logging.py +0 -168
- bs_python_utils-0.9.2/bs_python_utils/bs_mathstr.py +0 -121
- bs_python_utils-0.9.2/bs_python_utils/bs_mem.py +0 -157
- bs_python_utils-0.9.2/bs_python_utils/bs_opt.py +0 -576
- bs_python_utils-0.9.2/bs_python_utils/bs_plots.py +0 -62
- bs_python_utils-0.9.2/bs_python_utils/bs_seaborn.py +0 -210
- bs_python_utils-0.9.2/bs_python_utils/bs_sparse_gaussian.py +0 -74
- bs_python_utils-0.9.2/bs_python_utils/bsmplutils.py +0 -95
- bs_python_utils-0.9.2/bs_python_utils/bsnputils.py +0 -1221
- bs_python_utils-0.9.2/bs_python_utils/bssputils.py +0 -82
- bs_python_utils-0.9.2/bs_python_utils/bsstats.py +0 -498
- bs_python_utils-0.9.2/bs_python_utils/bsutils.py +0 -410
- bs_python_utils-0.9.2/bs_python_utils/chebyshev.py +0 -550
- bs_python_utils-0.9.2/bs_python_utils/distance_covariances.py +0 -263
- bs_python_utils-0.9.2/bs_python_utils/pandas_utils.py +0 -245
- bs_python_utils-0.9.2/bs_python_utils/sklearn_utils.py +0 -123
- bs_python_utils-0.9.2/bs_python_utils/streamlit_utils.py +0 -100
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/LICENSE +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid1prec13.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid1prec17.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid1prec9.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid2prec13.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid2prec17.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid2prec9.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid3prec13.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid3prec17.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid3prec9.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid4prec13.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid4prec17.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid4prec9.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid5prec13.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid5prec17.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/GaussHermiteSparseGrids/GHsparseGrid5prec9.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/__init__.py +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils.egg-info/SOURCES.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils.egg-info/dependency_links.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils.egg-info/top_level.txt +0 -0
- {bs_python_utils-0.9.2 → bs_python_utils-1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bs-python-utils
|
|
3
|
-
Version: 0
|
|
3
|
+
Version: 1.0
|
|
4
4
|
Summary: Utilities programs for my Python code
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -16,7 +16,7 @@ Requires-Dist: numpy>=2.3.3
|
|
|
16
16
|
Requires-Dist: pandas>=2.3.2
|
|
17
17
|
Requires-Dist: pre-commit>=4.3.0
|
|
18
18
|
Requires-Dist: pytest>=8.4.2
|
|
19
|
-
Requires-Dist: mypy
|
|
19
|
+
Requires-Dist: mypy>=1.18
|
|
20
20
|
Requires-Dist: ruff>=0.14.0
|
|
21
21
|
Requires-Dist: scikit-learn>=1.7.2
|
|
22
22
|
Requires-Dist: scipy>=1.16.2
|
|
@@ -25,16 +25,18 @@ Requires-Dist: statsmodels>=0.14.5
|
|
|
25
25
|
Requires-Dist: streamlit>=1.49.1
|
|
26
26
|
Requires-Dist: vega-datasets>=0.9.0
|
|
27
27
|
Requires-Dist: colorama>=0.4.6
|
|
28
|
-
Requires-Dist: pyarrow>=
|
|
28
|
+
Requires-Dist: pyarrow>=23.0.0
|
|
29
29
|
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
## bs-python-utils
|
|
32
32
|
|
|
33
|
+
[](https://pypi.org/project/bs-python-utils/)
|
|
34
|
+
[](https://github.com/bsalanie/bs-python-utils/releases)
|
|
35
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain)
|
|
36
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/tests.yml?query=branch%3Amain)
|
|
37
|
+
[](https://github.com/bsalanie/bs-python-utils/commits/main)
|
|
33
38
|

|
|
34
|
-
|
|
35
|
-
<!-- [](https://img.shields.io/github/v/release/bsalanie/bs-python-utils) -->
|
|
36
|
-
|
|
37
|
-
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain) <!-- [](https://codecov.io/gh/bsalanie/bs-python-utils) --> <!-- [](https://img.shields.io/github/commit-activity/m/bsalanie/bs-python-utils) --> [](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
39
|
+
[](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
38
40
|
|
|
39
41
|
**My Python utilities**.
|
|
40
42
|
|
|
@@ -43,6 +45,9 @@ Dynamic: license-file
|
|
|
43
45
|
|
|
44
46
|
### Release notes
|
|
45
47
|
|
|
48
|
+
#### 1.0 (May 9, 2026)
|
|
49
|
+
Created subpackages (no change in the API).
|
|
50
|
+
|
|
46
51
|
#### 0.9 (March 18, 2026)
|
|
47
52
|
Improved bivariate quantiles.
|
|
48
53
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
## bs-python-utils
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/bs-python-utils/)
|
|
4
|
+
[](https://github.com/bsalanie/bs-python-utils/releases)
|
|
5
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain)
|
|
6
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/tests.yml?query=branch%3Amain)
|
|
7
|
+
[](https://github.com/bsalanie/bs-python-utils/commits/main)
|
|
3
8
|

|
|
4
|
-
|
|
5
|
-
<!-- [](https://img.shields.io/github/v/release/bsalanie/bs-python-utils) -->
|
|
6
|
-
|
|
7
|
-
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain) <!-- [](https://codecov.io/gh/bsalanie/bs-python-utils) --> <!-- [](https://img.shields.io/github/commit-activity/m/bsalanie/bs-python-utils) --> [](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
9
|
+
[](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
8
10
|
|
|
9
11
|
**My Python utilities**.
|
|
10
12
|
|
|
@@ -13,6 +15,9 @@
|
|
|
13
15
|
|
|
14
16
|
### Release notes
|
|
15
17
|
|
|
18
|
+
#### 1.0 (May 9, 2026)
|
|
19
|
+
Created subpackages (no change in the API).
|
|
20
|
+
|
|
16
21
|
#### 0.9 (March 18, 2026)
|
|
17
22
|
Improved bivariate quantiles.
|
|
18
23
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.core.Timer import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.stats.bivariate_quantiles import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.viz.bs_altair import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.core.bs_logging import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.core.bs_mathstr import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.core.bs_mem import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.opt.bs_opt import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.viz.bs_plots import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.viz.bs_seaborn import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.numerical.bs_sparse_gaussian import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.viz.bsmplutils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.numerical.bsnputils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.numerical.bssputils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.stats.bsstats import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.core.bsutils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.numerical.chebyshev import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.stats.distance_covariances import * # noqa: F401, F403
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
from bs_python_utils.distance_covariances import
|
|
5
|
+
from bs_python_utils.stats.distance_covariances import (
|
|
6
|
+
dcov_dcor,
|
|
7
|
+
pdcov_pdcor,
|
|
8
|
+
pvalue_pdcov,
|
|
9
|
+
)
|
|
6
10
|
|
|
7
11
|
# example page 2396 of Szekely and Rizzo 2014
|
|
8
12
|
n = 2000
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
from bs_python_utils.
|
|
5
|
+
from bs_python_utils.core.bsutils import print_stars
|
|
6
|
+
from bs_python_utils.numerical.bssputils import describe_array
|
|
7
|
+
from bs_python_utils.opt.bs_opt import (
|
|
6
8
|
acc_grad_descent,
|
|
7
9
|
armijo_alpha,
|
|
8
10
|
barzilai_borwein_alpha,
|
|
9
11
|
minimize_some_fixed,
|
|
10
12
|
)
|
|
11
|
-
from bs_python_utils.bssputils import describe_array
|
|
12
|
-
from bs_python_utils.bsutils import print_stars
|
|
13
13
|
|
|
14
14
|
print_stars("Testing acc_grad_descent")
|
|
15
15
|
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
import matplotlib.pyplot as plt
|
|
4
4
|
import seaborn as sns
|
|
5
5
|
|
|
6
|
-
from bs_python_utils.bs_seaborn import
|
|
6
|
+
from bs_python_utils.viz.bs_seaborn import (
|
|
7
|
+
bs_regplot,
|
|
8
|
+
bs_sns_bar_x_byf,
|
|
9
|
+
bs_sns_bar_x_byfg,
|
|
10
|
+
)
|
|
7
11
|
|
|
8
12
|
cars = sns.load_dataset("mpg")
|
|
9
13
|
|
|
@@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
|
|
6
6
|
|
|
7
|
-
from bs_python_utils.sklearn_utils import skl_npreg_lasso
|
|
7
|
+
from bs_python_utils.data_anal.sklearn_utils import skl_npreg_lasso
|
|
8
8
|
|
|
9
9
|
n_obs = 10000
|
|
10
10
|
X1 = -2.0 + 3.0 * np.random.uniform(size=n_obs)
|
{bs_python_utils-0.9.2 → bs_python_utils-1.0}/bs_python_utils/examples/examples_sparse_gaussian.py
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""Integrate x -> x**4 over N(0, 1) using the sparse Gaussian grids."""
|
|
2
2
|
|
|
3
3
|
from typing import cast
|
|
4
|
+
|
|
4
5
|
import numpy as np
|
|
5
6
|
|
|
6
|
-
from bs_python_utils.bs_sparse_gaussian import setup_sparse_gaussian
|
|
7
|
+
from bs_python_utils.numerical.bs_sparse_gaussian import setup_sparse_gaussian
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
def sum_x_to_the_fourth(x: np.ndarray) -> np.ndarray:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.data_anal.pandas_utils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.data_anal.sklearn_utils import * # noqa: F401, F403
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from bs_python_utils.viz.streamlit_utils import * # noqa: F401, F403
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bs-python-utils
|
|
3
|
-
Version: 0
|
|
3
|
+
Version: 1.0
|
|
4
4
|
Summary: Utilities programs for my Python code
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -16,7 +16,7 @@ Requires-Dist: numpy>=2.3.3
|
|
|
16
16
|
Requires-Dist: pandas>=2.3.2
|
|
17
17
|
Requires-Dist: pre-commit>=4.3.0
|
|
18
18
|
Requires-Dist: pytest>=8.4.2
|
|
19
|
-
Requires-Dist: mypy
|
|
19
|
+
Requires-Dist: mypy>=1.18
|
|
20
20
|
Requires-Dist: ruff>=0.14.0
|
|
21
21
|
Requires-Dist: scikit-learn>=1.7.2
|
|
22
22
|
Requires-Dist: scipy>=1.16.2
|
|
@@ -25,16 +25,18 @@ Requires-Dist: statsmodels>=0.14.5
|
|
|
25
25
|
Requires-Dist: streamlit>=1.49.1
|
|
26
26
|
Requires-Dist: vega-datasets>=0.9.0
|
|
27
27
|
Requires-Dist: colorama>=0.4.6
|
|
28
|
-
Requires-Dist: pyarrow>=
|
|
28
|
+
Requires-Dist: pyarrow>=23.0.0
|
|
29
29
|
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
## bs-python-utils
|
|
32
32
|
|
|
33
|
+
[](https://pypi.org/project/bs-python-utils/)
|
|
34
|
+
[](https://github.com/bsalanie/bs-python-utils/releases)
|
|
35
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain)
|
|
36
|
+
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/tests.yml?query=branch%3Amain)
|
|
37
|
+
[](https://github.com/bsalanie/bs-python-utils/commits/main)
|
|
33
38
|

|
|
34
|
-
|
|
35
|
-
<!-- [](https://img.shields.io/github/v/release/bsalanie/bs-python-utils) -->
|
|
36
|
-
|
|
37
|
-
[](https://github.com/bsalanie/bs-python-utils/actions/workflows/main.yml?query=branch%3Amain) <!-- [](https://codecov.io/gh/bsalanie/bs-python-utils) --> <!-- [](https://img.shields.io/github/commit-activity/m/bsalanie/bs-python-utils) --> [](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
39
|
+
[](https://img.shields.io/github/license/bsalanie/bs-python-utils)
|
|
38
40
|
|
|
39
41
|
**My Python utilities**.
|
|
40
42
|
|
|
@@ -43,6 +45,9 @@ Dynamic: license-file
|
|
|
43
45
|
|
|
44
46
|
### Release notes
|
|
45
47
|
|
|
48
|
+
#### 1.0 (May 9, 2026)
|
|
49
|
+
Created subpackages (no change in the API).
|
|
50
|
+
|
|
46
51
|
#### 0.9 (March 18, 2026)
|
|
47
52
|
Improved bivariate quantiles.
|
|
48
53
|
|
|
@@ -9,7 +9,7 @@ numpy>=2.3.3
|
|
|
9
9
|
pandas>=2.3.2
|
|
10
10
|
pre-commit>=4.3.0
|
|
11
11
|
pytest>=8.4.2
|
|
12
|
-
mypy
|
|
12
|
+
mypy>=1.18
|
|
13
13
|
ruff>=0.14.0
|
|
14
14
|
scikit-learn>=1.7.2
|
|
15
15
|
scipy>=1.16.2
|
|
@@ -18,4 +18,4 @@ statsmodels>=0.14.5
|
|
|
18
18
|
streamlit>=1.49.1
|
|
19
19
|
vega-datasets>=0.9.0
|
|
20
20
|
colorama>=0.4.6
|
|
21
|
-
pyarrow>=
|
|
21
|
+
pyarrow>=23.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bs-python-utils"
|
|
3
|
-
version = "0
|
|
3
|
+
version = "1.0"
|
|
4
4
|
description = "Utilities programs for my Python code"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -16,7 +16,7 @@ dependencies = [
|
|
|
16
16
|
"pandas>=2.3.2",
|
|
17
17
|
"pre-commit>=4.3.0",
|
|
18
18
|
"pytest>=8.4.2",
|
|
19
|
-
"mypy",
|
|
19
|
+
"mypy>=1.18",
|
|
20
20
|
"ruff>=0.14.0",
|
|
21
21
|
"scikit-learn>=1.7.2",
|
|
22
22
|
"scipy>=1.16.2",
|
|
@@ -25,7 +25,7 @@ dependencies = [
|
|
|
25
25
|
"streamlit>=1.49.1",
|
|
26
26
|
"vega-datasets>=0.9.0",
|
|
27
27
|
"colorama>=0.4.6",
|
|
28
|
-
"pyarrow>=
|
|
28
|
+
"pyarrow>=23.0.0",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
[tool.setuptools]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
|
-
from bs_python_utils.
|
|
3
|
+
from bs_python_utils.numerical.bsnputils import npmaxabs
|
|
4
|
+
from bs_python_utils.stats.bivariate_quantiles import (
|
|
4
5
|
_compute_ad,
|
|
5
6
|
_solve_for_v,
|
|
6
7
|
)
|
|
7
|
-
from bs_python_utils.bsnputils import npmaxabs
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def test_bivariate_ranks():
|
|
@@ -24,7 +24,7 @@ def test_bivariate_ranks():
|
|
|
24
24
|
y[:, 1] == y[k, 1]
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
assert npmaxabs(bivranks - bivranks_th) < 0.
|
|
27
|
+
assert npmaxabs(bivranks - bivranks_th) < 0.1
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def test_compute_ad():
|
|
@@ -2,7 +2,8 @@ from math import exp, isclose, log, pi, sqrt
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
from bs_python_utils.
|
|
5
|
+
from bs_python_utils.core.bsutils import bsexp, bslog
|
|
6
|
+
from bs_python_utils.numerical.bsnputils import (
|
|
6
7
|
bs_sqrt_pdmatrix,
|
|
7
8
|
bsgrid,
|
|
8
9
|
ecdf,
|
|
@@ -23,7 +24,6 @@ from bs_python_utils.bsnputils import (
|
|
|
23
24
|
print_quantiles,
|
|
24
25
|
rice_stderr,
|
|
25
26
|
)
|
|
26
|
-
from bs_python_utils.bsutils import bsexp, bslog
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def test_print_quantiles_vec():
|
|
@@ -3,9 +3,9 @@ from math import exp, isclose, sqrt
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
|
-
from bs_python_utils.
|
|
7
|
-
from bs_python_utils.
|
|
8
|
-
from bs_python_utils.chebyshev import (
|
|
6
|
+
from bs_python_utils.core.bsutils import bs_error_abort
|
|
7
|
+
from bs_python_utils.numerical.bsnputils import FloatOrArray, bsgrid
|
|
8
|
+
from bs_python_utils.numerical.chebyshev import (
|
|
9
9
|
Interval,
|
|
10
10
|
Rectangle,
|
|
11
11
|
cheb_eval_fun_at_nodes_1d,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
from typing import cast
|
|
2
2
|
|
|
3
3
|
import matplotlib.pyplot as plt
|
|
4
|
+
import numpy as np
|
|
4
5
|
|
|
5
|
-
from bs_python_utils import sklearn_utils
|
|
6
|
+
from bs_python_utils.data_anal import sklearn_utils
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def test_skl_npreg_lasso_returns_predictions_and_model():
|
|
@@ -29,7 +30,7 @@ def test_skl_npreg_lasso_returns_predictions_and_model():
|
|
|
29
30
|
assert model.named_steps["lasso"].fit_intercept is False
|
|
30
31
|
|
|
31
32
|
# ensure pipeline can predict out-of-sample without errors
|
|
32
|
-
preds_new = model.predict(X[:5])
|
|
33
|
+
preds_new = cast(np.ndarray, model.predict(X[:5]))
|
|
33
34
|
assert preds_new.shape == (5,)
|
|
34
35
|
|
|
35
36
|
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Utilities to time code:
|
|
3
|
-
|
|
4
|
-
* a `Timer` class that can be used as a context manager
|
|
5
|
-
* a `timeit` decorator for functions.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import time
|
|
9
|
-
from functools import wraps
|
|
10
|
-
from typing import Any, Callable, Iterable
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def timeit(func: Callable) -> Callable:
|
|
14
|
-
"""
|
|
15
|
-
Decorator to time a function
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
@wraps(func)
|
|
19
|
-
def wrapper(*args: Iterable, **kwargs: dict) -> Any:
|
|
20
|
-
start = time.perf_counter()
|
|
21
|
-
result = func(*args, **kwargs)
|
|
22
|
-
end = time.perf_counter()
|
|
23
|
-
print(f"{func.__name__} executed in {end - start:.3f} seconds")
|
|
24
|
-
return result
|
|
25
|
-
|
|
26
|
-
return wrapper
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Timer:
|
|
30
|
-
"""
|
|
31
|
-
A timer that can be started, stopped, and reset as needed by the user.
|
|
32
|
-
It keeps track of the total elapsed time in the `elapsed` attribute::
|
|
33
|
-
|
|
34
|
-
Examples:
|
|
35
|
-
>>> with Timer() as t:
|
|
36
|
-
>>> ....
|
|
37
|
-
>>> print(f"... took {t.elapsed} seconds")
|
|
38
|
-
|
|
39
|
-
use `Timer(time.process_time)` to get only CPU time.
|
|
40
|
-
|
|
41
|
-
can also do:
|
|
42
|
-
|
|
43
|
-
Examples:
|
|
44
|
-
>>> t = Timer()
|
|
45
|
-
>>> t.start()
|
|
46
|
-
>>> t.stop()
|
|
47
|
-
>>> t.start() # will add to the same counter
|
|
48
|
-
>>> t.stop()
|
|
49
|
-
>>> print(f"{t.elapsed} seconds total")
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
def __init__(self, func: Callable = time.perf_counter) -> None:
|
|
53
|
-
self.elapsed = 0.0
|
|
54
|
-
self._func = func
|
|
55
|
-
self._start = None
|
|
56
|
-
|
|
57
|
-
def start(self) -> None:
|
|
58
|
-
if self._start is not None:
|
|
59
|
-
raise RuntimeError("Already started")
|
|
60
|
-
self._start = self._func()
|
|
61
|
-
|
|
62
|
-
def stop(self) -> None:
|
|
63
|
-
if self._start is None:
|
|
64
|
-
raise RuntimeError("Not started")
|
|
65
|
-
end = self._func()
|
|
66
|
-
self.elapsed += end - self._start
|
|
67
|
-
self._start = None
|
|
68
|
-
|
|
69
|
-
def reset(self) -> None:
|
|
70
|
-
self.elapsed = 0.0
|
|
71
|
-
|
|
72
|
-
@property
|
|
73
|
-
def running(self) -> bool:
|
|
74
|
-
return self._start is not None
|
|
75
|
-
|
|
76
|
-
def __enter__(self) -> Any:
|
|
77
|
-
self.start()
|
|
78
|
-
return self
|
|
79
|
-
|
|
80
|
-
def __exit__(self, *args: Iterable) -> None:
|
|
81
|
-
self.stop()
|