replay-rec 0.20.1rc0__py3-none-any.whl → 0.20.3__py3-none-any.whl

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 (62) hide show
  1. replay/__init__.py +1 -1
  2. replay/data/nn/sequential_dataset.py +8 -2
  3. {replay_rec-0.20.1rc0.dist-info → replay_rec-0.20.3.dist-info}/METADATA +18 -12
  4. {replay_rec-0.20.1rc0.dist-info → replay_rec-0.20.3.dist-info}/RECORD +7 -62
  5. replay/experimental/__init__.py +0 -0
  6. replay/experimental/metrics/__init__.py +0 -62
  7. replay/experimental/metrics/base_metric.py +0 -603
  8. replay/experimental/metrics/coverage.py +0 -97
  9. replay/experimental/metrics/experiment.py +0 -175
  10. replay/experimental/metrics/hitrate.py +0 -26
  11. replay/experimental/metrics/map.py +0 -30
  12. replay/experimental/metrics/mrr.py +0 -18
  13. replay/experimental/metrics/ncis_precision.py +0 -31
  14. replay/experimental/metrics/ndcg.py +0 -49
  15. replay/experimental/metrics/precision.py +0 -22
  16. replay/experimental/metrics/recall.py +0 -25
  17. replay/experimental/metrics/rocauc.py +0 -49
  18. replay/experimental/metrics/surprisal.py +0 -90
  19. replay/experimental/metrics/unexpectedness.py +0 -76
  20. replay/experimental/models/__init__.py +0 -50
  21. replay/experimental/models/admm_slim.py +0 -257
  22. replay/experimental/models/base_neighbour_rec.py +0 -200
  23. replay/experimental/models/base_rec.py +0 -1386
  24. replay/experimental/models/base_torch_rec.py +0 -234
  25. replay/experimental/models/cql.py +0 -454
  26. replay/experimental/models/ddpg.py +0 -932
  27. replay/experimental/models/dt4rec/__init__.py +0 -0
  28. replay/experimental/models/dt4rec/dt4rec.py +0 -189
  29. replay/experimental/models/dt4rec/gpt1.py +0 -401
  30. replay/experimental/models/dt4rec/trainer.py +0 -127
  31. replay/experimental/models/dt4rec/utils.py +0 -264
  32. replay/experimental/models/extensions/spark_custom_models/__init__.py +0 -0
  33. replay/experimental/models/extensions/spark_custom_models/als_extension.py +0 -792
  34. replay/experimental/models/hierarchical_recommender.py +0 -331
  35. replay/experimental/models/implicit_wrap.py +0 -131
  36. replay/experimental/models/lightfm_wrap.py +0 -303
  37. replay/experimental/models/mult_vae.py +0 -332
  38. replay/experimental/models/neural_ts.py +0 -986
  39. replay/experimental/models/neuromf.py +0 -406
  40. replay/experimental/models/scala_als.py +0 -293
  41. replay/experimental/models/u_lin_ucb.py +0 -115
  42. replay/experimental/nn/data/__init__.py +0 -1
  43. replay/experimental/nn/data/schema_builder.py +0 -102
  44. replay/experimental/preprocessing/__init__.py +0 -3
  45. replay/experimental/preprocessing/data_preparator.py +0 -839
  46. replay/experimental/preprocessing/padder.py +0 -229
  47. replay/experimental/preprocessing/sequence_generator.py +0 -208
  48. replay/experimental/scenarios/__init__.py +0 -1
  49. replay/experimental/scenarios/obp_wrapper/__init__.py +0 -8
  50. replay/experimental/scenarios/obp_wrapper/obp_optuna_objective.py +0 -74
  51. replay/experimental/scenarios/obp_wrapper/replay_offline.py +0 -261
  52. replay/experimental/scenarios/obp_wrapper/utils.py +0 -85
  53. replay/experimental/scenarios/two_stages/__init__.py +0 -0
  54. replay/experimental/scenarios/two_stages/reranker.py +0 -117
  55. replay/experimental/scenarios/two_stages/two_stages_scenario.py +0 -757
  56. replay/experimental/utils/__init__.py +0 -0
  57. replay/experimental/utils/logger.py +0 -24
  58. replay/experimental/utils/model_handler.py +0 -186
  59. replay/experimental/utils/session_handler.py +0 -44
  60. {replay_rec-0.20.1rc0.dist-info → replay_rec-0.20.3.dist-info}/WHEEL +0 -0
  61. {replay_rec-0.20.1rc0.dist-info → replay_rec-0.20.3.dist-info}/licenses/LICENSE +0 -0
  62. {replay_rec-0.20.1rc0.dist-info → replay_rec-0.20.3.dist-info}/licenses/NOTICE +0 -0
replay/__init__.py CHANGED
@@ -4,4 +4,4 @@
4
4
  # functionality removed in Python 3.12 is used in downstream packages (like lightfm)
5
5
  import setuptools as _
6
6
 
7
- __version__ = "0.20.1.preview"
7
+ __version__ = "0.20.3"
@@ -125,11 +125,17 @@ class SequentialDataset(abc.ABC):
125
125
 
126
126
  @staticmethod
127
127
  def _convert_array_to_list(df):
128
- return df.map(lambda x: x.tolist() if isinstance(x, np.ndarray) else x)
128
+ df_converted = pd.DataFrame()
129
+ for feature in df.columns:
130
+ df_converted[feature] = df[feature].map(lambda x: x.tolist() if isinstance(x, np.ndarray) else x)
131
+ return df_converted
129
132
 
130
133
  @staticmethod
131
134
  def _convert_list_to_array(df):
132
- return df.map(lambda x: np.array(x) if isinstance(x, list) else x)
135
+ df_converted = pd.DataFrame()
136
+ for feature in df.columns:
137
+ df_converted[feature] = df[feature].map(lambda x: np.array(x) if isinstance(x, list) else x)
138
+ return df_converted
133
139
 
134
140
 
135
141
  class PandasSequentialDataset(SequentialDataset):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: replay-rec
3
- Version: 0.20.1rc0
3
+ Version: 0.20.3
4
4
  Summary: RecSys Library
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -14,23 +14,29 @@ Classifier: Intended Audience :: Developers
14
14
  Classifier: Intended Audience :: Science/Research
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
- Requires-Dist: d3rlpy (>=2.8.1,<2.9)
18
- Requires-Dist: implicit (>=0.7.2,<0.8)
19
- Requires-Dist: lightautoml (>=0.4.1,<0.5)
20
- Requires-Dist: lightning (>=2.0.2,<=2.4.0)
21
- Requires-Dist: numba (>=0.50,<1)
17
+ Provides-Extra: spark
18
+ Provides-Extra: torch
19
+ Provides-Extra: torch-cpu
20
+ Requires-Dist: lightning (<2.6.0) ; extra == "torch" or extra == "torch-cpu"
21
+ Requires-Dist: lightning ; extra == "torch"
22
+ Requires-Dist: lightning ; extra == "torch-cpu"
22
23
  Requires-Dist: numpy (>=1.20.0,<2)
23
24
  Requires-Dist: pandas (>=1.3.5,<2.4.0)
24
25
  Requires-Dist: polars (<2.0)
25
- Requires-Dist: psutil (<=7.0.0)
26
+ Requires-Dist: psutil (<=7.0.0) ; extra == "spark"
27
+ Requires-Dist: psutil ; extra == "spark"
26
28
  Requires-Dist: pyarrow (<22.0)
27
- Requires-Dist: pyspark (>=3.0,<3.5)
28
- Requires-Dist: pytorch-optimizer (>=3.8.0,<4)
29
- Requires-Dist: sb-obp (>=0.5.10,<0.6)
29
+ Requires-Dist: pyspark (>=3.0,<3.5) ; extra == "spark"
30
+ Requires-Dist: pyspark ; extra == "spark"
31
+ Requires-Dist: pytorch-optimizer (>=3.8.0,<3.9.0) ; extra == "torch" or extra == "torch-cpu"
32
+ Requires-Dist: pytorch-optimizer ; extra == "torch"
33
+ Requires-Dist: pytorch-optimizer ; extra == "torch-cpu"
30
34
  Requires-Dist: scikit-learn (>=1.6.1,<1.7.0)
31
- Requires-Dist: scipy (>=1.13.1,<1.14)
35
+ Requires-Dist: scipy (>=1.8.1,<2.0.0)
32
36
  Requires-Dist: setuptools
33
- Requires-Dist: torch (>=1.8,<3.0.0)
37
+ Requires-Dist: torch (>=1.8,<2.9.0) ; extra == "torch" or extra == "torch-cpu"
38
+ Requires-Dist: torch ; extra == "torch"
39
+ Requires-Dist: torch ; extra == "torch-cpu"
34
40
  Requires-Dist: tqdm (>=4.67,<5)
