Skip to content
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

GLM negative log likelihood method returns incorrect log likelihood #15719

Closed
tomasfryda opened this issue Aug 28, 2023 · 2 comments
Closed

GLM negative log likelihood method returns incorrect log likelihood #15719

tomasfryda opened this issue Aug 28, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@tomasfryda
Copy link
Contributor

model.negative_log_likelihood() reports the fast calculated log likelihood (just the part that's used for the parameter estimation) even when calc_like=True. model.model_performance().loglikelihood() reports the correct log likelihood.

This is confusing especially when AIC is orders of magnitude different than reported by model.negative_log_likelihood(). I think we should make model.negative_log_likelihood() return the correct log likelihood.

@tomasfryda tomasfryda added the bug label Aug 28, 2023
@tomasfryda tomasfryda added this to the 3.42.0.4 milestone Aug 28, 2023
@wendycwong
Copy link
Contributor

image

@wendycwong
Copy link
Contributor

I think @tomasfryda suggestion is the way to go. We will through an warning when user calls the function model.negative_log_likelihood(). Please add a warning to model.negative_log_likelihood() call that says:

This is the simplified negative log likelihood function used during training for speedup. To see the correct values (for loglikelihood and AIC), set calc_like=True and call model.model_performance().loglikelihood() and model.model_performance().aic()

syzonyuliia pushed a commit that referenced this issue Sep 8, 2023
@syzonyuliia syzonyuliia linked a pull request Sep 8, 2023 that will close this issue
syzonyuliia pushed a commit that referenced this issue Sep 11, 2023
syzonyuliia pushed a commit that referenced this issue Sep 18, 2023
syzonyuliia pushed a commit that referenced this issue Sep 18, 2023
syzonyuliia added a commit that referenced this issue Sep 25, 2023
* GH-15719: implement warning in python

* GH-15719: implement warning in R

* GH-15719: add warnings for all functions

* GH-15719: fix whitespaces in R

* GH-15719: fix parameters checks and AIC warnings

* GH-15719: add check for calc_like presence in parameters for AIC function

---------

Co-authored-by: syzonyuliia <[email protected]>
@mn-mikke mn-mikke closed this as completed Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants