RecSim NG: Toward Principled Uncertainty Modeling for Recommender Ecosystems

Overview

RecSim NG: Toward Principled Uncertainty Modeling for Recommender Ecosystems

RecSim NG, a probabilistic platform for multi-agent recommender systems simulation. RecSimNG is a scalable, modular, differentiable simulator implemented in Edward2 and TensorFlow. It offers: a powerful, general probabilistic programming language for agent-behavior specification; an XLA-based vectorized execution model for running simulations on accelerated hardware; and tools for probabilistic inference and latent-variable model learning, backed by automatic differentiation and tracing. We describe RecSim NG and illustrate how it can be used to create transparent, configurable, end-to-end models of a recommender ecosystem. Specifically, we present a collection of use cases that demonstrate how the functionality described above can help both researchers and practitioners easily develop and train novel algorithms for recommender systems. Please refer to Mladenov et al for the high-level design of RecSim NG. Please cite the paper if you use the code from this repository in your work.

Bibtex

@article{mladenov2021recsimng,
    title = {RecSim {NG}: Toward Principled Uncertainty Modeling for Recommender Ecosystems},
    author = {Martin Mladenov, Chih-Wei Hsu, Vihan Jain, Eugene Ie, Christopher Colby, Nicolas Mayoraz, Hubert Pham, Dustin Tran, Ivan Vendrov, Craig Boutilier}
    year = {2021},
    eprint={2103.08057},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

Disclaimer

This is not an officially supported Google product.

Installation and Sample Usage

It is recommended to install RecSim NG using (https://pypi.org/project/recsim_ng/). We want to install the latest version from Edward2's repository:

pip install recsim_ng
pip install -e "git+https://github.com/google/edward2.git#egg=edward2"

Here are some sample commands you could use for testing the installation:

git clone https://github.com/google-research/recsim_ng
cd recsim_ng/recsim_ng/applications/ecosystem_simulation
python ecosystem_simulation_demo.py

Tutorials

To get started, please check out our Colab tutorials. In RecSim NG: Basics, we introduce the RecSim NG model and corresponding modeling APIs and runtime library. We then demonstrate how we define a simulation using entities, behaviors, and stories. Finally, we illustrate differentiable simulation including model learning and inference.

In RecSim NG: Dealing With Uncertainty, we explicitly address the stochastics of the Markov process captured by a DBN. We demonstrate how to use Edward2 in RecSim NG and show how to use the corresponding RecSim NG APIs for inference and learning tasks. Finally, we showcase how the uncertainty APIs of RecSim NG can be used within a recommender-system model-learning application.

Documentation

Please refer to the white paper for the high-level design.

You might also like...
6002project-rl - An implemention of offline RL on recommender system

An implemention of offline RL on recommender system @author: misajie @update: 20

Plex-recommender - Get movie recommendations based on your current PleX library

plex-recommender Description: Get movie/tv recommendations based on your current

Principled Detection of Out-of-Distribution Examples in Neural Networks
Principled Detection of Out-of-Distribution Examples in Neural Networks

ODIN: Out-of-Distribution Detector for Neural Networks This is a PyTorch implementation for detecting out-of-distribution examples in neural networks.

Propose a principled and practically effective framework for unsupervised accuracy estimation and error detection tasks with theoretical analysis and state-of-the-art performance.
Propose a principled and practically effective framework for unsupervised accuracy estimation and error detection tasks with theoretical analysis and state-of-the-art performance.

Detecting Errors and Estimating Accuracy on Unlabeled Data with Self-training Ensembles This project is for the paper: Detecting Errors and Estimating

Code for Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022)

Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022) We consider how a user of a web servi

the code for paper "Energy-Based Open-World Uncertainty Modeling for Confidence Calibration"

EOW-Softmax This code is for the paper "Energy-Based Open-World Uncertainty Modeling for Confidence Calibration". Accepted by ICCV21. Usage Commnd exa

TensorFlow implementation for Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How
TensorFlow implementation for Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How

Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How TensorFlow implementation for Bayesian Modeling and Unce

Toward Spatially Unbiased Generative Models (ICCV 2021)
Toward Spatially Unbiased Generative Models (ICCV 2021)

Toward Spatially Unbiased Generative Models Implementation of Toward Spatially Unbiased Generative Models (ICCV 2021) Overview Recent image generation

This repo is official PyTorch implementation of MobileHumanPose: Toward real-time 3D human pose estimation in mobile devices(CVPRW 2021).
This repo is official PyTorch implementation of MobileHumanPose: Toward real-time 3D human pose estimation in mobile devices(CVPRW 2021).

Github Code of "MobileHumanPose: Toward real-time 3D human pose estimation in mobile devices" Introduction This repo is official PyTorch implementatio