35
41
  Project-URL: Homepage, https://sb-ai-lab.github.io/RePlay/
36
42
  Project-URL: Repository, https://github.com/sb-ai-lab/RePlay
@@ -1,4 +1,4 @@
1
- replay/__init__.py,sha256=4xb9FHSuRPA_dhFTY5XvoJ7s_epCHAcBMiRPwORT_gQ,233
1
+ replay/__init__.py,sha256=2Y-XWVf6G7EZYVo5MwU5aWfw38ZhbmBLHuki47tqPrI,225
2
2
  replay/data/__init__.py,sha256=g5bKRyF76QL_BqlED-31RnS8pBdcyj9loMsx5vAG_0E,301
3
3
  replay/data/dataset.py,sha256=yQDc8lfphQYfHpm_T1MhnG8_GyM4ONyxJoFc1rUgdJ8,30755
4
4
  replay/data/dataset_utils/__init__.py,sha256=9wUvG8ZwGUvuzLU4zQI5FDcH0WVVo5YLN2ey3DterP0,55
@@ -6,66 +6,11 @@ replay/data/dataset_utils/dataset_label_encoder.py,sha256=bxuJPhShFZBok7bQZYGNMV
6
6
  replay/data/nn/__init__.py,sha256=nj2Ep-tduuQkc-TnBkvN8-rDnFbcWO2oZrfcXl9M3C8,1122
7
7
  replay/data/nn/schema.py,sha256=h1KgaNV-hgN9Vpt24c92EmeMpm_8W0s9a2M0wLxJHYk,17101
8
8
  replay/data/nn/sequence_tokenizer.py,sha256=_9fBF-84jdn8Pa3pFKIr6prUjNYCc6BVzwRl9VSleKQ,37419
9
- replay/data/nn/sequential_dataset.py,sha256=qthp87SQ44VpgoH3RKsqm6CxCeQyApn58l7_16txAZM,11303
9
+ replay/data/nn/sequential_dataset.py,sha256=JNmPjVrrBhModj-yrkExl28oCm1gbdU8z4nMfB5PQko,11565
10
10
  replay/data/nn/torch_sequential_dataset.py,sha256=QSh4IM2vzAF095_ZMC1gMqZj9slHXos9gfx_R_DlpGM,11545
11
11
  replay/data/nn/utils.py,sha256=Ic3G4yZRIzBYXLmwP1VstlZXPNR7AYGCc5EyZAERp5c,3297
12
12
  replay/data/schema.py,sha256=JmYLCrNgBS5oq4O_PT724Gr1pDurHEykcqV8Xaj0XTw,15922
13
13
  replay/data/spark_schema.py,sha256=4o0Kn_fjwz2-9dBY3q46F9PL0F3E7jdVpIlX7SG3OZI,1111
14
- replay/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- replay/experimental/metrics/__init__.py,sha256=bdQogGbEDVAeH7Ejbb6vpw7bP6CYhftTu_DQuoFRuCA,2861
16
- replay/experimental/metrics/base_metric.py,sha256=0ro9VoSnPtPAximnlcgmQaMNg9zoUN2AHAH_2WgfZiQ,22663
17
- replay/experimental/metrics/coverage.py,sha256=UqYm-WtAlBFZ3kqv8PyLo4qqKiIXmR_CQFAl6H_YdqA,3150
18
- replay/experimental/metrics/experiment.py,sha256=pD2Dyyg4PM1HjbrNrhAspZJP3B-i2So205qBChRGwwc,7337
19
- replay/experimental/metrics/hitrate.py,sha256=TfWJrUyZXabdMr4tn8zqUPGDcYy2yphVCzXmLSHCxY0,675
20
- replay/experimental/metrics/map.py,sha256=S4dKiMpYR0_pu0bqioGMT0kIC1s2aojFP4rddBqMPtM,921
21
- replay/experimental/metrics/mrr.py,sha256=q6I1Cndlwr716mMuYtTMu0lN8Rrp9khxhb49OM2IpV8,530
22
- replay/experimental/metrics/ncis_precision.py,sha256=yrErOhBZvZdNpQPx_AXyktDJatqdWRIHNMyei0QDJtQ,1088
23
- replay/experimental/metrics/ndcg.py,sha256=q3KTsyZCrfvcpEjEnR_kWVB9ZaTFRxnoNRAr2WD0TrU,1538
24
- replay/experimental/metrics/precision.py,sha256=U9pD9yRGeT8uH32BTyQ-W5qsAnbFWu-pqy4XfkcXfCM,664
25
- replay/experimental/metrics/recall.py,sha256=5xRPGxfbVoDFEI5E6dVlZpT4RvnDlWzaktyoqh3a8mc,774
26
- replay/experimental/metrics/rocauc.py,sha256=yq4vW2_bXO8HCjREBZVrHMKeZ054LYvjJmLJTXWPfQA,1675
27
- replay/experimental/metrics/surprisal.py,sha256=CK4_zed2bSMDwC7ZBCS8d8RwGEqt8bh3w3fTpjKiK6Y,3052
28
- replay/experimental/metrics/unexpectedness.py,sha256=JQQXEYHtQM8nqp7X2He4E9ZYwbpdENaK8oQG7sUQT3s,2621
29
- replay/experimental/models/__init__.py,sha256=yeu0PAkqWNqNLDnUYpg0_vpkWT8tG8KmRMybodVFkZ4,1709
30
- replay/experimental/models/admm_slim.py,sha256=dDg2c_5Lk8acykirtsv38Jg1l6kgAoBhRvPHPv5Vfis,8654
31
- replay/experimental/models/base_neighbour_rec.py,sha256=Q2C4rle9FeVIncqgMuhLV6qZbPj2Bz8W_Ao8iQu31TU,7387
32
- replay/experimental/models/base_rec.py,sha256=AmN6-PgIaNzD-sMIndMuRA3TJ0WZBbowCjaSTTgiYrY,54150
33
- replay/experimental/models/base_torch_rec.py,sha256=mwbbsR-sQuQAFC1d8X2k0zP3iJeEP-X5nAaR3IV7Sqg,8105
34
- replay/experimental/models/cql.py,sha256=ItTukqhH3V-PItVPawET9zO9tG4D8R4xKzz3tqKMjSc,19619
35
- replay/experimental/models/ddpg.py,sha256=bzX4KvkuIecYA4bkFB1BnLKE3zqteujhpvsxAXEnKoM,32266
36
- replay/experimental/models/dt4rec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- replay/experimental/models/dt4rec/dt4rec.py,sha256=zcxn2MjrJg8eYqfGwfK80UjH2-uwNDg4PBbmQZz7Le0,5895
38
- replay/experimental/models/dt4rec/gpt1.py,sha256=T3buFtYyF6Fh6sW6f9dUZFcFEnQdljItbRa22CiKb0w,14044
39
- replay/experimental/models/dt4rec/trainer.py,sha256=YeaJ8mnoYZqnPwm1P9qOYb8GzgFC5At-JeSDcvG2V2o,3859
40
- replay/experimental/models/dt4rec/utils.py,sha256=UF--cukjFB3uwzqaVHdCS3ik2qTtw97tzbSFGPkDfE8,8153
41
- replay/experimental/models/extensions/spark_custom_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- replay/experimental/models/extensions/spark_custom_models/als_extension.py,sha256=R9Xj5Yew5eH3dMJ9qfIyhBg4NeMv-wXVEISgzCwFQz0,25846
43
- replay/experimental/models/hierarchical_recommender.py,sha256=BqnEFBppKawt8Xx5lzBWk6qnmdCrZ7c2hpKj3mi1GvU,11441
44
- replay/experimental/models/implicit_wrap.py,sha256=8F-f-CaStmlNHwphu-yu8o4Aft08NKDD_SqqH0zp1Uo,4655
45
- replay/experimental/models/lightfm_wrap.py,sha256=rA9T2vGjrbt_GJV1XccYYsrs9qtgDtqVJCWBHFYrm4k,11329
46
- replay/experimental/models/mult_vae.py,sha256=l-6g-2fIs80vxBl9VGY4FrJannAXrzsQOyGNuHU8tDs,11601
47
- replay/experimental/models/neural_ts.py,sha256=oCqStgGg5CpGFAv1dC-3ODmK9nI05evzJ3XKBDQhgAo,42535
48
- replay/experimental/models/neuromf.py,sha256=acC50kxYlctriNGqyOEkq57Iu4icUvZasyWFeRUJans,14386
49
- replay/experimental/models/scala_als.py,sha256=6aMl8hUFR2J_nI5U8Z_-5BxfeATiWnC8zdj1C0AFbm4,10751
50
- replay/experimental/models/u_lin_ucb.py,sha256=-gu6meOYeSwP6N8ILtwasWYj4Mbs6EJEFQXUHE8N_lY,3750
51
- replay/experimental/nn/data/__init__.py,sha256=5EAF-FNd7xhkUpTq_5MyVcPXBD81mJCwYrcbhdGOWjE,48
52
- replay/experimental/nn/data/schema_builder.py,sha256=nfE0-bVgYUwzyhNTTcXUWhfNBAZQLHWenM6-zEglqps,3301
53
- replay/experimental/preprocessing/__init__.py,sha256=uMyeyQ_GKqjLhVGwhrEk3NLhhzS0DKi5xGo3VF4WkiA,130
54
- replay/experimental/preprocessing/data_preparator.py,sha256=-yqWZT06iEYsY7rCSGRAgLcp6o7jvlsU431HspHQ2o4,35940
55
- replay/experimental/preprocessing/padder.py,sha256=uxE6WlmYNd9kbACMEidxG1L19G5Rk0gQbvpN_TosMZ4,9558
56
- replay/experimental/preprocessing/sequence_generator.py,sha256=vFtLkq9MuLGThPsa67103qlcMLYLfnAkR_HI1FXPwjw,9047
57
- replay/experimental/scenarios/__init__.py,sha256=gWFLCkLyOmOppvbRMK7C3UMlMpcbIgiGVolSH6LPgWA,91
58
- replay/experimental/scenarios/obp_wrapper/__init__.py,sha256=ZOJgpjRsmhXTpzGumk3AALKmstNBachtu_hOXUIPY5s,434
59
- replay/experimental/scenarios/obp_wrapper/obp_optuna_objective.py,sha256=swwcot05a8GzIVhEKpfmjG16CuciItVuddPaOjCKo9o,2543
60
- replay/experimental/scenarios/obp_wrapper/replay_offline.py,sha256=9ZP17steBiTh_KO37NnXWyN5LuPpABPhL_QG4JJHf7I,9622
61
- replay/experimental/scenarios/obp_wrapper/utils.py,sha256=Uv_fqyJDt69vIdrw-Y9orLLzyHG0ko8svza0Hs_a87Q,3233
62
- replay/experimental/scenarios/two_stages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
- replay/experimental/scenarios/two_stages/reranker.py,sha256=NQhooA3OXLAh_PwydBNU2DGRRGPq2j2R0SSHtDM7hlg,4238
64
- replay/experimental/scenarios/two_stages/two_stages_scenario.py,sha256=u41ymdhx0MS1I08VDjJ2UhXpSqsfTA1x9Hbz1tOaWLY,29822
65
- replay/experimental/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- replay/experimental/utils/logger.py,sha256=UwLowaeOG17sDEe32LiZel8MnjSTzeW7J3uLG1iwLuA,639
67
- replay/experimental/utils/model_handler.py,sha256=Rfj57E1R_XMEEigHNZa9a-rzEsyLWSDsgKfXoRzWWdg,6426
68
- replay/experimental/utils/session_handler.py,sha256=H0C-Q2pqrs_5aDvoAkRMZuS5qu07uhu6g5FEL3NJiic,1305
69
14
  replay/metrics/__init__.py,sha256=j0PGvUehaPEZMNo9SQwJsnvzrS4bam9eHrRMQFLnMjY,2813
