Skip to content
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

Try to upgrade numpy to 1.22.4 #86

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/python/black
rev: 22.1.0
rev: 24.2.0
hooks:
- id: black
language_version: python3.9
1 change: 1 addition & 0 deletions examples/compare_group_lasso_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
pip install group-lasso
```
"""

import groupyr as gpr
import matplotlib.pyplot as plt
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions examples/plot_balanced_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
scoring shows a modest increase in both F1 score and accuracy.

"""

import numpy as np
from matplotlib import pyplot as plt
from groupyr import LogisticSGLCV
Expand Down
1 change: 1 addition & 0 deletions examples/plot_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ground-truth.

"""

import numpy as np
from matplotlib import pyplot as plt
from groupyr import LogisticSGLCV
Expand Down
1 change: 1 addition & 0 deletions examples/plot_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
the results of a Lasso model.

"""

import groupyr as gpr
import matplotlib.pyplot as plt
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions examples/plot_sgl_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
In practise it is necessary to tune alpha (and l1_ratio) to best fit the
training data.
"""

import groupyr as gpr
import matplotlib.pyplot as plt
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions groupyr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
It provides scikit-learn compatible estimators, including cross-validation
estimators. See https://richford.github.io/groupyr for more details.
"""

from . import datasets # noqa
from . import utils # noqa
from .sgl import * # noqa
Expand Down
1 change: 1 addition & 0 deletions groupyr/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create base classes based on the sparse group lasso."""

import contextlib
import copt as cp
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions groupyr/_prox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Define custom proximal operators for use with copt package."""

from __future__ import absolute_import, division, print_function

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions groupyr/datasets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generate samples of synthetic data sets."""

import numpy as np

from sklearn.datasets import make_classification, make_regression
Expand Down
1 change: 1 addition & 0 deletions groupyr/decomposition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Perform group-wise functional PCA of feature matrices with grouped covariates."""

import inspect
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions groupyr/logistic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create logistic estimators based on the sparse group lasso."""

import contextlib
import logging
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion groupyr/sgl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create regression estimators based on the sparse group lasso."""

import contextlib
import logging
import numpy as np
Expand Down Expand Up @@ -244,7 +245,7 @@ def _alpha_grid(
n_samples = len(y)
if Xy is None:
X = check_array(X, accept_sparse=False, copy=(copy_X and fit_intercept))
X, y, _, _, _ = _preprocess_data(X, y, fit_intercept, normalize, copy=False)
X, y, _, _, _ = _preprocess_data(X, y, fit_intercept=fit_intercept, copy=False)
Xy = safe_sparse_dot(X.T, y, dense_output=True)

if Xy.ndim == 1:
Expand Down
4 changes: 2 additions & 2 deletions groupyr/tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ def test_GroupAggregator():
X_ref = np.array([np.array([1, 4, 7, 9]) + i * 10 for i in range(10)])
assert np.allclose(X_tr, X_ref) # nosec

ga = GroupAggregator(func=["mean", np.max], groups=groups, group_names=group_names)
ga = GroupAggregator(func=["mean", np.amax], groups=groups, group_names=group_names)
X_tr = ga.fit_transform(X)
feature_names_ref = []
for grp in group_names:
feature_names_ref.append("__".join([grp, "mean"]))
feature_names_ref.append("__".join([grp, "max"]))
feature_names_ref.append("__".join([grp, "amax"]))

assert ga.feature_names_out_ == feature_names_ref # nosec
X_ref = np.array([np.array([1, 2, 4, 5, 7, 8, 9, 9]) + i * 10 for i in range(10)])
Expand Down
1 change: 1 addition & 0 deletions groupyr/transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Transform feature matrices with grouped covariates."""

import logging
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions groupyr/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for SGL-based estimators."""

import numpy as np

from collections.abc import Sequence
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ install_requires =
scipy
scikit-optimize==0.9.0
tqdm
numpy>=1.22.4
zip_safe = False
include_package_data = True
packages = find:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A scikit-learn compatible library for penalized regression with grouped data."""

from setuptools import setup
import string
import os.path as op
Expand Down
Loading