Spaces:
Running
Running
Commit
·
623e6f0
1
Parent(s):
21a0846
Improve documentation for validation function
Browse files- pysr/sr.py +17 -4
pysr/sr.py
CHANGED
|
@@ -950,7 +950,20 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 950 |
else:
|
| 951 |
self.equation_file_ = self.equation_file
|
| 952 |
|
| 953 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 954 |
|
| 955 |
# Immutable parameter validation
|
| 956 |
# Ensure instance parameters are allowable values:
|
|
@@ -1034,7 +1047,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 1034 |
)
|
| 1035 |
return packed_modified_params
|
| 1036 |
|
| 1037 |
-
def
|
| 1038 |
"""
|
| 1039 |
Validates the parameters passed to the :term`fit` method.
|
| 1040 |
|
|
@@ -1504,9 +1517,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 1504 |
|
| 1505 |
self._setup_equation_file()
|
| 1506 |
|
| 1507 |
-
mutated_params = self.
|
| 1508 |
|
| 1509 |
-
X, y, Xresampled, weights, variable_names = self.
|
| 1510 |
X, y, Xresampled, weights, variable_names
|
| 1511 |
)
|
| 1512 |
|
|
|
|
| 950 |
else:
|
| 951 |
self.equation_file_ = self.equation_file
|
| 952 |
|
| 953 |
+
def _validate_and_set_init_params(self):
|
| 954 |
+
"""
|
| 955 |
+
Ensures parameters passed at initialization are valid.
|
| 956 |
+
|
| 957 |
+
Also returns a dictionary of parameters to update from their
|
| 958 |
+
values given at initialization.
|
| 959 |
+
|
| 960 |
+
Returns
|
| 961 |
+
-------
|
| 962 |
+
packed_modified_params : dict
|
| 963 |
+
Dictionary of parameters to modify from their initialized
|
| 964 |
+
values. For example, default parameters are set here
|
| 965 |
+
when a parameter is left set to `None`.
|
| 966 |
+
"""
|
| 967 |
|
| 968 |
# Immutable parameter validation
|
| 969 |
# Ensure instance parameters are allowable values:
|
|
|
|
| 1047 |
)
|
| 1048 |
return packed_modified_params
|
| 1049 |
|
| 1050 |
+
def _validate_and_set_fit_params(self, X, y, Xresampled, weights, variable_names):
|
| 1051 |
"""
|
| 1052 |
Validates the parameters passed to the :term`fit` method.
|
| 1053 |
|
|
|
|
| 1517 |
|
| 1518 |
self._setup_equation_file()
|
| 1519 |
|
| 1520 |
+
mutated_params = self._validate_and_set_init_params()
|
| 1521 |
|
| 1522 |
+
X, y, Xresampled, weights, variable_names = self._validate_and_set_fit_params(
|
| 1523 |
X, y, Xresampled, weights, variable_names
|
| 1524 |
)
|
| 1525 |
|