warprec 2.1.6__tar.gz → 2.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. {warprec-2.1.6 → warprec-2.1.7}/PKG-INFO +1 -1
  2. {warprec-2.1.6 → warprec-2.1.7}/pyproject.toml +1 -1
  3. {warprec-2.1.6 → warprec-2.1.7}/warprec/common/initialize.py +85 -46
  4. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/interactions.py +18 -0
  5. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/filtering.py +29 -1
  6. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/reader/azureblob_reader.py +10 -2
  7. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/schema.py +23 -0
  8. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/splitting/splitter.py +45 -1
  9. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/pop_reo.py +11 -6
  10. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/pop_rsp.py +5 -4
  11. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/reo.py +7 -14
  12. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/rsp.py +9 -19
  13. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/multiobjective/euclideandistance.py +53 -14
  14. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/multiobjective/hypervolume.py +49 -12
  15. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/base_recommender.py +16 -0
  16. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/common.py +27 -0
  17. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/config.py +218 -112
  18. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/evaluation_configuration.py +39 -2
  19. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/model_configuration.py +37 -4
  20. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/reader_configuration.py +56 -12
  21. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/splitter_configuration.py +40 -46
  22. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/enums.py +21 -0
  23. {warprec-2.1.6 → warprec-2.1.7}/LICENSE +0 -0
  24. {warprec-2.1.6 → warprec-2.1.7}/README.md +0 -0
  25. {warprec-2.1.6 → warprec-2.1.7}/warprec/__init__.py +0 -0
  26. {warprec-2.1.6 → warprec-2.1.7}/warprec/common/__init__.py +0 -0
  27. {warprec-2.1.6 → warprec-2.1.7}/warprec/common/run_state.py +0 -0
  28. {warprec-2.1.6 → warprec-2.1.7}/warprec/common/std_logs.py +0 -0
  29. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/__init__.py +0 -0
  30. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/dataset.py +0 -0
  31. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/__init__.py +0 -0
  32. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/common.py +0 -0
  33. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/context.py +0 -0
  34. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/knowledge.py +0 -0
  35. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/multimodal.py +0 -0
  36. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/sessions.py +0 -0
  37. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/train_structures/__init__.py +0 -0
  38. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/train_structures/custom_collate_fn.py +0 -0
  39. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/train_structures/interaction_structures.py +0 -0
  40. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/train_structures/session_structures.py +0 -0
  41. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/entities/transactions.py +0 -0
  42. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/eval_loaders.py +0 -0
  43. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/ranking.py +0 -0
  44. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/reader/__init__.py +0 -0
  45. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/reader/base_reader.py +0 -0
  46. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/reader/local_reader.py +0 -0
  47. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/splitting/__init__.py +0 -0
  48. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/splitting/strategies.py +0 -0
  49. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/writer/__init__.py +0 -0
  50. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/writer/azureblob_writer.py +0 -0
  51. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/writer/base_writer.py +0 -0
  52. {warprec-2.1.6 → warprec-2.1.7}/warprec/data/writer/local_writer.py +0 -0
  53. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/__init__.py +0 -0
  54. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/evaluator.py +0 -0
  55. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/factory.py +0 -0
  56. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/__init__.py +0 -0
  57. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/__init__.py +0 -0
  58. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/auc.py +0 -0
  59. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/f1.py +0 -0
  60. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/gauc.py +0 -0
  61. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/hit_rate.py +0 -0
  62. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/lauc.py +0 -0
  63. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/logloss.py +0 -0
  64. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/map.py +0 -0
  65. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/mar.py +0 -0
  66. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/mrr.py +0 -0
  67. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/ndcg.py +0 -0
  68. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/precision.py +0 -0
  69. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/accuracy/recall.py +0 -0
  70. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/base_metric.py +0 -0
  71. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/__init__.py +0 -0
  72. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/aclt.py +0 -0
  73. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/aplt.py +0 -0
  74. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/arp.py +0 -0
  75. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/bias/long_tail.py +0 -0
  76. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/coverage/__init__.py +0 -0
  77. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/coverage/item_coverage.py +0 -0
  78. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/coverage/numretrieved.py +0 -0
  79. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/coverage/user_coverage.py +0 -0
  80. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/coverage/user_coverage_at_n.py +0 -0
  81. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/debiased/__init__.py +0 -0
  82. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/debiased/base.py +0 -0
  83. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/debiased/dcg.py +0 -0
  84. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/debiased/recall.py +0 -0
  85. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/diversity/__init__.py +0 -0
  86. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/diversity/gini_index.py +0 -0
  87. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/diversity/shannon_entropy.py +0 -0
  88. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/diversity/srecall.py +0 -0
  89. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/__init__.py +0 -0
  90. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/biasdisparitybd.py +0 -0
  91. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/biasdisparitybr.py +0 -0
  92. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/biasdisparitybs.py +0 -0
  93. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/itemmadranking.py +0 -0
  94. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/itemmadrating.py +0 -0
  95. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/usermadranking.py +0 -0
  96. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/fairness/usermadrating.py +0 -0
  97. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/multiobjective/__init__.py +0 -0
  98. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/novelty/__init__.py +0 -0
  99. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/novelty/efd.py +0 -0
  100. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/novelty/epc.py +0 -0
  101. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/novelty/novelty_profile.py +0 -0
  102. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/rating/__init__.py +0 -0
  103. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/rating/mae.py +0 -0
  104. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/rating/mse.py +0 -0
  105. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/metrics/rating/rmse.py +0 -0
  106. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/propensity.py +0 -0
  107. {warprec-2.1.6 → warprec-2.1.7}/warprec/evaluation/statistical_significance.py +0 -0
  108. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/__init__.py +0 -0
  109. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/common.py +0 -0
  110. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/design.py +0 -0
  111. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/estimate.py +0 -0
  112. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/eval.py +0 -0
  113. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/remotes/__init__.py +0 -0
  114. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/remotes/data.py +0 -0
  115. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/remotes/ml.py +0 -0
  116. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/swarm.py +0 -0
  117. {warprec-2.1.6 → warprec-2.1.7}/warprec/pipelines/train.py +0 -0
  118. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/__init__.py +0 -0
  119. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/callbacks.py +0 -0
  120. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/__init__.py +0 -0
  121. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/__init__.py +0 -0
  122. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/cdae.py +0 -0
  123. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/diffrec.py +0 -0
  124. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/ease.py +0 -0
  125. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/elsa.py +0 -0
  126. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/macridvae.py +0 -0
  127. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multidae.py +0 -0
  128. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multivae.py +0 -0
  129. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/sansa.py +0 -0
  130. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/__init__.py +0 -0
  131. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/dgcf.py +0 -0
  132. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/egcf.py +0 -0
  133. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/esigcf.py +0 -0
  134. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/gcmc.py +0 -0
  135. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/graph_utils.py +0 -0
  136. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightccf.py +0 -0
  137. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcl.py +0 -0
  138. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcn.py +0 -0
  139. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcnpp.py +0 -0
  140. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgode.py +0 -0
  141. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/macrgcn.py +0 -0
  142. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/mixrec.py +0 -0
  143. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ngcf.py +0 -0
  144. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/paac.py +0 -0
  145. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/popdcl.py +0 -0
  146. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/recdcl.py +0 -0
  147. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/rp3beta.py +0 -0
  148. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgcl.py +0 -0
  149. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgl.py +0 -0
  150. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simgcl.py +0 -0
  151. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simrec.py +0 -0
  152. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ultragcn.py +0 -0
  153. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/graph_based/xsimgcl.py +0 -0
  154. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/knn/__init__.py +0 -0
  155. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknn.py +0 -0
  156. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknntd.py +0 -0
  157. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/knn/userknn.py +0 -0
  158. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/knn/userknntd.py +0 -0
  159. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/__init__.py +0 -0
  160. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/admmslim.py +0 -0
  161. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/bpr.py +0 -0
  162. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/fism.py +0 -0
  163. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials.py +0 -0
  164. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials2008.py +0 -0
  165. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/macrmf.py +0 -0
  166. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/slim.py +0 -0
  167. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/neural/__init__.py +0 -0
  168. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/neural/convncf.py +0 -0
  169. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/neural/neumf.py +0 -0
  170. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/collaborative_filtering_recommender/neural/twotower.py +0 -0
  171. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/content_based_recommender/__init__.py +0 -0
  172. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/content_based_recommender/vsm.py +0 -0
  173. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/__init__.py +0 -0
  174. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/afm.py +0 -0
  175. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/dcn.py +0 -0
  176. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/dcnv2.py +0 -0
  177. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/deepfm.py +0 -0
  178. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/fm.py +0 -0
  179. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/nfm.py +0 -0
  180. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/wideanddeep.py +0 -0
  181. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/context_aware_recommender/xdeepfm.py +0 -0
  182. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/hybrid_recommender/__init__.py +0 -0
  183. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/hybrid_recommender/addease.py +0 -0
  184. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/hybrid_recommender/attributeitemknn.py +0 -0
  185. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/hybrid_recommender/attributeuserknn.py +0 -0
  186. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/hybrid_recommender/cease.py +0 -0
  187. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/__init__.py +0 -0
  188. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/cke.py +0 -0
  189. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/kahfm.py +0 -0
  190. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/kgat.py +0 -0
  191. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/kgcn.py +0 -0
  192. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/kgflex.py +0 -0
  193. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/kgin.py +0 -0
  194. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/knowledge_utils.py +0 -0
  195. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/knowledge_aware_recommender/ripplenet.py +0 -0
  196. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/layers.py +0 -0
  197. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/losses.py +0 -0
  198. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/lr_scheduler_wrapper.py +0 -0
  199. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/__init__.py +0 -0
  200. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/bm3.py +0 -0
  201. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/freedom.py +0 -0
  202. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/lattice.py +0 -0
  203. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/mgcn.py +0 -0
  204. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/mmgcn.py +0 -0
  205. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/multimodal_utils.py +0 -0
  206. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/multimodal_recommender/vbpr.py +0 -0
  207. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/optimizer_wrapper.py +0 -0
  208. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/proxy.py +0 -0
  209. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/reranking/__init__.py +0 -0
  210. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/reranking/base.py +0 -0
  211. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/reranking/calibration.py +0 -0
  212. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/reranking/factory.py +0 -0
  213. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/reranking/mmr.py +0 -0
  214. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/__init__.py +0 -0
  215. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/bert4rec.py +0 -0
  216. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/bsarec.py +0 -0
  217. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/caser.py +0 -0
  218. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/cl4srec.py +0 -0
  219. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/core.py +0 -0
  220. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/duorec.py +0 -0
  221. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/esasrec.py +0 -0
  222. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/fossil.py +0 -0
  223. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/gru4rec.py +0 -0
  224. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/gsasrec.py +0 -0
  225. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/lightsans.py +0 -0
  226. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/linrec.py +0 -0
  227. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/narm.py +0 -0
  228. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/sasrec.py +0 -0
  229. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/sequential_recommender/stan.py +0 -0
  230. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/similarities.py +0 -0
  231. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/__init__.py +0 -0
  232. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/dashboard_callbacks.py +0 -0
  233. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/logger_callbacks.py +0 -0
  234. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/objectives.py +0 -0
  235. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/runtime.py +0 -0
  236. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/scheduler_wrapper.py +0 -0
  237. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/search_algorithm_wrapper.py +0 -0
  238. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/trainer/trainer.py +0 -0
  239. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/unpersonalized_recommender/__init__.py +0 -0
  240. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/unpersonalized_recommender/pop.py +0 -0
  241. {warprec-2.1.6 → warprec-2.1.7}/warprec/recommenders/unpersonalized_recommender/random.py +0 -0
  242. {warprec-2.1.6 → warprec-2.1.7}/warprec/run.py +0 -0
  243. {warprec-2.1.6 → warprec-2.1.7}/warprec/serve.py +0 -0
  244. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/__init__.py +0 -0
  245. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/api.py +0 -0
  246. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/app.py +0 -0
  247. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/catalogue.py +0 -0
  248. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/context.py +0 -0
  249. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/deployments.py +0 -0
  250. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/errors.py +0 -0
  251. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/mcp.py +0 -0
  252. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/payload.py +0 -0
  253. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/schemas.py +0 -0
  254. {warprec-2.1.6 → warprec-2.1.7}/warprec/serving/servable.py +0 -0
  255. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/__init__.py +0 -0
  256. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/callback.py +0 -0
  257. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/__init__.py +0 -0
  258. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/dashboard_configuration.py +0 -0
  259. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/estimate_configuration.py +0 -0
  260. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/general_configuration.py +0 -0
  261. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/__init__.py +0 -0
  262. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/__init__.py +0 -0
  263. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/autoencoder_config.py +0 -0
  264. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/graph_based_config.py +0 -0
  265. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/knn_config.py +0 -0
  266. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/latent_factor_config.py +0 -0
  267. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/neural_config.py +0 -0
  268. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/content_based_config.py +0 -0
  269. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/context_aware_config.py +0 -0
  270. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/hybrid_config.py +0 -0
  271. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/knowledge_aware_config.py +0 -0
  272. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/multimodal_config.py +0 -0
  273. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/sequential_model_config.py +0 -0
  274. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/recommender_model_config/unpersonalized_config.py +0 -0
  275. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/rerank_configuration.py +0 -0
  276. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/run_configuration.py +0 -0
  277. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/search_space_wrapper.py +0 -0
  278. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/serving_configuration.py +0 -0
  279. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/training_configuration.py +0 -0
  280. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/config/writer_configuration.py +0 -0
  281. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/helpers.py +0 -0
  282. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/logger/__init__.py +0 -0
  283. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/logger/logger.py +0 -0
  284. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/pause.py +0 -0
  285. {warprec-2.1.6 → warprec-2.1.7}/warprec/utils/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: warprec