70
15
  replay/metrics/base_metric.py,sha256=ejtwFHktN4J8Fi1HIM3w0zlMAd8nO7-XpFi2D1iHXUQ,16010
71
16
  replay/metrics/categorical_diversity.py,sha256=3tp8n457Ob4gjM-UTB5N19u9WAF7fLDkWKk-Mth-Vzc,10769
@@ -186,8 +131,8 @@ replay/utils/session_handler.py,sha256=fQo2wseow8yuzKnEXT-aYAXcQIgRbTTXp0v7g1VVi
186
131
  replay/utils/spark_utils.py,sha256=GbRp-MuUoO3Pc4chFvlmo9FskSlRLeNlC3Go5pEJ6Ok,27411
187
132
  replay/utils/time.py,sha256=J8asoQBytPcNw-BLGADYIsKeWhIoN1H5hKiX9t2AMqo,9376
188
133
  replay/utils/types.py,sha256=rD9q9CqEXgF4yy512Hv2nXclvwcnfodOnhBZ1HSUI4c,1260
189
- replay_rec-0.20.1rc0.dist-info/METADATA,sha256=5QtFQnGuoWpCTBMgKX0q9O1tPdBqmTLTOcmzHP0VkNo,13155
190
- replay_rec-0.20.1rc0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
191
- replay_rec-0.20.1rc0.dist-info/licenses/LICENSE,sha256=rPmcA7UrHxBChEAAlJyE24qUWKKl9yLQXxFsKeg_LX4,11344
192
- replay_rec-0.20.1rc0.dist-info/licenses/NOTICE,sha256=k0bo4KHiHLRax5K3XKTTrf2Fi8V91mJ-R3FMdh6Reg0,2002
193
- replay_rec-0.20.1rc0.dist-info/RECORD,,
134
+ replay_rec-0.20.3.dist-info/METADATA,sha256=AS8K7dngECYkEmit2-wSMhqWJpNL8ryJtjndQjctYhs,13562
135
+ replay_rec-0.20.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
136
+ replay_rec-0.20.3.dist-info/licenses/LICENSE,sha256=rPmcA7UrHxBChEAAlJyE24qUWKKl9yLQXxFsKeg_LX4,11344
137
+ replay_rec-0.20.3.dist-info/licenses/NOTICE,sha256=k0bo4KHiHLRax5K3XKTTrf2Fi8V91mJ-R3FMdh6Reg0,2002
138
+ replay_rec-0.20.3.dist-info/RECORD,,
File without changes
@@ -1,62 +0,0 @@
1
- """
2
- Most metrics require dataframe with recommendations
3
- and dataframe with ground truth values —
4
- which objects each user interacted with.
5
-
6
- - recommendations (Union[pandas.DataFrame, spark.DataFrame]):
7
- predictions of a recommender system,
8
- DataFrame with columns ``[user_id, item_id, relevance]``
9
- - ground_truth (Union[pandas.DataFrame, spark.DataFrame]):
10
- test data, DataFrame with columns
11
- ``[user_id, item_id, timestamp, relevance]``
12
-
13
- Metric is calculated for all users, presented in ``ground_truth``
14
- for accurate metric calculation in case when the recommender system generated
15
- recommendation not for all users. It is assumed, that all users,
16
- we want to calculate metric for, have positive interactions.
17
-
18
- But if we have users, who observed the recommendations, but have not responded,
19
- those users will be ignored and metric will be overestimated.
20
- For such case we propose additional optional parameter ``ground_truth_users``,
21
- the dataframe with all users, which should be considered during the metric calculation.
22
-
23
- - ground_truth_users (Optional[Union[pandas.DataFrame, spark.DataFrame]]):
24
- full list of users to calculate metric for, DataFrame with ``user_id`` column
25
-
26
- Every metric is calculated using top ``K`` items for each user.
27
- It is also possible to calculate metrics
28
- using multiple values for ``K`` simultaneously.
29
- In this case the result will be a dictionary and not a number.
30
-
31
- Make sure your recommendations do not contain user-item duplicates
32
- as duplicates could lead to the wrong calculation results.
33
-
34
- - k (Union[Iterable[int], int]):
35
- a single number or a list, specifying the
36
- truncation length for recommendation list for each user
37
-
38
- By default, metrics are averaged by users,
39
- but you can alternatively use method ``metric.median``.
40
- Also, you can get the lower bound
41
- of ``conf_interval`` for a given ``alpha``.
42
-
43
- Diversity metrics require extra parameters on initialization stage,
44
- but do not use ``ground_truth`` parameter.
45
-
46
- For each metric, a formula for its calculation is given, because this is
47
- important for the correct comparison of algorithms, as mentioned in our
48
- `article <https://arxiv.org/abs/2206.12858>`_.
49
- """
50
-
51
- from replay.experimental.metrics.base_metric import Metric, NCISMetric
52
- from replay.experimental.metrics.coverage import Coverage
53
- from replay.experimental.metrics.hitrate import HitRate
54
- from replay.experimental.metrics.map import MAP
55
- from replay.experimental.metrics.mrr import MRR
56
- from replay.experimental.metrics.ncis_precision import NCISPrecision
57
- from replay.experimental.metrics.ndcg import NDCG
58
- from replay.experimental.metrics.precision import Precision
59
- from replay.experimental.metrics.recall import Recall
60
- from replay.experimental.metrics.rocauc import RocAuc
61
- from replay.experimental.metrics.surprisal import Surprisal
62
- from replay.experimental.metrics.unexpectedness import Unexpectedness