Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
0a6b4ab
1
Parent(s):
b2fc69c
Patch scikit-learn to allow complex numbers
Browse files- pysr/__init__.py +1 -0
- pysr/sklearn_monkeypatch.py +13 -0
pysr/__init__.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from .version import __version__
|
2 |
from .sr import (
|
3 |
pysr,
|
|
|
1 |
+
from . import sklearn_monkeypatch
|
2 |
from .version import __version__
|
3 |
from .sr import (
|
4 |
pysr,
|
pysr/sklearn_monkeypatch.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Here, we monkey patch scikit-learn until this
|
2 |
+
# issue is fixed: https://github.com/scikit-learn/scikit-learn/issues/25922
|
3 |
+
from sklearn.utils import validation
|
4 |
+
|
5 |
+
|
6 |
+
def _ensure_no_complex_data(*args, **kwargs):
|
7 |
+
...
|
8 |
+
|
9 |
+
|
10 |
+
try:
|
11 |
+
validation._ensure_no_complex_data = _ensure_no_complex_data
|
12 |
+
except AttributeError:
|
13 |
+
...
|