Releases: gsbDBI/torch-choice
v1.0.6
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
torch-choice v1.0.5
What's Changed
- Enables users to control for the initialization strategies of different coefficients. by @TianyuDu in #33
- fix issue with num_sessions attribute/property after subsetting. by @TianyuDu in #36
- Support flexible observable naming prefixes by @TianyuDu in #37 For example, the
ChoiceDataset
will understand bothuseritem_obs
anditemuser_obs
as (user, item)-specific observable tensor. - 38 add user session obs support by @TianyuDu in #39 The package is now supporting all seven types of observable tensors: user-specific, item-specific, session-specific, (user, item)-specific, (user, session)-specific, (item, session)-specific, and (user, session, item)-specific.
- The
ChoiceDataset.__repr__()
method now reports thenum_{users, items, sessions}
.
Full Changelog: v1.0.3...v1.0.5
torch-choice v1.0.4a
What's Changed
- Enables users to control for the initialization strategies of different coefficients. by @TianyuDu in #33
The model convergence can be sensitive to the initial weights of coefficients. We added aweight_initialization
keyword argument to theConditionalLogitModel
class and{nest, item}_weight_initialization
keyword arguments to theNestedLogitModel
class. These arguments allow users to control the initialization of coefficients (e.g., initialize to zeros, uniform random, or Gaussian random). Please see the notebook here:./tutorial/coefficient_initialization.ipynb
or this documentation page for demonstrations.
Full Changelog: v1.0.3...v1.0.4a
torch-choice v1.0.3
What's Changed
Version v1.0.3
supports user-item specific observables and user-session-item specific observables in the ChoiceDataset
data structure.
Full Changelog: v1.0.2...v1.0.3
torch-choice v1.0.2
Updates
- We have added the LBFGS support.
- Now, the training loop is fully integrated with PyTorch-Lightning,
run()
method is much easier to use. - We have updated the regression table to include z-values and p-values.
- Website and GitHub landing page refreshed.
Full Changelog: v1.0.1...v1.0.2
torch-choice v1.0.1
- Fixed the issue/enhancement described here: #20.
- We have added the
get_coefficient()
method for both theConditionalLogitModel
andNestedLogitModel
classes, which allows researchers to retrieve coefficient tensors easily. Demonstrations to theget_coefficient()
method can be found here: https://gsbdbi.github.io/torch-choice/post_estimation_demos/
torch-choice v1.0.0
Announcement
We have released our documentation on Arxiv: https://arxiv.org/abs/2304.01906.
Important Changes
To avoid confusion and allow for future development, we replace all category_
in the names of variables in NestedLogitModel
with nest_
. Here is the difference: nests and categories are partitions of the item set, but for a nest, a consumer chooses exactly one item from exactly one nest; but for the category, a consumer chooses precisely one thing from every category.
What's Changed
- convert observable tensors to float tensor. by @TianyuDu in #13
- Rename price to itemsession by @TianyuDu in #16
- Add formula parser by @TianyuDu in #15
- Fixed broken imports + price vs itemsession change by @rodonn in #17
- Rename category to nest by @TianyuDu in #18
- Rename category to nest by @TianyuDu in #19
New Contributors
Full Changelog: v0.0.6...v1.0.0