New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save the offset name in GLM
and results wrapper
#9100
Comments
I think currently We could add a helper function that can be added to the Current extra data like offset, exposure, weights are 1dim. The same as in GLM also applies to discrete models and likely to some other models. |
Offset, exposure, freq_weights and var_weights have the name of the series saved on the model object. They can be accessed via the class properties. Closes statsmodels#9100
Offset, exposure, freq_weights and var_weights have the name of the series saved on the model object. They can be accessed via the class properties. Closes statsmodels#9100
Offset, exposure, freq_weights and var_weights have the name of the series saved on the model object. They can be accessed via the class properties. Closes statsmodels#9100
Offset, exposure, freq_weights and var_weights have the name of the series saved on the model object. They can be accessed via the class properties. Closes statsmodels#9100
Is your feature request related to a problem? Please describe
Post model training, it is helpful to know which variable was used as the offset. This aids in post model analysis and deployment.
The offset array is saved and can be accessed after saving the model, but the name of the offset variable is lost when it is a pandas series. The series is converted to a np.array which removed the name. Current state, it is difficult to tell which variable may have been used as an offset without tracking it outside the model.
Example use case: Sharing a saved model with a peer. They inspect it to determine what variable was used as the offset in training.
The same may apply to the
var_weights
andfreq_weights
for GLM.Describe the solution you'd like
The model has access on
__init__
to the name of the offset if it is a pandas series. A way to save the offset array's name if it is a series would be wonderful.Similar to how the endog and exog names can be used in the model summary.
Here's a few ideas I had for how to implement this. Happy to hear if there's a better option.
offset_name
property for GLMendog_names
/exog_names
model.data
so it's handled byPandasData
model.offset.name
to get at the variable nameoffset_name
attribute to the model class before saving it.Describe alternatives you have considered
Current workaround is saving the offset name in a separate file, which is not ideal.
Additional context
Happy to work on a PR for this.
The text was updated successfully, but these errors were encountered: