Skip to content

Commit 295c3e5

Browse files
PicoCentauricajchristianChristian Jorgensenrosecers
authored
Update to latest versions of sklearn and scipy (#239)
* Fixed `_ndim_coords_from_arrays` import * Adding `validate_data` calls and tags for CUR, FPS, PCovCUR, and PCovFPS * Adding `validate_data` calls and updated tags to Ridge2FoldCV * Added `validate_data` calls to PCovR * Added `validate_data` calls to KPCovR * Fixing linting * Fix rendering issues and depencies * update pyproject.toml * fix some tests * update runners * fix docs * lint plus warnings as errors * update infra * Updates to fix sklearn branch (#241) * replacing `self._validate_data` with `validate_data` * Additional fixes * Fixing scikit-learn warnings * Fixing PCovR to work with 1D column vectors * Fixing examples * Changing shape of y in pcovr tests * Fixing PCovR to not mess with data shape --------- Co-authored-by: Christian Jorgensen <[email protected]> * Update pyproject.toml Co-authored-by: Rose K. Cersonsky <[email protected]> * Removing print statement in tests/test_kernel_pcovr.py Co-authored-by: Rose K. Cersonsky <[email protected]> * Fixing artifact in WHO example * Adding test for incorrect score threshold type * Updating test * Fixing validation checks in CUR + FPS * Fix linting * Update coverage collection * Update changelog --------- Co-authored-by: cajchristian <[email protected]> Co-authored-by: Christian Jorgensen <[email protected]> Co-authored-by: Rose K. Cersonsky <[email protected]>
1 parent 0b3cc24 commit 295c3e5

27 files changed

+246
-147
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: "3.12"
18+
python-version: "3.13"
1919

2020
- name: install tests dependencies
2121
run: python -m pip install tox

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: setup Python
1717
uses: actions/setup-python@v5
1818
with:
19-
python-version: "3.12"
19+
python-version: "3.13"
2020

2121
- name: install tests dependencies
2222
run: python -m pip install tox

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Python
1515
uses: actions/setup-python@v5
1616
with:
17-
python-version: "3.12"
17+
python-version: "3.13"
1818

1919
- name: install tests dependencies
2020
run: python -m pip install tox

.github/workflows/tests.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-22.04, macos-14, windows-2022]
15-
python-version: ["3.9", "3.12"]
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python-version: ["3.10", "3.13"]
1616

1717
steps:
1818
- uses: actions/checkout@v4
@@ -23,10 +23,12 @@ jobs:
2323
python-version: ${{ matrix.python-version }}
2424

2525
- name: install tests dependencies
26-
run: python -m pip install tox
26+
run: python -m pip install tox coverage[toml]
2727

2828
- name: run Python tests
29-
run: tox -e tests
29+
run: |
30+
tox -e tests
31+
coverage xml
3032
3133
- name: upload to codecov.io
3234
uses: codecov/codecov-action@v5

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.coverage*
12
*.pyc
23
*.ipynb_checkpoints*
34
__pycache__

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ version: 2
77

88
# Set the version of Python and other tools we need
99
build:
10-
os: ubuntu-22.04
10+
os: ubuntu-lts-latest
1111
tools:
12-
python: "3.12"
12+
python: "3.13"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The rules for CHANGELOG file:
1313

1414
0.3.0 (XXXX/XX/XX)
1515
------------------
16+
- Update to sklearn >= 1.6.0 and scipy >= 1.15.0 (#239)
17+
- Fixed moved function import from scipy and bump scipy dependency to 1.15.0 (#236)
1618
- Fix rendering issues for `SparseKDE` and `QuickShift` (#236)
1719
- Updating ``FPS`` to allow a numpy array of ints as an initialize parameter (#145)
1820
- Supported Python versions are now ranging from 3.9 - 3.12.

examples/pcovr/PCovR-WHODataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
r_pcovr = Ridge(alpha=1e-4, fit_intercept=False, random_state=0).fit(
110110
T_train_pcovr, y_train
111111
)
112-
yp_pcovr = r_pcovr.predict(T_test_pcovr)
112+
yp_pcovr = r_pcovr.predict(T_test_pcovr).reshape(-1, 1)
113113

114114
plt.scatter(y_scaler.inverse_transform(y_test), y_scaler.inverse_transform(yp_pcovr))
115115
r_pcovr.score(T_test_pcovr, y_test)
@@ -128,7 +128,7 @@
128128
T_pca = pca.transform(X)
129129

130130
r_pca = Ridge(alpha=1e-4, fit_intercept=False, random_state=0).fit(T_train_pca, y_train)
131-
yp_pca = r_pca.predict(T_test_pca)
131+
yp_pca = r_pca.predict(T_test_pca).reshape(-1, 1)
132132

133133
plt.scatter(y_scaler.inverse_transform(y_test), y_scaler.inverse_transform(yp_pca))
134134
r_pca.score(T_test_pca, y_test)

examples/pcovr/PCovR.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
)
5151
pcovr.fit(X_scaled, y_scaled)
5252
T = pcovr.transform(X_scaled)
53-
yp = y_scaler.inverse_transform(pcovr.predict(X_scaled))
53+
yp = y_scaler.inverse_transform(pcovr.predict(X_scaled).reshape(-1, 1))
5454

5555
fig, ((axT, axy), (caxT, caxy)) = plt.subplots(
5656
2, 2, figsize=(8, 5), gridspec_kw=dict(height_ratios=(1, 0.1))
@@ -90,7 +90,7 @@
9090
)
9191
pcovr.fit(X_scaled, y_scaled)
9292
T = pcovr.transform(X_scaled)
93-
yp = y_scaler.inverse_transform(pcovr.predict(X_scaled))
93+
yp = y_scaler.inverse_transform(pcovr.predict(X_scaled).reshape(-1, 1))
9494

9595
axes[0, i].scatter(
9696
T[:, 0], T[:, 1], s=50, alpha=0.8, c=y, cmap=cmapX, edgecolor="k"
@@ -136,7 +136,7 @@
136136
)
137137
kpcovr.fit(X_scaled, y_scaled)
138138
T = kpcovr.transform(X_scaled)
139-
yp = y_scaler.inverse_transform(kpcovr.predict(X_scaled))
139+
yp = y_scaler.inverse_transform(kpcovr.predict(X_scaled).reshape(-1, 1))
140140

141141
fig, ((axT, axy), (caxT, caxy)) = plt.subplots(
142142
2, 2, figsize=(8, 5), gridspec_kw=dict(height_ratios=(1, 0.1))

examples/pcovr/PCovR_Regressors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
mixing = 0.5
2525

2626
X, y = load_diabetes(return_X_y=True)
27-
y = y.reshape(X.shape[0], -1)
2827

2928
X_scaler = StandardScaler()
3029
X_scaled = X_scaler.fit_transform(X)
3130

3231
y_scaler = StandardScaler()
33-
y_scaled = y_scaler.fit_transform(y)
32+
y_scaled = y_scaler.fit_transform(y.reshape(-1, 1))
3433

3534

3635
# %%

0 commit comments

Comments
 (0)