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

Build: update numpy version #650

Merged
merged 7 commits into from
Jun 22, 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
12 changes: 3 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ on:
branches:
- '**'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI.yml'
- 'setup.py'
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '*'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI.yml'
- 'setup.py'
- '**'

jobs:
test:
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/CI_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ name: Windows
on:
push:
branches:
- '**'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_Windows.yml'
- 'setup.py'
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '*'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_Windows.yml'
- 'setup.py'
- '**'

jobs:
test:
Expand Down Expand Up @@ -52,7 +46,7 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install pytest nbval "numpy<2.0.0"
pip install .
python -c 'import pysr'
- name: "Run tests"
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/CI_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ name: Docker
on:
push:
branches:
- '**'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_docker.yml'
- 'setup.py'
- 'Dockerfile'
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '*'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_docker.yml'
- 'setup.py'
- 'Dockerfile'
- '**'

jobs:
test:
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/CI_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ name: macOS
on:
push:
branches:
- '**'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_mac.yml'
- 'setup.py'
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '*'
- 'master'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI_mac.yml'
- 'setup.py'
- '**'

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions pysr/export_jax.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np # noqa: F401
import sympy

# Special since need to reduce arguments.
Expand Down
10 changes: 4 additions & 6 deletions pysr/export_torch.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#####
# From https://github.com/patrick-kidger/sympytorch
# Copied here to allow PySR-specific tweaks
#####
# Fork of https://github.com/patrick-kidger/sympytorch

import collections as co
import functools as ft

import numpy as np # noqa: F401
import sympy


Expand Down Expand Up @@ -84,7 +82,7 @@ def _initialize_torch():
}

class _Node(torch.nn.Module):
"""SympyTorch code from https://github.com/patrick-kidger/sympytorch"""
"""Forked from https://github.com/patrick-kidger/sympytorch"""

def __init__(self, *, expr, _memodict, _func_lookup, **kwargs):
super().__init__(**kwargs)
Expand Down Expand Up @@ -156,7 +154,7 @@ def forward(self, memodict):
return self._torch_func(*args)

class _SingleSymPyModule(torch.nn.Module):
"""SympyTorch code from https://github.com/patrick-kidger/sympytorch"""
"""Forked from https://github.com/patrick-kidger/sympytorch"""

def __init__(
self, expression, symbols_in, selection=None, extra_funcs=None, **kwargs
Expand Down
8 changes: 1 addition & 7 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2060,13 +2060,7 @@ def fit(
"Note: you are running with 10 features or more. "
"Genetic algorithms like used in PySR scale poorly with large numbers of features. "
"You should run PySR for more `niterations` to ensure it can find "
"the correct variables, "
"or, alternatively, do a dimensionality reduction beforehand. "
"For example, `X = PCA(n_components=6).fit_transform(X)`, "
"using scikit-learn's `PCA` class, "
"will reduce the number of features to 6 in an interpretable way, "
"as each resultant feature "
"will be a linear combination of the original features. "
"the correct variables, and consider using a larger `maxsize`."
)

# Assertion checks
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sympy>=1.0.0,<2.0.0
pandas>=0.21.0,<3.0.0
numpy>=1.13.0,<2.0.0
numpy>=1.13.0,<3.0.0
scikit_learn>=1.0.0,<2.0.0
juliacall==0.9.20
click>=7.0.0,<9.0.0
Expand Down
Loading