Toward Realistic Single-View 3D Object Reconstruction with Unsupervised Learning from Multiple Images (ICCV 2021)
Toward Realistic Single-View 3D Object Reconstruction with Unsupervised Learning from Multiple Images (ICCV 2021)

Table of Content Introduction Getting Started Datasets Installation Experiments Training & Testing Pretrained models Texture fine-tuning Demo Toward R

⌨ Toward a more useful keyboard
⌨ Toward a more useful keyboard

Toward a more useful keyboard Steve Losh's Modern Space Cadet is an inspiration. It opened my eyes to the fact that there's a more useful keyboard hid

Simple Tensorflow implementation of Toward Spatially Unbiased Generative Models (ICCV 2021)
Simple Tensorflow implementation of Toward Spatially Unbiased Generative Models (ICCV 2021)

Spatial unbiased GANs — Simple TensorFlow Implementation [Paper] : Toward Spatially Unbiased Generative Models (ICCV 2021) Abstract Recent image gener

Toward Model Interpretability in Medical NLP

Toward Model Interpretability in Medical NLP LING380: Topics in Computational Linguistics Final Project James Cross ([email protected]) and Daniel Kim

Repository for
Repository for "Toward Practical Monocular Indoor Depth Estimation" (CVPR 2022)

Toward Practical Monocular Indoor Depth Estimation Cho-Ying Wu, Jialiang Wang, Michael Hall, Ulrich Neumann, Shuochen Su [arXiv] [project site] DistDe

Concept Modeling: Topic Modeling on Images and Text
Concept Modeling: Topic Modeling on Images and Text

Concept is a technique that leverages CLIP and BERTopic-based techniques to perform Concept Modeling on images.

git git《Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking》(CVPR 2021) GitHub:git2] 《Masksembles for Uncertainty Estimation》(CVPR 2021) GitHub:git3]
git git《Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking》(CVPR 2021) GitHub:git2] 《Masksembles for Uncertainty Estimation》(CVPR 2021) GitHub:git3]

Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking Ning Wang, Wengang Zhou, Jie Wang, and Houqiang Li Accepted by CVPR

The repo of the preprinting paper "Labels Are Not Perfect: Inferring Spatial Uncertainty in Object Detection"

Inferring Spatial Uncertainty in Object Detection A teaser version of the code for the paper Labels Are Not Perfect: Inferring Spatial Uncertainty in

Uncertainty-aware Semantic Segmentation of LiDAR Point Clouds for Autonomous Driving
Uncertainty-aware Semantic Segmentation of LiDAR Point Clouds for Autonomous Driving

SalsaNext: Fast, Uncertainty-aware Semantic Segmentation of LiDAR Point Clouds for Autonomous Driving Abstract In this paper, we introduce SalsaNext f

This is the repo for Uncertainty Quantification 360 Toolkit.

UQ360 The Uncertainty Quantification 360 (UQ360) toolkit is an open-source Python package that provides a diverse set of algorithms to quantify uncert

