MilesCranmer commited on
Commit
022f0e5
1 Parent(s): fb6cbfb

Clarify docstring for `nout_ > 1`

Browse files
Files changed (1) hide show
  1. pysr/sr.py +27 -14
pysr/sr.py CHANGED
@@ -921,10 +921,11 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
921
 
922
  Parameters
923
  ----------
924
- index : int, default=None
925
  If you wish to select a particular equation from `self.equations_`,
926
  give the row number here. This overrides the :param`model_selection`
927
- parameter.
 
928
 
929
  Returns
930
  -------
@@ -942,7 +943,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
942
 
943
  if index is not None:
944
  if isinstance(self.equations_, list):
945
- assert isinstance(index, list)
 
 
946
  return [eq.iloc[i] for eq, i in zip(self.equations_, index)]
947
  return self.equations_.iloc[index]
948
 
@@ -1634,9 +1637,11 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1634
  X : {ndarray | pandas.DataFrame} of shape (n_samples, n_features)
1635
  Training data.
1636
 
1637
- index : int, default=None
1638
  If you want to compute the output of an expression using a
1639
  particular row of `self.equations_`, you may specify the index here.
 
 
1640
 
1641
  Returns
1642
  -------
@@ -1698,10 +1703,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1698
 
1699
  Parameters
1700
  ----------
1701
- index : int, default=None
1702
  If you wish to select a particular equation from
1703
  `self.equations_`, give the index number here. This overrides
1704
- the `model_selection` parameter.
 
 
1705
 
1706
  Returns
1707
  -------
@@ -1720,10 +1727,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1720
 
1721
  Parameters
1722
  ----------
1723
- index : int, default=None
1724
  If you wish to select a particular equation from
1725
  `self.equations_`, give the index number here. This overrides
1726
- the `model_selection` parameter.
 
 
1727
 
1728
  Returns
1729
  -------
@@ -1746,10 +1755,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1746
 
1747
  Parameters
1748
  ----------
1749
- index : int, default=None
1750
  If you wish to select a particular equation from
1751
- `self.equations_`, give the row number here. This overrides
1752
- the `model_selection` parameter.
 
 
1753
 
1754
  Returns
1755
  -------
@@ -1775,10 +1786,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1775
 
1776
  Parameters
1777
  ----------
1778
- index : int, default=None
1779
  If you wish to select a particular equation from
1780
- `self.equations_`, give the row number here. This overrides
1781
- the `model_selection` parameter.
 
 
1782
 
1783
  Returns
1784
  -------
 
921
 
922
  Parameters
923
  ----------
924
+ index : int | list[int], default=None
925
  If you wish to select a particular equation from `self.equations_`,
926
  give the row number here. This overrides the :param`model_selection`
927
+ parameter. If there are multiple output features, then pass
928
+ a list of indices with the order the same as the output feature.
929
 
930
  Returns
931
  -------
 
943
 
944
  if index is not None:
945
  if isinstance(self.equations_, list):
946
+ assert isinstance(
947
+ index, list
948
+ ), "With multiple output features, index must be a list."
949
  return [eq.iloc[i] for eq, i in zip(self.equations_, index)]
950
  return self.equations_.iloc[index]
951
 
 
1637
  X : {ndarray | pandas.DataFrame} of shape (n_samples, n_features)
1638
  Training data.
1639
 
1640
+ index : int | list[int], default=None
1641
  If you want to compute the output of an expression using a
1642
  particular row of `self.equations_`, you may specify the index here.
1643
+ For multiple output equations, you must pass a list of indices
1644
+ in the same order.
1645
 
1646
  Returns
1647
  -------
 
1703
 
1704
  Parameters
1705
  ----------
1706
+ index : int | list[int], default=None
1707
  If you wish to select a particular equation from
1708
  `self.equations_`, give the index number here. This overrides
1709
+ the `model_selection` parameter. If there are multiple output
1710
+ features, then pass a list of indices with the order the same
1711
+ as the output feature.
1712
 
1713
  Returns
1714
  -------
 
1727
 
1728
  Parameters
1729
  ----------
1730
+ index : int | list[int], default=None
1731
  If you wish to select a particular equation from
1732
  `self.equations_`, give the index number here. This overrides
1733
+ the `model_selection` parameter. If there are multiple output
1734
+ features, then pass a list of indices with the order the same
1735
+ as the output feature.
1736
 
1737
  Returns
1738
  -------
 
1755
 
1756
  Parameters
1757
  ----------
1758
+ index : int | list[int], default=None
1759
  If you wish to select a particular equation from
1760
+ `self.equations_`, give the index number here. This overrides
1761
+ the `model_selection` parameter. If there are multiple output
1762
+ features, then pass a list of indices with the order the same
1763
+ as the output feature.
1764
 
1765
  Returns
1766
  -------
 
1786
 
1787
  Parameters
1788
  ----------
1789
+ index : int | list[int], default=None
1790
  If you wish to select a particular equation from
1791
+ `self.equations_`, give the index number here. This overrides
1792
+ the `model_selection` parameter. If there are multiple output
1793
+ features, then pass a list of indices with the order the same
1794
+ as the output feature.
1795
 
1796
  Returns
1797
  -------