Skip to content

Commit

Permalink
Merge pull request #650 from MilesCranmer/deps-update
Browse files Browse the repository at this point in the history
Build: update numpy version
  • Loading branch information
MilesCranmer committed Jun 22, 2024
2 parents b465512 + 1806f6b commit 1327c58
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 56 deletions.
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 @@ -161,7 +159,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

0 comments on commit 1327c58

Please sign in to comment.