Comments
  • TFDataset trajectories - issue with ownedIterator

    TFDataset trajectories - issue with ownedIterator

    recsim_ng 0.1.2, tfp 0.17, tensorflow 2.9.0

    Trying to create a trajectory from a tf dataset data_variable causes an error.

    tf_dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3])
    x = data.data_variable(
        name="x",
        spec=ValueSpec(a=FieldSpec()),
        data_sequence=TFDataset(dataset=tf_dataset),
        output_fn=lambda t: Value(a=t * t)
    )
    r = runtime.TFRuntime(network=network_lib.Network(variables=[x]), graph_compile=False)
    traj = r.trajectory(length=3)
    

    ValueError: Attempt to convert a value (<tensorflow.python.data.ops.iterator_ops.OwnedIterator object at 0x162105910>) with an unsupported type (<class 'tensorflow.python.data.ops.iterator_ops.OwnedIterator'>) to a Tensor.

    execute still seems to work fine, per recsim_ng's own DataTest, so I think it's possible to work around this by composing a trajectory out of successive executes.

    opened by ckchow 0
  • Incorrect implementation of REINFORCE algorithm

    Incorrect implementation of REINFORCE algorithm

    last_state = tf_runtime.execute(num_steps=horizon - 1) last_metric_value = last_state['metrics state'].get(metric_to_optimize) log_prob = last_state['slate docs_log_prob_accum'].get('doc_ranks') objective = -tf.tensordot(tf.stop_gradient(last_metric_value), log_prob, 1)

    In this above code snippet (interest_evolution_simulation.py, line 45-48), the cumulative_log_prob (across the entire episode) is being weighted by the total cumulative reward from the start to the end of the episode. This seems incorrect as the log_prob at step 't' should be weighted by cumulative reward from step 't' onwards (not from the start).

    opened by ehtsham 5
  • Cannot run interest_evolution_simulation_demo.py

    Cannot run interest_evolution_simulation_demo.py

    I am trying to run interest_evolution_simulation_demo.py to test my installation. I am getting a bunch of warnings and no results are popping up from running the demo. I am guessing this is due to tensorflow version, but not sure.

    prompt from running interest_evolution_simulation_demo.py

    UserWarning: NumPy backend for Edward2 is not available.
      warnings.warn("NumPy backend for Edward2 is not available.")
      2022-03-16 22:10:35.450846: W tensorflow/python/util/util.cc:368] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
    WARNING:tensorflow:AutoGraph could not transform <bound method IteratedMultinomialLogitChoiceModel.choice of <recsim_ng.entities.choice_models.selectors.IteratedMultinomialLogitChoiceModel object at 0x7f985178ddf0>> and will run it as-is.
    Cause: generators are not supported
    To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
    W0316 22:10:37.136438 140294645813824 ag_logging.py:142] AutoGraph could not transform <bound method IteratedMultinomialLogitChoiceModel.choice of <recsim_ng.entities.choice_models.selectors.IteratedMultinomialLogitChoiceModel object at 0x7f985178ddf0>> and will run it as-is.
    Cause: generators are not supported
    To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
    2022-03-16 22:10:42.510012: W tensorflow/core/grappler/costs/op_level_cost_estimator.cc:690] Error in PredictCost() for the op: op: "Softmax" attr { key: "T" value { type: DT_FLOAT } } inputs { dtype: DT_FLOAT shape { unknown_rank: true } } device { type: "CPU" vendor: "AuthenticAMD" model: "241" frequency: 2500 num_cores: 128 environment { key: "cpu_instruction_set" value: "AVX SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2" } environment { key: "eigen" value: "3.4.90" } l1_cache_size: 32768 l2_cache_size: 524288 l3_cache_size: 134217728 memory_size: 268435456 } outputs { dtype: DT_FLOAT shape { unknown_rank: true } }
    2022-03-16 22:10:42.510178: W tensorflow/core/grappler/costs/op_level_cost_estimator.cc:690] Error in PredictCost() for the op: op: "Softmax" attr { key: "T" value { type: DT_FLOAT } } inputs { dtype: DT_FLOAT shape { unknown_rank: true } } device { type: "CPU" vendor: "AuthenticAMD" model: "241" frequency: 2500 num_cores: 128 environment { key: "cpu_instruction_set" value: "AVX SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2" } environment { key: "eigen" value: "3.4.90" } l1_cache_size: 32768 l2_cache_size: 524288 l3_cache_size: 134217728 memory_size: 268435456 } outputs { dtype: DT_FLOAT shape { unknown_rank: true } }
    

    Below are the packages installed

    absl-py                      0.15.0
    astunparse                   1.6.3
    cachetools                   4.2.4
    certifi                      2021.10.8
    charset-normalizer           2.0.12
    clang                        5.0
    cloudpickle                  2.0.0
    cycler                       0.11.0
    decorator                    5.1.1
    dm-tree                      0.1.6
    edward2                      0.0.2
    flatbuffers                  1.12
    fonttools                    4.30.0
    gast                         0.4.0
    gin-config                   0.5.0
    google-auth                  1.35.0
    google-auth-oauthlib         0.4.6
    google-pasta                 0.2.0
    grpcio                       1.44.0
    gym                          0.23.1
    gym-notices                  0.0.6
    h5py                         3.1.0
    idna                         3.3
    importlib-metadata           4.11.3
    keras                        2.8.0
    Keras-Preprocessing          1.1.2
    kiwisolver                   1.4.0
    libclang                     13.0.0
    Markdown                     3.3.6
    matplotlib                   3.5.1
    numpy                        1.22.3
    oauthlib                     3.2.0
    opt-einsum                   3.3.0
    packaging                    21.3
    Pillow                       9.0.1
    pip                          21.2.4
    protobuf                     3.19.4
    pyasn1                       0.4.8
    pyasn1-modules               0.2.8
    pyparsing                    3.0.7
    python-dateutil              2.8.2
    recsim-ng                    0.1.1
    requests                     2.27.1
    requests-oauthlib            1.3.1
    rsa                          4.8
    setuptools                   58.0.4
    six                          1.15.0
    tensorboard                  2.8.0
    tensorboard-data-server      0.6.1
    tensorboard-plugin-wit       1.8.1
    tensorflow                   2.8.0
    tensorflow-estimator         2.7.0
    tensorflow-io-gcs-filesystem 0.24.0
    tensorflow-probability       0.16.0
    termcolor                    1.1.0
    tf-estimator-nightly         2.8.0.dev2021122109
    typing-extensions            3.10.0.2
    urllib3                      1.26.8
    Werkzeug                     2.0.3
    wheel                        0.37.1
    wrapt                        1.12.1
    zipp                         3.7.0
    
    opened by soonjune 3
  • module 'recsim_ng.core.value' has no attribute 'Space'

    module 'recsim_ng.core.value' has no attribute 'Space'

    Hi, I'm following your tutorials, but encounter with one trouble...

    In "The User Model" part of second tutorial (RecSim_NG_Dealing_With_Uncertainty.ipynb), we need to do some imports, as belows:

    from recsim_ng.stories import recommendation_simulation as simulation
    from recsim_ng.applications.latent_variable_model_learning import recommender
    from recsim_ng.entities.recommendation import user
    from recsim_ng.entities.state_models import static
    from recsim_ng.entities.choice_models import selectors
    from recsim_ng.entities.choice_models import affinities
    

    But the second import throw an error as belows:

    AttributeError                            Traceback (most recent call last)
    <ipython-input-5-d9a555230cf0> in <module>
          1 # @title RecSimNG modeling imports.
          2 from recsim_ng.stories import recommendation_simulation as simulation
    ----> 3 from recsim_ng.applications.latent_variable_model_learning import recommender
          4 from recsim_ng.entities.recommendation import user
          5 from recsim_ng.entities.state_models import static
    
    /usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/__init__.py in <module>
         15 
         16 """Module importing the application learning latent variable models."""
    ---> 17 from recsim_ng.applications.latent_variable_model_learning import recommender
         18 from recsim_ng.applications.latent_variable_model_learning import simulation_config
         19 from recsim_ng.applications.latent_variable_model_learning import user
    
    /usr/local/anaconda3/lib/python3.7/site-packages/recsim_ng/applications/latent_variable_model_learning/recommender.py in <module>
         27 Value = value.Value
         28 ValueSpec = value.ValueSpec
    ---> 29 Space = value.Space
         30 
         31 
    
    AttributeError: module 'recsim_ng.core.value' has no attribute 'Space'
    

    And I checked the source code then and indeed, I can't find "Space" Class in recsim_ng.core.value

    Looking forward to your kindly help.

    opened by aSeriousCoder 4
