You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use anaconda to manage my Python pkgs. But conda install -c conda-forge pysr failed to install pysr because it spent lots of time on solving environment. Thus I installed Julia and pysr with pip in conda prompt.
However, when running demos in Quickstart section of README.md, an error occurred. TypeError: _check_feature_names_in() got an unexpected keyword argument 'generate_names'
Version
0.15.0
Operating System
Windows
Package Manager
pip
Interface
IPython Terminal
Relevant log output
raceback (most recent call last):
File "E:/PCprofessional/PyCharm 2022.2.3/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "E:\PCprofessional\PyCharm 2022.2.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "F:\MasterDegreeCode\EnDeCoder\symboltest.py", line 17, in<module>
model.fit(X, y)
File "E:\CondaFolder\envs\Symbol\lib\site-packages\pysr\sr.py", line 1910, in fit
X, y, Xresampled, weights, variable_names, X_units, y_units
File "E:\CondaFolder\envs\Symbol\lib\site-packages\pysr\sr.py", line 1442, in _validate_and_set_fit_params
self, variable_names, generate_names=False
TypeError: _check_feature_names_in() got an unexpected keyword argument 'generate_names'
Extra Info
Here is the script.
import numpy as np
import pysr
from pysr import PySRRegressor
#%%
X = 2 * np.random.randn(100, 5)
y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5
from pysr import PySRRegressor
model = PySRRegressor(
niterations=40, # < Increase me for better results
binary_operators=["+", "*"],
unary_operators=[
"cos",
"exp",
"sin",
"inv(x) = 1/x",
# ^ Custom operator (julia syntax)
],
extra_sympy_mappings={"inv": lambda x: 1 / x},
# ^ Define operator for SymPy as well
loss="loss(prediction, target) = (prediction - target)^2",
# ^ Custom loss function (julia syntax)
)
model.fit(X, y)
print(model)
I created a new anaconda env and installed pysr in it. Both the envs throw the same error. I have run pysr.install() in these two envs before running the script above.
I used Debug in Pycharm and found that function _check_feature_names_in defined in \Lib\site-packages\sklearn\utils\validation.py only has input_features=None.
When generate_names=False in _check_feature_names_in(line 1441 in \Lib\site-packages\pysr\sr.py) is commented, the script runs normally. And I got the following results.
I wonder whether there are something wrong with my pkgs or project structures. Looking forward to your reply.
Besides, when I add print(model.latex_table(precision=3, include_score=True)) at the end of the above script, an error occurred. TypeError: latex_table() got an unexpected keyword argument 'include_score'
I just started learning programming, and my English is not very proficient. Please forgive me if I have offended or made low-level mistakes.
Best,
Ker
The text was updated successfully, but these errors were encountered:
Thanks very much for the bug report. This looks like the scikit-learn version being installed is out-of-date, so I either need to implement a version requirement, or need to add a fallback method.
Hi Miles Cranmer. pysr runs normally after upgrading to 0.15.1 with pip. However, I encountered these warnings .
`UserWarning: `torch` was loaded before the Julia instance started. This may cause a segfault when running `PySRRegressor.fit`. To avoid this, please run `pysr.julia_helpers.init_julia()` *before* importing `torch`. For updates, see https://github.com/pytorch/pytorch/issues/78829
"`torch` was loaded before the Julia instance started. "`
`E:\CondaFolder\envs\env_one\lib\site-packages\pysr\julia_helpers.py:209: UserWarning: Your system's Python library is static (e.g., conda), so precompilation will be turned off. For a dynamic library, try using `pyenv` and installing with `--enable-shared`: https://github.com/pyenv/pyenv/blob/master/plugins/python-build/README.md#building-with---enable-shared.
"Your system's Python library is static (e.g., conda), so precompilation will be turned off. For a dynamic library, try using `pyenv` and installing with `--enable-shared`: https://github.com/pyenv/pyenv/blob/master/plugins/python-build/README.md#building-with---enable-shared."`
It provides detailed info, and I am confident to handle these. Thank you for developing pysr and fixing the bug so quickly~
What happened?
I use anaconda to manage my Python pkgs. But
conda install -c conda-forge pysr
failed to installpysr
because it spent lots of time on solving environment. Thus I installed Julia andpysr
with pip in conda prompt.However, when running demos in Quickstart section of README.md, an error occurred.
TypeError: _check_feature_names_in() got an unexpected keyword argument 'generate_names'
Version
0.15.0
Operating System
Windows
Package Manager
pip
Interface
IPython Terminal
Relevant log output
Extra Info
Here is the script.
I created a new anaconda env and installed pysr in it. Both the envs throw the same error. I have run
pysr.install()
in these two envs before running the script above.I used
Debug
in Pycharm and found that function_check_feature_names_in
defined in\Lib\site-packages\sklearn\utils\validation.py
only hasinput_features=None
.When
generate_names=False
in_check_feature_names_in
(line 1441 in \Lib\site-packages\pysr\sr.py) is commented, the script runs normally. And I got the following results.I wonder whether there are something wrong with my pkgs or project structures. Looking forward to your reply.
Besides, when I add
print(model.latex_table(precision=3, include_score=True))
at the end of the above script, an error occurred.TypeError: latex_table() got an unexpected keyword argument 'include_score'
I just started learning programming, and my English is not very proficient. Please forgive me if I have offended or made low-level mistakes.
Best,
Ker
The text was updated successfully, but these errors were encountered: