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

Bug in setting the number of nests in generalized_nested_logit #121

Open
timokau opened this issue May 25, 2020 · 2 comments
Open

Bug in setting the number of nests in generalized_nested_logit #121

timokau opened this issue May 25, 2020 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@timokau
Copy link
Collaborator

timokau commented May 25, 2020

See #118 (comment) for details. Should be resolved after merging #118 to avoid conflicts.

@timokau
Copy link
Collaborator Author

timokau commented May 26, 2020

Continuing the discussion in #118 (comment) here for better visibility (since that PR is merged). CC @prithagupta @kiudee

While GenNestedModel, says every object to some extend is a part of a nest, there is some literature which suggests still the number of nests should be less than number of objects in the choice set.

I am not sure I understand your point. Could you clarify? Do you agree that we should replace

if n_nests is None:
    self.n_nests = self.n_objects_fit_ + int(self.n_objects_fit_ / 2)

by

if n_nests is None:
    self.n_nests = int(self.n_objects_fit_ / 2)

in generalized_nested_logit.py ?

@kiudee kiudee added bug Something isn't working question Further information is requested labels May 30, 2020
@kiudee kiudee changed the title Bug in seting the number of nests in generalized_nested_logit Bug in setting the number of nests in generalized_nested_logit May 31, 2020
@prithagupta
Copy link
Collaborator

In nested logit, we are taking default number of nests to be
self.n_objects = n_objects
if n_nests is None:
self.n_nests = int(n_objects / 2)
else:
self.n_nests = n_nests
, while in generalized_nested_logit,
its
self.n_nests = n_objects + int(n_objects / 2)

The nested logit model divides the objects into a mutually exclusive set so the nests should be less than the number of objects if n_nests=n_objects, then it becomes a logit model.
While GenNestedModel, says every object to some extend is a part of a nest, there is some literature which suggests still the number of nests should be less than the number of objects in the choice set. So, in principle, it is a good idea to get the number of objects in a choice set.
So for both NLM and GLM we can set the default number of nests to be half of the number of objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants