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

[bugfix] fix tdm first recall layer from floor + 1 to ceil #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tzrec/tools/tdm/cluster_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@
child_num=args.n_cluster,
)
tree_search.save()
first_recall_layer = int(math.log(2 * args.recall_num, args.n_cluster)) + 1
first_recall_layer = int(math.ceil(math.log(2 * args.recall_num, args.n_cluster)))
tree_search.save_predict_edge(first_recall_layer)
logger.info("Save nodes and edges table done.")
2 changes: 1 addition & 1 deletion tzrec/tools/tdm/init_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@
child_num=args.n_cluster,
)
tree_search.save()
first_recall_layer = int(math.log(2 * args.recall_num, args.n_cluster)) + 1
first_recall_layer = int(math.ceil(math.log(2 * args.recall_num, args.n_cluster)))
tree_search.save_predict_edge(first_recall_layer)
logger.info("Save nodes and edges table done.")
2 changes: 1 addition & 1 deletion tzrec/tools/tdm/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def tdm_retrieval(
sampler_config = pipeline_config.data_config.tdm_sampler
item_id_field = sampler_config.item_id_field
max_level = len(sampler_config.layer_num_sample)
first_recall_layer = int(math.log(2 * recall_num, n_cluster)) + 1
first_recall_layer = int(math.ceil(math.log(2 * recall_num, n_cluster)))

dataset = infer_dataloader.dataset
# pyre-ignore [16]
Expand Down
Loading