Giter Club home page Giter Club logo

virtualtaobao's Introduction

VirtualTaobao

This project provides VirtualTaobao simulators trained from the real-data of Taobao, one of the largest online retail platforms. In Taobao, when a customer entered some query, the recommondation system returns a list of items according to the query and the customer profile. The system is expected to return a good list such that customers will have high chances of clicking the items.

Using VirtualTaobao simulator, one can access a "live" environment just like the real Taobao environment. Virtual customers will be generated once at a time, the virtual customer starts a query, and the recommendation system needs to return a list of items. The virtual customer will decide if it would like to click the items in the list, similar to a real customer.

How VirtualTaobao was trained is described in

Jing-Cheng Shi, Yang Yu, Qing Da, Shi-Yong Chen, and An-Xiang Zeng. Virtual-Taobao: Virtualizing real-world online retail environment for reinforcement learning. In: Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI’19), Honolulu, HI, 2019.

We release in this repository a VirtualTaobao model for both the recommondation system research and the reinforcement learning research (see the supervised learning and reinforcement learning use cases below). Anyone can use this simulator freely, but should give proper credit to the above reference.

Currently, VirtualTaobao V0 model (VirtualTB-v0) is provided, which was trained from a middle-scaled anonymized Taobao dataset. More larger models will be released soon.

Installation

pip install -e .

Simulated Environment

Virtual Taobao simulates the customers, items, and recommendation system.

  • A customer is associated with 11 static attributes that has been one-hot encoded in to 88 binary dimensions, and 3-dimensional dynamic attributes. Here, static/dynmaic means whether the features will change during an interactive process. The attributes information about involve customer age, customer gender, customer browsing history, etc.
  • An item is associated with 27-dimensional attributes indicating the price, sales volume, CTR, etc. (For confidence issue, the itemset content is not exposed.)

An interactive process between the system and a customer is as follows

  1. Virtual Taobao samples a feature vector of the customer, including both the customer's description and customer's query.
  2. The system retrives a set of related items according to the query, forming the whole itemset.
  3. The system uses a model to assign a weight vector corresponding to the item attributes.
  4. The system calculates the product between the weight vector and the item attributes for each item, and selects the top 10 items with the highest values.
  5. The selected 10 items are pushed to the customer. Then, the customer will choose to click on some items (results in CTR++), browse the next page (results in starting over from step 2 with changed customer features), or leave the platform (results in the end of the session).

In the above process, the model in step 3, is to be trained. The model inputs the features of the customer and the itemset, and outputs a 27-dimensional weight vector.

Usage for Supervised Learning

A data set is prepared at

virtualTB/SupervisedLearning/dataset.txt

Each line of the data set consists an instance of features, labels, and the number of clicks, separated by tab.

To train a model from the data set, the following codes give an demonstration using PyTorch

virtualTB/SupervisedLearning/main.py

which contains a full process from data set loading, model training, and model test.

Usage for Reinforcement Learning

Here is a simplest example of using VirtualTaobao as an environment for reinforcement learning. A random action is sampled every step to do the recommendation.

import gym
import virtualTB

env = gym.make('VirtualTB-v0')
print(env.action_space)
print(env.observation_space)
print(env.observation_space.low)
print(env.observation_space.high)
state = env.reset()
while True:
    env.render()
    action = env.action_space.sample()
    state, reward, done, info = env.step(action)
    
    if done: break
env.render()

As a more complete example using DDPG reinforcement learning algorithm and PyTorch is placed in

virtualTB/ReinforcementLearning/main.py

Acknowledgement

This project is an outcome of a joint work of Nanjing University and Alibaba Group, Inc.

virtualtaobao's People

Contributors

eyounx avatar roooooo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

virtualtaobao's Issues

VirtualTB.render doesn't work

hi, buddie. the variable 'c' in render (line 71 of the envs/virtualTB.py) is not defined. i guess, should it be 'self.total_c' ?

generator_model/action_model/leave_model是否可以按需修改并训练?该平台可否用自己的数据?

1.VirtualTB.py中load已训练好的generator_model/action_model/leave_model.pt来生成相应操作。我们需要修改UserModel、ActionModel、LeaveModel.py ,并根据需求(特征维度、动作维度等需要调整)重新训练generator_model/action_model/leave_model.pt。请问generator_model/action_model/leave_model是怎么训练的?并没有提供这部分的代码。
2.这和issue【Training the simulator with my own data】是类似的问题,平台是否支持用自己的数据进行训练?

how to use it on personal dataset in my search Engine

I am building an demo e-commerce search Engine for recommending item list to users with DDPG reinforcement learning algorithm predicting . But I am confused with the virtualTaobao as a virtual training environment to help me apply FL to the online system.
1 what The virtualTao help me for the above goal?
2 how to use the VirturalTao adapt my dataset for giving score to get topK list,can you give a example step for me ?
3 [virtualTB/SupervisedLearning/dataset.txt ] can you give a detail explanation for the features , label ,and the number of clicks. AND why the lables is multi length?

拟使用VirtualTaobao作为实验平台,寻求帮助

您好,我最近在做一个研究工作,准备以VirtualTaobao作为实验平台。但是发现一个问题,样例给的DDPG模型,在gamma=0.5、tau=0.003、hidden_size=128、记忆批次为32、迭代次数5000+的条件下,CTR趋于1。我使用基于DDPG改进的其他算法也是在优化之后趋于1。因此无法进行对比,我在想是不是因为数据集太小产生了过拟合?另外想请问一下,现在大数据集的模型完成了吗?能否共享大数据集模型?或者能否共享一下源码便于我训练其他数据集的模型?非常希望得到您的帮助。

Training the simulator with my own data

Hi, may I check that if I have my own data set, is there a way to use the framework provided to train a virtual environment resembles my own platform? Thanks.

Is there any benchmark?

I want to contribute to this repository with new RL algorithm. However, there is no benchmark in this repository and the AAAI2019 paper.

Could you release some benchmarks ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.