Skip to content

v1.0.6

Latest
Compare
Choose a tag to compare
@TianyuDu TianyuDu released this 27 Apr 02:58
· 3 commits to main since this release

Updates

Modeling Outside Option

Now our models are capable of modeling the "outside option" (i.e., the user chooses not to purchase any items). The outside option is modeled as an additional "item" that always provides exactly zero utility in all cases. The outside option is useful when the user has the option to choose none of the items. The outside option is particularly useful in the context of conditional logit and nested logit models.
You can enable the outside option by setting the keyword argument model_outside_option=True while initializing the ConditionalLogitModel or NestedLogitModel.
To indicate that the outside option is chosen, you could use the item index -1 in item_index tensor to indicate that the user exerted the outside option in that observation.
We will be adding more detailed descriptions in our document.

Please Specify the Number of items/users/sessions Explicitly

Please explicitly specify the number of items, users, and sessions using keyword arguments num_{items, users, sessions} while calling the initialization methods of ChoiceDataset or EasyDataWrapper in the future. Without explicitly specifying the number of items/users/sessions, the `ChoiceDataset`` class will infer the number of items/users/sessions by calculating the number of unique items, which might lead to unexpected incorrect behavior.

Here is one example illustrating the caveat of not specifying the number of items explicitly.

item_index = [-1, 0, 0, -1, 1, 2, 3, 5, 6]

Since we required items to be encoded using consecutive integers from 0, max(item_index)=6 suggests that there should be 7 items in this setting.
However, there are only 6 unique numbers in the item_index (expecting for -1, which denotes the outside option) and the item 4 was never chosen and missing from the item_index.
Without explicitly specifying num_items=7 while constructing ChoiceDataset, the dataset object will incorrectly infer there are only 6 items.
This kind of unexpected behavior will affect models constructed on top of the affected dataset.
The scenario described above could happen when the researcher does a train-test split but some splits do not have all items (e.g., item 4 was only chosen in the training set but not the test set).

Technical Changes

What's Changed

  • Refactor pivot method in EasyDatasetWrapper class by @TianyuDu in #47 to support the recent update with Pandas discussed in this issue.
  • fix a typo by @TianyuDu in #45
  • Fix shared lambda by @TianyuDu in #49
  • Update the outside option branch from latest changes in main. by @TianyuDu in #51
  • Add the implementation of the outside option for conditional logit and nested logit models by @TianyuDu in #42
  • Thanks @kdzhang for the outside option implementation discussed in issue.
  • Thanks @Serena9070 for spotting bugs in the code and providing suggestions for improvement.

Full Changelog: v1.0.5...v1.0.6