A Python scikit for building and analyzing recommender systems

Overview Surprise is a Python scikit for building and analyzing recommender systems that deal with explicit rating data. Surprise was designed with th

Nicolas Hug 5.7k Jan 1, 2023
Recommender System Papers

Included Conferences: SIGIR 2020, SIGKDD 2020, RecSys 2020, CIKM 2020, AAAI 2021, WSDM 2021, WWW 2021

RUCAIBox 704 Jan 6, 2023
Graph Neural Networks for Recommender Systems

This repository contains code to train and test GNN models for recommendation, mainly using the Deep Graph Library (DGL).

null 217 Jan 4, 2023
NVIDIA Merlin is an open source library designed to accelerate recommender systems on NVIDIA’s GPUs.

NVIDIA Merlin is an open source library providing end-to-end GPU-accelerated recommender systems, from feature engineering and preprocessing to training deep learning models and running inference in production.

null 420 Jan 4, 2023
Collaborative variational bandwidth auto-encoder (VBAE) for recommender systems.

Collaborative Variational Bandwidth Auto-encoder The codes are associated with the following paper: Collaborative Variational Bandwidth Auto-encoder f

Yaochen Zhu 14 Dec 11, 2022
QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.

Yu 1.4k Dec 27, 2022
E-Commerce recommender demo with real-time data and a graph database

?? E-Commerce recommender demo ?? This is a simple stream setup that uses Memgraph to ingest real-time data from a simulated online store. Data is str

g-despot 3 Feb 23, 2022
Movie Recommender System

Movie-Recommender-System Movie-Recommender-System is a web application using which a user can select his/her watched movie from list and system will r

null 1 Jul 14, 2022
Mutual Fund Recommender System. Tailor for fund transactions.

Explainable Mutual Fund Recommendation Data Please see 'DATA_DESCRIPTION.md' for mode detail. Recommender System Methods Baseline Collabarative Fiilte

JHJu 2 May 19, 2022
Movies/TV Recommender

recommender Movies/TV Recommender. Recommends Movies, TV Shows, Actors, Directors, Writers. Setup Create file API_KEY and paste your TMDB API key in i

Aviem Zur 3 Apr 22, 2022