Skip to content

Commit

Permalink
Clarify docstring for nout_ > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jul 9, 2022
1 parent fb6cbfb commit 022f0e5
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,10 +921,11 @@ def get_best(self, index=None):
Parameters
----------
index : int, default=None
index : int | list[int], default=None
If you wish to select a particular equation from `self.equations_`,
give the row number here. This overrides the :param`model_selection`
parameter.
parameter. If there are multiple output features, then pass
a list of indices with the order the same as the output feature.
Returns
-------
Expand All @@ -942,7 +943,9 @@ def get_best(self, index=None):

if index is not None:
if isinstance(self.equations_, list):
assert isinstance(index, list)
assert isinstance(
index, list
), "With multiple output features, index must be a list."
return [eq.iloc[i] for eq, i in zip(self.equations_, index)]
return self.equations_.iloc[index]

Expand Down Expand Up @@ -1634,9 +1637,11 @@ def predict(self, X, index=None):
X : {ndarray | pandas.DataFrame} of shape (n_samples, n_features)
Training data.
index : int, default=None
index : int | list[int], default=None
If you want to compute the output of an expression using a
particular row of `self.equations_`, you may specify the index here.
For multiple output equations, you must pass a list of indices
in the same order.
Returns
-------
Expand Down Expand Up @@ -1698,10 +1703,12 @@ def sympy(self, index=None):
Parameters
----------
index : int, default=None
index : int | list[int], default=None
If you wish to select a particular equation from
`self.equations_`, give the index number here. This overrides
the `model_selection` parameter.
the `model_selection` parameter. If there are multiple output
features, then pass a list of indices with the order the same
as the output feature.
Returns
-------
Expand All @@ -1720,10 +1727,12 @@ def latex(self, index=None):
Parameters
----------
index : int, default=None
index : int | list[int], default=None
If you wish to select a particular equation from
`self.equations_`, give the index number here. This overrides
the `model_selection` parameter.
the `model_selection` parameter. If there are multiple output
features, then pass a list of indices with the order the same
as the output feature.
Returns
-------
Expand All @@ -1746,10 +1755,12 @@ def jax(self, index=None):
Parameters
----------
index : int, default=None
index : int | list[int], default=None
If you wish to select a particular equation from
`self.equations_`, give the row number here. This overrides
the `model_selection` parameter.
`self.equations_`, give the index number here. This overrides
the `model_selection` parameter. If there are multiple output
features, then pass a list of indices with the order the same
as the output feature.
Returns
-------
Expand All @@ -1775,10 +1786,12 @@ def pytorch(self, index=None):
Parameters
----------
index : int, default=None
index : int | list[int], default=None
If you wish to select a particular equation from
`self.equations_`, give the row number here. This overrides
the `model_selection` parameter.
`self.equations_`, give the index number here. This overrides
the `model_selection` parameter. If there are multiple output
features, then pass a list of indices with the order the same
as the output feature.
Returns
-------
Expand Down

0 comments on commit 022f0e5

Please sign in to comment.