3
- Version: 2.1.6
3
+ Version: 2.1.7
4
4
  Summary: Unifying Academic Rigor and Industrial Scale for Responsible, Reproducible, and Efficient Recommendation
5
5
  Author: MarcoWV
6
6
  Author-email: marco.avolio@wideverse.com
@@ -61,7 +61,7 @@ warprec = "warprec.run:main"
61
61
  "warprec.serve" = "warprec.serve:main"
62
62
 
63
63
  [tool.poetry]
64
- version = "2.1.6"
64
+ version = "2.1.7"
65
65
 
66
66
  [tool.poetry.dependencies]
67
67
  python = "^3.12"
@@ -16,10 +16,36 @@ from warprec.utils.config import (
16
16
  EvalConfiguration,
17
17
  )
18
18
  from warprec.utils.callback import WarpRecCallback
19
+ from warprec.utils.enums import ReadingMethods
19
20
  from warprec.utils.registry import model_registry
20
21
  from warprec.utils.logger import logger
21
22
 
22
23
 
24
+ def _location(
25
+ config: Union[TrainConfiguration, DesignConfiguration, EvalConfiguration],
26
+ local_path: Optional[str],
27
+ azure_blob: Optional[str],
28
+ ) -> Optional[str]:
29
+ """Pick the location the configured reader reads a file from.
30
+
31
+ Every reader takes the location as its first argument, a path for the
32
+ local reader and a blob name (or prefix) for the Azure one, so the
33
+ configuration's two keys are resolved here rather than passed by name.
34
+
35
+ Args:
36
+ config (Union[TrainConfiguration, DesignConfiguration, EvalConfiguration]):
37
+ The configuration, for its reading method.
38
+ local_path (Optional[str]): The location on the local filesystem.
39
+ azure_blob (Optional[str]): The location in the Azure container.
40
+
41
+ Returns:
42
+ Optional[str]: The location the reader reads.
43
+ """
44
+ if config.reader.reading_method == ReadingMethods.AZURE_BLOB:
45
+ return azure_blob
46
+ return local_path
47
+
48
+
23
49
  def _read_modality(
24
50
  name: str,
25
51
  modality: ModalityReading,
@@ -50,12 +76,10 @@ def _read_modality(
50
76
  match modality.file_format:
51
77
  case "numpy":
52
78
  features = reader.read_array(
53
- local_path=modality.local_path,
54
- azure_blob_name=modality.azure_blob_name,
79
+ _location(config, modality.local_path, modality.azure_blob_name)
55
80
  )
56
81
  order = reader.read_tabular(
57
- local_path=modality.item_path,
58
- azure_blob_name=modality.item_azure_blob_name,
82
+ _location(config, modality.item_path, modality.item_azure_blob_name),
59
83
  column_names=[item_label],
60
84
  dtypes=item_dtypes,
61
85
  sep=modality.sep,
@@ -63,19 +87,16 @@ def _read_modality(
63
87
  )
64
88
  items = order.select(item_label).to_numpy().flatten().tolist()
65
89
  case "tabular" | "parquet":
90
+ location = _location(config, modality.local_path, modality.azure_blob_name)
66
91
  frame = (
67
92
  reader.read_tabular(
68
- local_path=modality.local_path,
69
- azure_blob_name=modality.azure_blob_name,
93
+ location,
70
94
  dtypes=item_dtypes,
71
95
  sep=modality.sep,
72
96
  header=modality.header,
73
97
  )
74
98
  if modality.file_format == "tabular"
75
- else reader.read_parquet(
76
- local_path=modality.local_path,
77
- azure_blob_name=modality.azure_blob_name,
78
- )
99
+ else reader.read_parquet(location)
79
100
  )
80
101
 
81
102
  # The item column comes first and everything after it is a feature,
@@ -137,18 +158,21 @@ def initialize_datasets(
137
158
  splitter = Splitter()
138
159
  if config.reader.loading_strategy == "dataset":
139
160
  file_format = config.reader.file_format
161
+ location = _location(
162
+ config, config.reader.local_path, config.reader.azure_blob_name
163
+ )
140
164
 
141
165
  match file_format:
142
166
  case "tabular":
143
167
  data = reader.read_tabular(
144
- **config.reader.model_dump(exclude=["labels", "dtypes"]), # type: ignore[arg-type]
168
+ location,
145
169
  column_names=config.reader.column_names(),
146
170
  dtypes=config.reader.column_dtype(),
171
+ sep=config.reader.sep,
172
+ header=config.reader.header,
147
173
  )
148
174
  case "parquet":
149
- data = reader.read_parquet(
150
- **config.reader.model_dump(exclude=["labels", "dtypes"]), # type: ignore[arg-type]
151
- )
175
+ data = reader.read_parquet(location)
152
176
  case _:
153
177
  raise ValueError(f"File format '{file_format}'not supported.")
154
178
  data = callback.on_data_reading(data)
@@ -187,19 +211,25 @@ def initialize_datasets(
187
211
 
188
212
  elif config.reader.loading_strategy == "split":
189
213
  if config.reader.data_type == "transaction":
190
- file_format = config.reader.split.file_format
214
+ split = config.reader.split
215
+ file_format = split.file_format
216
+ location = _location(config, split.local_path, split.azure_blob_prefix)
191
217
 
192
218
  match file_format:
193
219
  case "tabular":
194
220
  train_data, val_data, test_data = reader.read_tabular_split(
195
- **config.reader.split.model_dump(),
221
+ location,
196
222
  column_names=config.reader.column_names(),
197
223
  dtypes=config.reader.column_dtype(),
224
+ sep=split.sep,
225
+ ext=split.ext,
226
+ header=split.header,
198
227
  )
199
228
  case "parquet":
200
229
  train_data, val_data, test_data = reader.read_parquet_split(
201
- **config.reader.split.model_dump(),
230
+ location,
202
231
  column_names=config.reader.column_names(),
232
+ ext=split.ext,
203
233
  )
204
234
  case _:
205
235
  raise ValueError(f"File format '{file_format}'not supported.")
@@ -250,7 +280,9 @@ def initialize_datasets(
250
280
 
251
281
  # Side information reading
252
282
  if config.reader.side:
253
- side_format = config.reader.side.file_format
283
+ side = config.reader.side
284
+ side_format = side.file_format
285
+ location = _location(config, side.local_path, side.azure_blob_name)
254
286
 
255
287
  # The item column has to be read with the same dtype as the interactions,
256
288
  # otherwise the join that attaches the attributes matches nothing.
@@ -261,12 +293,15 @@ def initialize_datasets(
261
293
  match side_format:
262
294
  case "tabular":
263
295
  side_data = reader.read_tabular(
296
+ location,
297
+ column_names=side.column_names,
264
298
  dtypes=side_dtypes,
265
- **config.reader.side.model_dump(),
299
+ sep=side.sep,
300
+ header=side.header,
266
301
  )
267
302
  case "parquet":
268
303
  side_data = reader.read_parquet(
269
- **config.reader.side.model_dump(),
304
+ location, column_names=side.column_names
270
305
  )
271
306
  case _:
272
307
  raise ValueError(f"File format '{side_format}' not supported.")
@@ -282,8 +317,7 @@ def initialize_datasets(
282
317
  )
283
318
 
284
319
  knowledge_data = reader.read_tabular(
285
- local_path=knowledge.local_path,
286
- azure_blob_name=knowledge.azure_blob_name,
320
+ _location(config, knowledge.local_path, knowledge.azure_blob_name),
287
321
  column_names=knowledge.column_names,
288
322
  sep=knowledge.sep,
289
323
  header=knowledge.header,
@@ -292,8 +326,7 @@ def initialize_datasets(
292
326
  # The item column has to be read as the interactions read it, or the
293
327
  # alignment matches nothing and every item silently loses its facts.
294
328
  knowledge_links = reader.read_tabular(
295
- local_path=knowledge.link_path,
296
- azure_blob_name=knowledge.link_azure_blob_name,
329
+ _location(config, knowledge.link_path, knowledge.link_azure_blob_name),
297
330
  column_names=knowledge.link_column_names,
298
331
  dtypes={knowledge.link_column_names[0]: config.reader.dtypes.item_id_type},
299
332
  sep=knowledge.sep,
@@ -350,8 +383,7 @@ def initialize_datasets(
350
383
  match file_format:
351
384
  case "tabular":
352
385
  cluster_data = reader.read_tabular(
353
- local_path=specific_config["local_path"],
354
- blob_name=specific_config["blob_name"],
386
+ specific_config["location"],
355
387
  column_names=column_names,
356
388
  dtypes=dtype_map,
357
389
  sep=specific_config["sep"],
@@ -360,8 +392,7 @@ def initialize_datasets(
360
392
 
361
393
  case "parquet":
362
394
  cluster_data = reader.read_parquet(
363
- local_path=specific_config["local_path"],
364
- blob_name=specific_config["blob_name"],
395
+ specific_config["location"],
365
396
  column_names=column_names,
366
397
  )
367
398
 
@@ -378,8 +409,11 @@ def initialize_datasets(
378
409
  user_config = {
379
410
  "id_label": config.reader.labels.user_id_label,
380
411
  "id_type": config.reader.dtypes.user_id_type,
381
- "local_path": config.reader.clustering.user_local_path,
382
- "blob_name": config.reader.clustering.user_azure_blob_name,
412
+ "location": _location(
413
+ config,
414
+ config.reader.clustering.user_local_path,
415
+ config.reader.clustering.user_azure_blob_name,
416
+ ),
383
417
  "file_format": config.reader.clustering.user_file_format,
384
418
  "sep": config.reader.clustering.user_sep,
385
419
  "header": config.reader.clustering.user_header,
@@ -389,28 +423,33 @@ def initialize_datasets(
389
423
  item_config = {
390
424
  "id_label": config.reader.labels.item_id_label,
391
425
  "id_type": config.reader.dtypes.item_id_type,
392
- "local_path": config.reader.clustering.item_local_path,
393
- "blob_name": config.reader.clustering.item_azure_blob_name,
426
+ "location": _location(
427
+ config,
428
+ config.reader.clustering.item_local_path,
429
+ config.reader.clustering.item_azure_blob_name,
430
+ ),
394
431
  "file_format": config.reader.clustering.item_file_format,
395
432
  "sep": config.reader.clustering.item_sep,
396
433
  "header": config.reader.clustering.item_header,
397
434
  }
398
435
 
399
- # Read user clustering data
400
- user_cluster = _read_cluster_data_clean(
401
- specific_config=user_config,
402
- common_cluster_label=common_cluster_label,
403
- common_cluster_type=common_cluster_type,
404
- reader=reader,
405
- )
436
+ # Either file may come alone: only the side that names one is read, and
437
+ # the dataset leaves the other without clusters.
438
+ if user_config["location"]:
439
+ user_cluster = _read_cluster_data_clean(
440
+ specific_config=user_config,
441
+ common_cluster_label=common_cluster_label,
442
+ common_cluster_type=common_cluster_type,
443
+ reader=reader,
444
+ )
406
445
 
407
- # Read item clustering data
408
- item_cluster = _read_cluster_data_clean(
409
- specific_config=item_config,
410
- common_cluster_label=common_cluster_label,
411
- common_cluster_type=common_cluster_type,
412
- reader=reader,
413
- )
446
+ if item_config["location"]:
447
+ item_cluster = _read_cluster_data_clean(
448
+ specific_config=item_config,
449
+ common_cluster_label=common_cluster_label,
450
+ common_cluster_type=common_cluster_type,
451
+ reader=reader,
452
+ )
414
453
 
415
454
  # Dataset common information
416
455
  common_params: Dict[str, Any] = {
@@ -76,6 +76,7 @@ class Interactions:
76
76
  self._inter_side_sparse: Optional[csr_matrix] = side.matrix
77
77
  self._inter_side_tensor: Tensor = None
78
78
  self._inter_side_labels: List[str] = []
79
+ self._inter_side_repeats: List[Any] = []
79
80
  self._history_matrix: Tensor = None
80
81
  self._history_lens: Tensor = None
81
82
  self._history_mask: Tensor = None
@@ -119,6 +120,15 @@ class Interactions:
119
120
  .drop("__order__")
120
121
  )
121
122
 
123
+ # A long side table gives an item one row per value. The lookup is
124
+ # indexed by item, so it cannot hold them: record which items repeat
125
+ # and let the models that read the lookup refuse them.
126
+ items, counts = np.unique(
127
+ self._inter_side.select(self.item_label).to_numpy().flatten(),
128
+ return_counts=True,
129
+ )
130
+ self._inter_side_repeats = items[counts > 1].tolist()
131
+
122
132
  # Construct lookup for side information features
123
133
  feature_cols = [c for c in self._inter_side.columns if c != self.item_label]
124
134
 
@@ -344,6 +354,14 @@ class Interactions:
344
354
  """
345
355
  return self._inter_side_tensor
346
356
 
357
+ def get_side_repeated_items(self) -> List[Any]:
358
+ """The catalogue items the side information gives more than one row.
359
+
360
+ Returns:
361
+ List[Any]: Their ids, empty when every item has at most one row.
362
+ """
363
+ return self._inter_side_repeats
364
+
347
365
  def get_interaction_dataloader(
348
366
  self,
349
367
  include_user_id: bool = False,
@@ -1,4 +1,5 @@
1
1
  # pylint: disable = too-few-public-methods
2
+ import inspect
2
3
  from typing import List, Any
3
4
  from abc import ABC
4
5
 
@@ -22,9 +23,17 @@ class Filter(ABC):
22
23
  item_id_label (str): Column name for item IDs.
23
24
  rating_label (str): Column name for ratings.
24
25
  timestamp_label (str): Column name for timestamps.
25
- **kwargs (Any): Additional keyword arguments.
26
+ **kwargs (Any): The other column labels the configuration hands every
27
+ filter. Any other key is refused.
28
+
29
+ Raises:
30
+ ValueError: If a keyword is neither a parameter of the filter nor a
31
+ column label.
26
32
  """
27
33
 
34
+ # The labels a configuration passes to every filter besides the four above.
35
+ _OTHER_LABELS = frozenset({"cluster_label", "context_labels"})
36
+
28
37
  def __init__(
29
38
  self,
30
39
  user_id_label: str = "user_id",
@@ -33,6 +42,25 @@ class Filter(ABC):
33
42
  timestamp_label: str = "timestamp",
34
43
  **kwargs: Any,
35
44
  ):
45
+ # A misspelled parameter would otherwise land here and be ignored,
46
+ # leaving the filter to run with its default, or not at all.
47
+ unknown = sorted(set(kwargs) - self._OTHER_LABELS)
48
+ if unknown:
49
+ accepted = [
50
+ name
51
+ for name, param in inspect.signature(
52
+ type(self).__init__
53
+ ).parameters.items()
54
+ if name != "self"
55
+ and param.kind
56
+ not in (inspect.Parameter.VAR_KEYWORD, inspect.Parameter.VAR_POSITIONAL)
57
+ ]
58
+ raise ValueError(
59
+ f"The filter {type(self).__name__} does not take "
60
+ f"{', '.join(repr(key) for key in unknown)}. The parameters it "
61
+ f"takes are {accepted or 'none'}."
62
+ )
63
+
36
64
  self.user_label = user_id_label
37
65
  self.item_label = item_id_label
38
66
  self.rating_label = rating_label
@@ -82,8 +82,8 @@ class AzureBlobReader(Reader):
82
82
  def read_tabular(
83
83
  self,
84
84
  blob_name: str,
85
- column_names: Optional[List[str]],
86
- dtypes: Optional[Dict[str, str]],
85
+ column_names: Optional[List[str]] = None,
86
+ dtypes: Optional[Dict[str, str]] = None,
87
87
  sep: str = "\t",
88
88
  header: bool = True,
89
89
  *args: Any,
@@ -143,8 +143,16 @@ class AzureBlobReader(Reader):
143
143
 
144
144
  Returns:
145
145
  np.ndarray: The array, two-dimensional and float32.
146
+
147
+ Raises:
148
+ FileNotFoundError: If the blob does not exist.
146
149
  """
147
150
  content = self._download_blob_content(azure_blob_name, as_bytes=True)
151
+ if content is None:
152
+ raise FileNotFoundError(
153
+ f"The feature blob '{azure_blob_name}' does not exist in container "
154
+ f"'{self.container_name}'."
155
+ )
148
156
  stream = BytesIO(content) # type: ignore[arg-type]
149
157
 
150
158
  return self._process_array(np.load(stream, allow_pickle=False))
@@ -51,6 +51,29 @@ class SplitSpec:
51
51
  timestamp: Optional[Union[int, str]] = None
52
52
  seed: int = 42
53
53
 
54
+ def __post_init__(self) -> None:
55
+ """Validate that the strategy is given the parameters it reads.
56
+
57
+ Raises:
58
+ ValueError: If the strategy is unknown or a parameter it requires is
59
+ missing.
60
+ """
61
+ strategy = self.resolved_strategy()
62
+ if strategy is None:
63
+ return
64
+ missing = [
65
+ name
66
+ for name in strategy.required_parameters()
67
+ if getattr(self, name) is None
68
+ ]
69
+ if missing:
70
+ raise ValueError(
71
+ f"The {strategy.value} splitting strategy reads "
72
+ f"{', '.join(repr(name) for name in missing)}, which this SplitSpec "
73
+ f"does not set. Pass it, e.g. SplitSpec(strategy='{strategy.value}', "
74
+ f"{missing[0]}=...)."
75
+ )
76
+
54
77
  def resolved_strategy(self) -> Optional[SplittingStrategies]:
55
78
  """The strategy as an enum member, however it was written.
56
79
 
@@ -48,11 +48,21 @@ class Splitter:
48
48
  SplitResult:
49
49
  The train set, the validation set (a single frame, a list of
50
50
  folds, or None) and the test set.
51
+
52
+ Raises:
53
+ ValueError: If no test split is given, or the validation split holds
54
+ out a side of the catalogue the test split does not.
51
55
  """
56
+ if test is None or test.strategy is None:
57
+ raise ValueError(
58
+ "split_transaction needs the test split: pass "
59
+ "test=SplitSpec(strategy=..., ...), e.g. "
60
+ "test=SplitSpec(strategy='temporal_holdout', ratio=0.2)."
61
+ )
52
62
  data = nw.from_native(data, pass_through=True)
53
63
  labels = labels or ColumnLabels()
54
- test = test or SplitSpec()
55
64
  cold = self.cold_dimension(test)
65
+ self.check_validation_cold_start(test, validation)
56
66
 
57
67
  # Test set
58
68
  split_process_start_time = time.time()
@@ -164,6 +174,40 @@ class Splitter:
164
174
  )
165
175
  return split
166
176
 
177
+ @classmethod
178
+ def check_validation_cold_start(
179
+ cls, test: SplitSpec, validation: Optional[SplitSpec]
180
+ ) -> None:
181
+ """Refuse a cold-start validation split the test split would empty.
182
+
183
+ Evaluation sets keep only the entities training saw, except on the side
184
+ the test split holds out. A validation split holding out the other side,
185
+ or holding out anything when the test split does not, is therefore
186
+ emptied once aligned with its train set.
187
+
188
+ Args:
189
+ test (SplitSpec): The criterion the test split follows.
190
+ validation (Optional[SplitSpec]): The criterion the validation split
191
+ follows, if any.
192
+
193
+ Raises:
194
+ ValueError: If the validation split holds out a side the test split
195
+ does not.
196
+ """
197
+ if validation is None or validation.strategy is None:
198
+ return
199
+ held_out = cls.cold_dimension(validation)
200
+ if held_out is None or held_out == cls.cold_dimension(test):
201
+ return
202
+ raise ValueError(
203
+ f"The validation split uses {validation.resolved_strategy().value}, which "
204
+ f"holds {held_out}s out of training, but the test split "
205
+ f"({test.resolved_strategy().value}) does not, so every validation "
206
+ f"{held_out} would be dropped and the validation set left empty. Use "
207
+ f"{validation.resolved_strategy().value} for the test split too, or a "
208
+ "holdout or leave-k-out strategy for the validation split."
209
+ )
210
+
167
211
  @staticmethod
168
212
  def cold_dimension(spec: SplitSpec) -> Optional[str]:
169
213
  """Which side of the catalogue a split holds out entirely, if any.
@@ -101,15 +101,20 @@ class PopREO(TopKMetric):
101
101
  self.long_gt += torch.isin(positive_indices, self.long_tail).sum().float()
102
102
 
103
103
  def compute(self):
104
- # Calculate proportions of hits per group
105
- pr_short = self.short_recs / (self.short_gt if self.short_gt > 0 else 1.0)
106
- pr_long = self.long_recs / (self.long_gt if self.long_gt > 0 else 1.0)
107
-
108
- # Handle the case where one group has zero items
104
+ # A group with no relevant item has no rate, and with one rate missing
105
+ # there is nothing to compare: the metric is undefined there.
109
106
  if self.short_gt == 0 or self.long_gt == 0:
110
- return torch.tensor(0.0)
107
+ return {self.name: float("nan")}
111
108
 
109
+ # Calculate proportions of hits per group
110
+ pr_short = self.short_recs / self.short_gt
111
+ pr_long = self.long_recs / self.long_gt
112
112
  pr = torch.stack([pr_short, pr_long])
113
+
114
+ # No hit in either group leaves std over mean as 0/0, undefined too.
115
+ if torch.mean(pr) == 0:
116
+ return {self.name: float("nan")}
117
+
113
118
  # std(unbiased=False) matches numpy std by default for population std
114
119
  pop_reo = (torch.std(pr, unbiased=False) / torch.mean(pr)).item()
115
120
  return {self.name: pop_reo}
@@ -101,17 +101,18 @@ class PopRSP(TopKMetric):
101
101
 
102
102
  def compute(self):
103
103
  """Computes the final metric value."""
104
- # Handle division by zero
104
+ # A group with nothing on offer has no rate, and with one rate missing
105
+ # there is nothing to compare: the metric is undefined there.
105
106
  if self.avail_short == 0 or self.avail_long == 0:
106
- return {self.name: torch.tensor(0.0)}
107
+ return {self.name: float("nan")}
107
108
 
108
109
  pr_short = self.short_recs / self.avail_short
109
110
  pr_long = self.long_recs / self.avail_long
110
111
  pr = torch.stack([pr_short, pr_long])
111
112
 
112
- # Handle the case where mean is zero
113
+ # Nothing recommended in either group leaves std over mean as 0/0.
113
114
  if torch.mean(pr) == 0:
114
- return {self.name: torch.tensor(0.0)}
115
+ return {self.name: float("nan")}
115
116
 
116
117
  pop_rsp = torch.std(pr, unbiased=False) / torch.mean(pr)
117
118
  return {self.name: pop_rsp.item()}
@@ -114,9 +114,6 @@ class REO(TopKMetric):
114
114
  # We assume cluster 0 is padding/unknown and usually ignore it if it has no items
115
115
  valid_mask = self.cluster_total_items > 0
116
116
 
117
- if not valid_mask.any():
118
- return {self.name: torch.tensor(0.0).item()}
119
-
120
117
  # Calculate probabilities for ALL clusters (keep 0 for invalid ones to maintain index alignment)
121
118
  # Avoid division by zero
122
119
  safe_denom = self.cluster_total_items.clone()
@@ -128,13 +125,6 @@ class REO(TopKMetric):
128
125
  # Calculate global stats based ONLY on valid clusters
129
126
  valid_probs = probs[valid_mask]
130
127
 
131
- if valid_probs.numel() <= 1:
132
- std_prob = torch.tensor(0.0)
133
- mean_prob = torch.tensor(1.0) # Avoid div/0
134
- else:
135
- std_prob = torch.std(valid_probs, unbiased=False)
136
- mean_prob = torch.mean(valid_probs)
137
-
138
128
  results = {}
139
129
 
140
130
  # Populate per-cluster probability
@@ -145,10 +135,13 @@ class REO(TopKMetric):
145
135
  else:
146
136
  results[key] = float("nan")
147
137
 
148
- # Aggregate Score
149
- if mean_prob == 0:
150
- results[self.name] = 0.0
138
+ # Aggregate Score. A cluster with no relevant item has no rate; with
139
+ # fewer than two rates there is nothing to compare, and with no hit in
140
+ # any cluster std over mean is 0/0: the metric is undefined there.
141
+ if valid_probs.numel() < 2 or torch.mean(valid_probs) == 0:
142
+ results[self.name] = float("nan")
151
143
  else:
152
- results[self.name] = (std_prob / mean_prob).item()
144
+ std_prob = torch.std(valid_probs, unbiased=False)
145
+ results[self.name] = (std_prob / torch.mean(valid_probs)).item()
153
146
 
154
147
  return results
@@ -129,17 +129,11 @@ class RSP(TopKMetric):
129
129
  # Compute total interactions across all users
130
130
  total_interactions = self.user_interactions.sum()
131
131
 
132
- if total_interactions == 0:
133
- return {self.name: 0.0}
134
-
135
132
  # What was actually on offer, counted rather than estimated.
136
133
  denominator_counts = self.cluster_available
137
134
 
138
- # Valid clusters for computation
139
- valid_mask = denominator_counts > 0
140
-
141
- if not valid_mask.any():
142
- return {self.name: 0.0}
135
+ # Valid clusters for computation: none when no user was scored
136
+ valid_mask = (denominator_counts > 0) & (total_interactions > 0)
143
137
 
144
138
  # Compute probabilities per cluster
145
139
  probs = torch.zeros_like(self.cluster_recommendations)
@@ -149,13 +143,6 @@ class RSP(TopKMetric):
149
143
 
150
144
  valid_probs = probs[valid_mask]
151
145
 
152
- if valid_probs.numel() <= 1:
153
- std_prob = 0.0
154
- mean_prob = 1.0
155
- else:
156
- std_prob = torch.std(valid_probs, unbiased=False).item()
157
- mean_prob = torch.mean(valid_probs).item()
158
-
159
146
  results = {}
160
147
 
161
148
  # Populate per-cluster probability
@@ -166,10 +153,13 @@ class RSP(TopKMetric):
166
153
  else:
167
154
  results[key] = float("nan")
168
155
 
169
- # Aggregate Score
170
- if mean_prob == 0:
171
- results[self.name] = 0.0
156
+ # Aggregate Score. A cluster with nothing on offer has no rate; with
157
+ # fewer than two rates there is nothing to compare, and with nothing
158
+ # recommended std over mean is 0/0: the metric is undefined there.
159
+ if valid_probs.numel() < 2 or torch.mean(valid_probs) == 0:
160
+ results[self.name] = float("nan")
172
161
  else:
173
- results[self.name] = std_prob / mean_prob
162
+ std_prob = torch.std(valid_probs, unbiased=False).item()
163
+ results[self.name] = std_prob / torch.mean(valid_probs).item()
174
164
 
175
165
  return results