百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

session-rec

> 编程语言
开源

基于 Python 的框架,用于构建和评估基于会话的和对会话情况具备认知的推荐系统。

390 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

基于 Python 的框架,用于构建和评估基于会话的和对会话情况具备认知的推荐系统。

session-rec

Introduction

session-rec is a Python-based framework for building and evaluating recommender systems (Python 3.5.x). It implements a suite of state-of-the-art algorithms and baselines for session-based and session-aware recommendation.

The authors developed this framework to carry out the experiments described in:

    S. Latifi, N. Mauro and D. Jannach. 2021. Session-aware recommendation: a surprising quest for the state-of-the-art. Information Sciences.




    M. Ludewig, N. Mauro, S. Latifi and D. Jannach. 2020. Empirical analysis of session-based recommendation algorithms. User Modeling and User-Adapted Interaction 31 (1), 149-181. 




    M. Ludewig, N. Mauro, S. Latifi and D. Jannach. Performance comparison of neural and non-neural approaches to session-based recommendation. 2019. Proceedings of the 13th ACM conference on recommender systems, 462-466. 




     M. Ludewig and D. Jannach. Evaluation of session-based recommendation algorithms. 2018. User Modeling and User-Adapted Interaction 28 (4-5), 331-390. 

Parts of the framework and its algorithms are based on code developed and shared by:

    Quadrana et al., Personalizing Session-based Recommendations with Hierarchical Recurrent Neural Networks, RecSys 2017. (Original Code).




    Ruocco et al., Inter-session modeling for session-based recommendation, DLRS 2017. (Original Code).




    Ying et al., Sequential recommender system based on hierarchical attention network, IJCAI 2018. (Original Code).




    Liang et al., Neural cross-session filtering: Next-item prediction under intra- and inter-session context, IEEE Intelligent Systems 2019. (Original Code).




    Phuong et al., Neural session-aware recommendation, IEEE Access 2019. (Original Code).




    Rendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI 2009. (Original Code).




    Mi et al., Context Tree for Adaptive Session-based Recommendation, 2018. (Code shared by the authors).




    Hidasi et al., Recurrent Neural Networks with Top-k Gains for Session-based Recommendations, CoRR
    abs/1706.03847, 2017. (Original Code).




    Liu et al., STAMP: Short-Term Attention/Memory Priority Model for Session-based Recommendation, KDD
    2018. (Original Code).




    Li et al., Neural Attentive Session-based Recommendation, CIKM 2017. (Original Code).




    Yuan et al., A Simple but Hard-to-Beat Baseline for Session-based Recommendations, CoRR
    abs/1808.05163, 2018. (Code shared by the authors).




    Wu et al., Session-based recommendation with graph neural networks, AAAI, 2019. (Original Code).




    Wang et al., A collaborative session-based recommendation approach with parallel memory modules, SIGIR, 2019. (Original Code).




    Rendle et al., Factorizing Personalized Markov Chains for Next-basket Recommendation. WWW 2010. (Original
    Code).




    Kabbur et al., FISM: Factored Item Similarity Models for top-N Recommender Systems, KDD 2013. (Original
    Code).




    He and McAuley. Fusing Similarity Models with Markov Chains for Sparse Sequential Recommendation.
    CoRR abs/1609.09152, 2016. (Original
    Code).

Requirements

To run session-aware, the following libraries are required:

Anaconda 4.X (Python 3.5)

Pympler

NumPy

SciPy

BLAS

Sklearn

Dill

Pandas

Theano

Pyyaml

CUDA

Tensorflow

Theano

Psutil

Scikit-learn

Tensorflow-gpu

NetworkX

Certifi

NumExpr

Pytables

Python-dateutil

Pytz

Six

Keras

Scikit-optimize

Python-telegram-bot

Installation

Using docker 

Download and Install Docker (https://www.docker.com/)

Run the following commands:

If you are using Windows or you are using Linux but you don't have a GPU: docker pull maltel/session-rec-cpu:v1

If you are using LINUX and you have a GPU: docker pull maltel/session-rec-gpu:v1

Download the repository: https://github.com/rn5l/session-rec.git

Using Anaconda

Download and Install Anaconda (https://www.anaconda.com/distribution/)

Run the following command:

        From the main folder run: 

If you have a GPU: conda install --yes --file environment_gpu.yml

If you don't have a GPU or you are using Windows: conda install --yes --file environment_cpu.yml

Activate the conda environment: conda activate srec37

Download the repository: https://github.com/rn5l/session-rec.git

Example of Experiments

The data folder contains a small sample dataset. It's possible to have an overview of how the framework works by using as a configuration file:

For session-based models:

        example_next.yml to predict the next item in the session. 
    

    

        example_multiple.yml to predict the remaining items of the session.

For session-aware models:

        example_session_aware_opt.yml to optimize the models. 
    

    

        example_session_aware_exp.yml to evaluate the models.

At the end of the experiments, you can find the evalutaion results in the "results" folder.

How to Run It

Run experiments using the configuration file

        Create folders conf/in and conf/out. Configure a configuration file *.yml and put it into the folder named conf/in. Examples of configuration
        files are listed in the conf folder. It is possible to configure multiple files and put them all in
        the conf/in folder. When a configuration file in conf/in has been executed, it will be moved to the folder conf/out.
    

    

        Using Docker:  
        Run the following command from the main folder: 

If you are using Linux and you have a GPU:

            ./dpython_gpu run_config.py conf/in conf/out

If you are using Linux and you don't have a GPU:

            ./dpython run_config.py conf/in conf/out

If you are using Windows:

            ./dpython.bat run_config.py conf/in conf/out
         
        

    

    

    

        Using Anaconda: 
        Run the following command from the main folder: 

If you are using Linux and you have a GPU:

                THEANO_FLAGS="device=cuda0,floatX=float32" CUDA_DEVICE_ORDER=PCI_BUS_ID python run_config.py conf/in conf/out

If you are using Windows or you are using Linux but you don't have a GPU:

bash
                python run_config.py conf/in conf/out
            
            

        

    

    

        Results and run times will be displayed and saved to the results folder as config.
    

    

        If you want to run a specific configuration file, you have to use:
        
        conf/example_next.yml
        
        instead of:
        
        conf/in conf/out

Dataset preprocessing

            Unzip any dataset file to the data folder, i.e., rsc15-clicks.dat will then be in the folder
            data/rsc15/raw
        

        

            Open and edit any configuration file in the folder conf/preprocess/.. to configure the preprocessing method and parameters.
            

                

                    See, e.g., conf/preprocess/window/rsc15.yml for an example with comments.
                

            

        

        

            Run a configuration file with the following command using the commands described above based on your OS. For example for Linux users that have a GPU and are using docker: 
            
                ./dpython_gpu run_preprocessing.py conf/preprocess/window/rsc15.yml
            
            
            Otherwise, replace  ./dpython_gpu  with the correct command based on your installation and your OS.

How to Configure It

Start from one of the examples in the conf folder.

Essential Options

Algorithms

Nearest Neighbors

Session-based Neural Models

Session-aware Neural Models

Factorization-based Methods

Related Datasets

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言