You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: predict(which="_dargs") private which values for internal use. #7923
I would like to add other returns (which) to model.predict that are for internal use.
However, they might not follow the public, results.predict api (e.g. multi-column returns, or tuple returns)
One possibility would be to add the leading underscore to signal it's private.
The main advantage of reusing predict is the argument handling, exog, exog_xxx, offset, exposure, ....
Also model.predict is reused by results.get_prediction, which would be nice to get standard errors and confint for other statistics.
we could even add out-of-sample loglike_obs and other measures (not sure loglike_obs needs endog)
I think this is a very bad idea from the point of view of API. If you do this it shows up in the docs. Better to take the least worst option of making it an undocumented kwarg. If you really, really want to do this, you could write a custom sentinel value like np._NoValue, e.g., sm._PrivateArgument, that is trivial to test for and makes the use case clear.
As a rule parameters should never be added without doc strings. Even if this docstring say the attribute is not guaranteed to be there in future versions.
which='mean' is the official, public keyword. (And it is replacing now the old linear keyword. in 0.14)
This would not be adding the which keyword itself. It would only change which keyword values are available.
It would add some inofficial, private possible values of the which keyword to the official one,
Instead of the current:
which str, optional
Define values that will be predicted. ‘mean’, ‘mean-main’, ‘linear’, ‘mean-nonzero’, ‘prob-zero, ‘prob’, ‘prob-main’ Default is ‘mean’.
We could add that there are additional values for which that are intended for internal use
changed the title [-]ENH: `predict(which="_dargs")` private which for internal use.[/-][+]ENH: `predict(which="_dargs")` private which values for internal use.[/+]on Dec 2, 2021
Activity
bashtage commentedon Dec 2, 2021
I think this is a very bad idea from the point of view of API. If you do this it shows up in the docs. Better to take the least worst option of making it an undocumented kwarg. If you really, really want to do this, you could write a custom sentinel value like
np._NoValue, e.g.,sm._PrivateArgument, that is trivial to test for and makes the use case clear.josef-pkt commentedon Dec 2, 2021
which
whichare available does not show up in the docs unless we include them explicitly in the docstring.e.g. the list at the bottom in https://www.statsmodels.org/dev/generated/statsmodels.discrete.count_model.GenericZeroInflated.predict.html
bashtage commentedon Dec 2, 2021
Not true. Look at the signature at the top.
bashtage commentedon Dec 2, 2021
As a rule parameters should never be added without doc strings. Even if this docstring say the attribute is not guaranteed to be there in future versions.
josef-pkt commentedon Dec 2, 2021
which='mean'is the official, public keyword. (And it is replacing now the oldlinearkeyword. in 0.14)This would not be adding the
whichkeyword itself. It would only change which keyword values are available.It would add some inofficial, private possible values of the which keyword to the official one,
Instead of the current:
We could add that there are additional values for
whichthat are intended for internal use[-]ENH: `predict(which="_dargs")` private which for internal use.[/-][+]ENH: `predict(which="_dargs")` private which values for internal use.[/+]