Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
102209f
1
Parent(s):
3c4ee8e
More helpful common error messages
Browse files- pysr/sr.py +15 -2
- setup.py +1 -1
pysr/sr.py
CHANGED
@@ -259,6 +259,7 @@ def pysr(X=None, y=None, weights=None,
|
|
259 |
|
260 |
_check_assertions(X, binary_operators, unary_operators,
|
261 |
use_custom_variable_names, variable_names, weights, y)
|
|
|
262 |
|
263 |
|
264 |
if len(X) > 10000 and not batching:
|
@@ -665,6 +666,19 @@ def _check_assertions(X, binary_operators, unary_operators, use_custom_variable_
|
|
665 |
if use_custom_variable_names:
|
666 |
assert len(variable_names) == X.shape[1]
|
667 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
|
669 |
def run_feature_selection(X, y, select_k_features):
|
670 |
"""Use a gradient boosting tree regressor as a proxy for finding
|
@@ -703,8 +717,7 @@ def get_hof(equation_file=None, n_features=None, variable_names=None,
|
|
703 |
try:
|
704 |
output = pd.read_csv(str(equation_file) + '.bkup', sep="|")
|
705 |
except FileNotFoundError:
|
706 |
-
|
707 |
-
return pd.DataFrame()
|
708 |
|
709 |
scores = []
|
710 |
lastMSE = None
|
|
|
259 |
|
260 |
_check_assertions(X, binary_operators, unary_operators,
|
261 |
use_custom_variable_names, variable_names, weights, y)
|
262 |
+
_check_for_julia_installation()
|
263 |
|
264 |
|
265 |
if len(X) > 10000 and not batching:
|
|
|
666 |
if use_custom_variable_names:
|
667 |
assert len(variable_names) == X.shape[1]
|
668 |
|
669 |
+
def _check_for_julia_installation():
|
670 |
+
try:
|
671 |
+
process = subprocess.Popen(["julia", "-v"], stdout=subprocess.PIPE, bufsize=-1)
|
672 |
+
while True:
|
673 |
+
line = process.stdout.readline()
|
674 |
+
if not line: break
|
675 |
+
process.stdout.close()
|
676 |
+
process.wait()
|
677 |
+
except FileNotFoundError:
|
678 |
+
import os
|
679 |
+
raise ModuleNotFoundError(f"Your current $PATH is: {os.environ['PATH']}\nPySR could not start julia. Make sure julia is installed and on your $PATH.")
|
680 |
+
process.kill()
|
681 |
+
|
682 |
|
683 |
def run_feature_selection(X, y, select_k_features):
|
684 |
"""Use a gradient boosting tree regressor as a proxy for finding
|
|
|
717 |
try:
|
718 |
output = pd.read_csv(str(equation_file) + '.bkup', sep="|")
|
719 |
except FileNotFoundError:
|
720 |
+
raise RuntimeError("Couldn't find equation file! The equation search likely exited before a single iteration completed.")
|
|
|
721 |
|
722 |
scores = []
|
723 |
lastMSE = None
|
setup.py
CHANGED
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
-
version="0.5.16-
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
+
version="0.5.16-2",
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|