warprec 2.1.6__tar.gz → 2.1.8__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.
- {warprec-2.1.6 → warprec-2.1.8}/PKG-INFO +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/pyproject.toml +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/common/initialize.py +85 -46
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/dataset.py +5 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/interactions.py +18 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/filtering.py +29 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/reader/azureblob_reader.py +10 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/schema.py +23 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/splitting/splitter.py +45 -1
- warprec-2.1.8/warprec/data/stash.py +69 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/evaluator.py +43 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/auc.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/f1.py +1 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/gauc.py +2 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/ndcg.py +3 -6
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/base_metric.py +80 -15
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/pop_reo.py +11 -6
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/pop_rsp.py +5 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/coverage/item_coverage.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/coverage/user_coverage.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/coverage/user_coverage_at_n.py +6 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/debiased/base.py +4 -11
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/diversity/gini_index.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/diversity/shannon_entropy.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/biasdisparitybd.py +1 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/biasdisparitybs.py +5 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/itemmadranking.py +2 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/itemmadrating.py +6 -3
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/reo.py +7 -14
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/rsp.py +9 -19
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/usermadranking.py +5 -8
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/usermadrating.py +2 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/multiobjective/euclideandistance.py +54 -15
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/multiobjective/hypervolume.py +50 -13
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/design.py +2 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/estimate.py +3 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/eval.py +2 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/remotes/ml.py +2 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/base_recommender.py +67 -11
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/cdae.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/diffrec.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/elsa.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/macridvae.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multidae.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multivae.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/dgcf.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/egcf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/esigcf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/gcmc.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightccf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcl.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcn.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcnpp.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgode.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/macrgcn.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/mixrec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ngcf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/paac.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/popdcl.py +0 -7
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/recdcl.py +0 -6
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgcl.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgl.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simgcl.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simrec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ultragcn.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/xsimgcl.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/bpr.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/fism.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/macrmf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/neural/convncf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/neural/neumf.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/neural/twotower.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/afm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/dcn.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/dcnv2.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/deepfm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/fm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/nfm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/wideanddeep.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/xdeepfm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/cke.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/kahfm.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/kgat.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/kgcn.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/kgflex.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/kgin.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/ripplenet.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/bm3.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/freedom.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/lattice.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/mgcn.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/mmgcn.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/vbpr.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/bert4rec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/bsarec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/caser.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/cl4srec.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/core.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/duorec.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/esasrec.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/fossil.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/gru4rec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/gsasrec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/lightsans.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/linrec.py +0 -4
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/narm.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/sasrec.py +0 -5
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/objectives.py +2 -1
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/trainer.py +3 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/__init__.py +0 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/common.py +27 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/config.py +218 -112
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/evaluation_configuration.py +39 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/model_configuration.py +63 -9
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/reader_configuration.py +56 -12
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/splitter_configuration.py +40 -46
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/enums.py +21 -102
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/helpers.py +36 -2
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/registry.py +48 -0
- {warprec-2.1.6 → warprec-2.1.8}/LICENSE +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/README.md +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/common/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/common/run_state.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/common/std_logs.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/common.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/context.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/knowledge.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/multimodal.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/sessions.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/train_structures/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/train_structures/custom_collate_fn.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/train_structures/interaction_structures.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/train_structures/session_structures.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/entities/transactions.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/eval_loaders.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/ranking.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/reader/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/reader/base_reader.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/reader/local_reader.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/splitting/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/splitting/strategies.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/writer/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/writer/azureblob_writer.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/writer/base_writer.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/data/writer/local_writer.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/factory.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/hit_rate.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/lauc.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/logloss.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/map.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/mar.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/mrr.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/precision.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/accuracy/recall.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/aclt.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/aplt.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/arp.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/bias/long_tail.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/coverage/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/coverage/numretrieved.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/debiased/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/debiased/dcg.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/debiased/recall.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/diversity/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/diversity/srecall.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/fairness/biasdisparitybr.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/multiobjective/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/novelty/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/novelty/efd.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/novelty/epc.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/novelty/novelty_profile.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/rating/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/rating/mae.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/rating/mse.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/metrics/rating/rmse.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/propensity.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/evaluation/statistical_significance.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/common.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/remotes/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/remotes/data.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/swarm.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/pipelines/train.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/callbacks.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/ease.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/sansa.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/graph_utils.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/graph_based/rp3beta.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/knn/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknn.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknntd.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/knn/userknn.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/knn/userknntd.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/admmslim.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials2008.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/slim.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/collaborative_filtering_recommender/neural/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/content_based_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/content_based_recommender/vsm.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/context_aware_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/hybrid_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/hybrid_recommender/addease.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/hybrid_recommender/attributeitemknn.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/hybrid_recommender/attributeuserknn.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/hybrid_recommender/cease.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/knowledge_aware_recommender/knowledge_utils.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/layers.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/losses.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/lr_scheduler_wrapper.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/multimodal_recommender/multimodal_utils.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/optimizer_wrapper.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/proxy.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/reranking/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/reranking/base.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/reranking/calibration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/reranking/factory.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/reranking/mmr.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/sequential_recommender/stan.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/similarities.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/dashboard_callbacks.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/logger_callbacks.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/runtime.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/scheduler_wrapper.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/trainer/search_algorithm_wrapper.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/unpersonalized_recommender/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/unpersonalized_recommender/pop.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/recommenders/unpersonalized_recommender/random.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/run.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serve.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/api.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/app.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/catalogue.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/context.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/deployments.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/errors.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/mcp.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/payload.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/schemas.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/serving/servable.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/callback.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/dashboard_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/estimate_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/general_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/autoencoder_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/graph_based_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/knn_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/latent_factor_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/neural_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/content_based_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/context_aware_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/hybrid_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/knowledge_aware_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/multimodal_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/sequential_model_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/recommender_model_config/unpersonalized_config.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/rerank_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/run_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/search_space_wrapper.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/serving_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/training_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/config/writer_configuration.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/logger/__init__.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/logger/logger.py +0 -0
- {warprec-2.1.6 → warprec-2.1.8}/warprec/utils/pause.py +0 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
299
|
+
sep=side.sep,
|
|
300
|
+
header=side.header,
|
|
266
301
|
)
|
|
267
302
|
case "parquet":
|
|
268
303
|
side_data = reader.read_parquet(
|
|
269
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
"
|
|
382
|
-
|
|
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
|
-
"
|
|
393
|
-
|
|
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
|
-
#
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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] = {
|
|
@@ -20,6 +20,7 @@ from warprec.data.entities import (
|
|
|
20
20
|
Sessions,
|
|
21
21
|
Transactions,
|
|
22
22
|
)
|
|
23
|
+
from warprec.data.stash import METRIC_ARGUMENTS, MODEL_ARGUMENTS, check_stash
|
|
23
24
|
from warprec.data.schema import ColumnLabels, ContextSpec, SideData, SignalOptions
|
|
24
25
|
from warprec.data.eval_loaders import (
|
|
25
26
|
EvaluationDataset,
|
|
@@ -1366,10 +1367,14 @@ class Dataset:
|
|
|
1366
1367
|
def add_to_stash(self, key: str, value: Any):
|
|
1367
1368
|
"""Add a custom structure to the stash.
|
|
1368
1369
|
|
|
1370
|
+
The stash is passed to every model and every metric next to the
|
|
1371
|
+
arguments WarpRec gives them, so those names cannot be used.
|
|
1372
|
+
|
|
1369
1373
|
Args:
|
|
1370
1374
|
key (str): The key of the custom structure.
|
|
1371
1375
|
value (Any): The value of the custom structure.
|
|
1372
1376
|
"""
|
|
1377
|
+
check_stash({key: value}, MODEL_ARGUMENTS | METRIC_ARGUMENTS, "model or metric")
|
|
1373
1378
|
self._stash[key] = value
|
|
1374
1379
|
|
|
1375
1380
|
def update_mappings(self, user_mapping: dict, item_mapping: dict):
|
|
@@ -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):
|
|
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.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from typing import Any, Dict, FrozenSet, Iterable
|
|
2
|
+
|
|
3
|
+
# The keyword arguments WarpRec passes to every model it builds, restores or
|
|
4
|
+
# estimates, next to the stash.
|
|
5
|
+
MODEL_ARGUMENTS: FrozenSet[str] = frozenset(
|
|
6
|
+
{
|
|
7
|
+
"name",
|
|
8
|
+
"params",
|
|
9
|
+
"info",
|
|
10
|
+
"interactions",
|
|
11
|
+
"transactions",
|
|
12
|
+
"knowledge",
|
|
13
|
+
"multimodal",
|
|
14
|
+
"sessions",
|
|
15
|
+
"seed",
|
|
16
|
+
"block_size",
|
|
17
|
+
"chunk_size",
|
|
18
|
+
"checkpoint",
|
|
19
|
+
"strict",
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# The keyword arguments the evaluator passes to every metric, next to the stash.
|
|
24
|
+
METRIC_ARGUMENTS: FrozenSet[str] = frozenset(
|
|
25
|
+
{
|
|
26
|
+
"k",
|
|
27
|
+
"num_users",
|
|
28
|
+
"num_items",
|
|
29
|
+
"item_interactions",
|
|
30
|
+
"item_indices",
|
|
31
|
+
"train_matrix",
|
|
32
|
+
"feature_lookup",
|
|
33
|
+
"user_cluster",
|
|
34
|
+
"item_cluster",
|
|
35
|
+
"propensity",
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def check_stash(
|
|
41
|
+
stash: Dict[str, Any], reserved: Iterable[str], receiver: str
|
|
42
|
+
) -> Dict[str, Any]:
|
|
43
|
+
"""Refuse a stash entry named like an argument WarpRec passes itself.
|
|
44
|
+
|
|
45
|
+
The stash is passed as keyword arguments next to WarpRec's own, so an entry
|
|
46
|
+
with one of their names would replace it, or make the call fail with a
|
|
47
|
+
message that does not mention the stash.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
stash (Dict[str, Any]): The stash.
|
|
51
|
+
reserved (Iterable[str]): The arguments WarpRec passes to the receiver.
|
|
52
|
+
receiver (str): What the stash is passed to, e.g. 'model' or 'metric'.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Dict[str, Any]: The stash, unchanged.
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
ValueError: If a stash entry has the name of a reserved argument.
|
|
59
|
+
"""
|
|
60
|
+
reserved = set(reserved)
|
|
61
|
+
taken = sorted(key for key in stash if key in reserved)
|
|
62
|
+
if taken:
|
|
63
|
+
raise ValueError(
|
|
64
|
+
f"The stash entry {', '.join(repr(key) for key in taken)} has the "
|
|
65
|
+
f"name of an argument WarpRec passes to every {receiver} itself, so "
|
|
66
|
+
"one would replace the other. Rename the entry; the names WarpRec "
|
|
67
|
+
f"uses are {sorted(reserved)}."
|
|
68
|
+
)
|
|
69
|
+
return stash
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import time
|
|
2
2
|
from typing import List, Dict, Optional, Set, Any, Tuple
|
|
3
3
|
|
|
4
|
+
import numpy as np
|
|
4
5
|
import torch
|
|
5
6
|
from torch import Tensor
|
|
6
7
|
from torch.utils.data import DataLoader
|
|
7
8
|
from scipy.sparse import csr_matrix
|
|
8
9
|
|
|
9
10
|
from warprec.data import Dataset
|
|
11
|
+
from warprec.data.stash import METRIC_ARGUMENTS, check_stash
|
|
10
12
|
from warprec.data.ranking import (
|
|
11
13
|
cold_item_candidates,
|
|
12
14
|
mask_seen_in_context,
|
|
@@ -131,8 +133,13 @@ class Evaluator:
|
|
|
131
133
|
"user_cluster": user_cluster,
|
|
132
134
|
"item_cluster": item_cluster,
|
|
133
135
|
"propensity": propensity,
|
|
134
|
-
**additional_data,
|
|
135
136
|
}
|
|
137
|
+
# The additional data (the dataset's stash) is passed next to these and
|
|
138
|
+
# to the cutoff, so a key of theirs would replace one of WarpRec's.
|
|
139
|
+
check_stash(
|
|
140
|
+
additional_data, {"k", *self.common_params, *METRIC_ARGUMENTS}, "metric"
|
|
141
|
+
)
|
|
142
|
+
self.common_params.update(additional_data)
|
|
136
143
|
self._init_metrics(metric_list, complex_metrics)
|
|
137
144
|
|
|
138
145
|
def _init_metrics(
|
|
@@ -542,6 +549,11 @@ class Evaluator:
|
|
|
542
549
|
def compute_results(self) -> Dict[int, Dict[str, float | Tensor]]:
|
|
543
550
|
"""The method to retrieve computed results in dictionary format.
|
|
544
551
|
|
|
552
|
+
Every value is either a tensor with one entry per user index, for a
|
|
553
|
+
metric averaged over users (NaN for a user it does not apply to), or a
|
|
554
|
+
Python float, for a global value. A 0-d tensor or another number a
|
|
555
|
+
metric returns is turned into a float.
|
|
556
|
+
|
|
545
557
|
Returns:
|
|
546
558
|
Dict[int, Dict[str, float | Tensor]]: The dictionary containing the results.
|
|
547
559
|
"""
|
|
@@ -550,9 +562,38 @@ class Evaluator:
|
|
|
550
562
|
results[k] = {}
|
|
551
563
|
for metric in metric_instances:
|
|
552
564
|
metric_result = metric.compute()
|
|
553
|
-
|
|
565
|
+
for name, value in metric_result.items():
|
|
566
|
+
results[k][name] = self._as_result(name, value)
|
|
554
567
|
return results
|
|
555
568
|
|
|
569
|
+
def _as_result(self, name: str, value: Any) -> float | Tensor:
|
|
570
|
+
"""Bring a metric's value to one of the two shapes results have.
|
|
571
|
+
|
|
572
|
+
Args:
|
|
573
|
+
name (str): The key the metric reports the value under.
|
|
574
|
+
value (Any): The value.
|
|
575
|
+
|
|
576
|
+
Returns:
|
|
577
|
+
float | Tensor: A tensor with one value per user, or a float.
|
|
578
|
+
|
|
579
|
+
Raises:
|
|
580
|
+
ValueError: If the value is neither a number nor a per-user tensor.
|
|
581
|
+
"""
|
|
582
|
+
num_users = self.common_params["num_users"]
|
|
583
|
+
if isinstance(value, Tensor):
|
|
584
|
+
if value.dim() == 0:
|
|
585
|
+
return float(value.item())
|
|
586
|
+
if value.dim() == 1 and value.numel() == num_users:
|
|
587
|
+
return value
|
|
588
|
+
elif isinstance(value, (int, float, np.number)) and not isinstance(value, bool):
|
|
589
|
+
return float(value)
|
|
590
|
+
shape = tuple(value.shape) if isinstance(value, Tensor) else None
|
|
591
|
+
raise ValueError(
|
|
592
|
+
f"The metric result '{name}' is a {type(value).__name__}"
|
|
593
|
+
f"{f' of shape {shape}' if shape is not None else ''}. A metric "
|
|
594
|
+
f"reports a tensor with one value per user ({num_users}) or a number."
|
|
595
|
+
)
|
|
596
|
+
|
|
556
597
|
def _retrieve_sequences_for_user(
|
|
557
598
|
self, dataset: Dataset, user_indices: List[int], max_seq_len: int
|
|
558
599
|
) -> Tuple[Tensor, Tensor]:
|
|
@@ -44,7 +44,7 @@ class AUC(BaseMetric):
|
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
def update(self, preds: Tensor, **kwargs: Any):
|
|
47
|
-
target =
|
|
47
|
+
target = self.block(kwargs, "binary_relevance", preds)
|
|
48
48
|
|
|
49
49
|
# Compute area and positives
|
|
50
50
|
area, positives = self.compute_area_stats(preds, target, self.num_items)
|