Bundle Graph Convolutional Network

Overview

Bundle Graph Convolutional Network

This is our Pytorch implementation for the paper:

Jianxin Chang, Chen Gao, Xiangnan He, Depeng Jin and Yong Li. Bundle Graph Convolutional Network, Paper in ACM DL or Paper in arXiv. In SIGIR'20, Xi'an, China, July 25-30, 2020.

Author: Jianxin Chang ([email protected])

Introduction

Bundle Graph Convolutional Network (BGCN) is a bundle recommendation solution based on graph neural network, explicitly re-constructing the two kinds of interaction and an affiliation into the graph. With item nodes as the bridge, graph convolutional propagation between user and bundle nodes makes the learned representations capture the item level semantics.

Citation

If you want to use our codes and datasets in your research, please cite:

@inproceedings{BGCN20,
  author    = {Jianxin Chang and 
               Chen Gao and 
               Xiangnan He and 
               Depeng Jin and 
               Yong Li},
  title     = {Bundle Recommendation with Graph Convolutional Networks},
  booktitle = {Proceedings of the 43nd International {ACM} {SIGIR} Conference on
               Research and Development in Information Retrieval, {SIGIR} 2020, Xi'an,
               China, July 25-30, 2020.},
  year      = {2020},
}

Requirement

The code has been tested running under Python 3.7.0. The required packages are as follows:

  • torch == 1.2.0
  • numpy == 1.17.4
  • scipy == 1.4.1
  • temsorboardX == 2.0

Usage

The hyperparameter search range and optimal settings have been clearly stated in the codes (see the 'CONFIG' dict in config.py).

  • Train
python main.py 
  • Futher Train

Replace 'sample' from 'simple' to 'hard' in CONFIG and add model file path obtained by Train to 'conti_train', then run

python main.py 
  • Test

Add model path obtained by Futher Train to 'test' in CONFIG, then run

python eval_main.py 

Some important hyperparameters:

  • lrs

    • It indicates the learning rates.
    • The learning rate is searched in {1e-5, 3e-5, 1e-4, 3e-4, 1e-3, 3e-3}.
  • mess_dropouts

    • It indicates the message dropout ratio, which randomly drops out the outgoing messages.
    • We search the message dropout within {0, 0.1, 0.3, 0.5}.
  • node_dropouts

    • It indicates the node dropout ratio, which randomly blocks a particular node and discard all its outgoing messages.
    • We search the node dropout within {0, 0.1, 0.3, 0.5}.
  • decays

    • we adopt L2 regularization and use the decays to control the penalty strength.
    • L2 regularization term is tuned in {1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2}.
  • hard_window

    • It indicates the difficulty of sampling in the hard-negative sampler.
    • We set it to the top thirty percent.
  • hard_prob

    • It indicates the probability of using hard-negative samples in the further training stage.
    • We set it to 0.8 (0.4 in the item level and 0.4 in the bundle level), so the probability of simple samples is 0.2.

Dataset

We provide one processed dataset: Netease.

  • user_bundle_train.txt

    • Train file.
    • Each line is 'userID\t bundleID\n'.
    • Every observed interaction means user u once interacted bundle b.
  • user_item.txt

    • Train file.
    • Each line is 'userID\t itemID\n'.
    • Every observed interaction means user u once interacted item i.
  • bundle_item.txt

    • Train file.
    • Each line is 'bundleID\t itemID\n'.
    • Every entry means bundle b contains item i.
  • Netease_data_size.txt

    • Assist file.
    • The only line is 'userNum\t bundleNum\t itemNum\n'.
    • The triplet denotes the number of users, bundles and items, respectively.
  • user_bundle_tune.txt

    • Tune file.
    • Each line is 'userID\t bundleID\n'.
    • Every observed interaction means user u once interacted bundle b.
  • user_bundle_test.txt

    • Test file.
    • Each line is 'userID\t bundleID\n'.
    • Every observed interaction means user u once interacted bundle b.
You might also like...
Roaster - this gui app + program bundle roasts.

Roaster - this gui app + program bundle roasts.

This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning].

CG3 This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning]. R

Cancer Drug Response Prediction via a Hybrid Graph Convolutional Network
Cancer Drug Response Prediction via a Hybrid Graph Convolutional Network

DeepCDR Cancer Drug Response Prediction via a Hybrid Graph Convolutional Network This work has been accepted to ECCB2020 and was also published in the

A PyTorch implementation of
A PyTorch implementation of "Signed Graph Convolutional Network" (ICDM 2018).

SGCN ⠀ A PyTorch implementation of Signed Graph Convolutional Network (ICDM 2018). Abstract Due to the fact much of today's data can be represented as

A PyTorch implementation of the Relational Graph Convolutional Network (RGCN).
A PyTorch implementation of the Relational Graph Convolutional Network (RGCN).

Torch-RGCN Torch-RGCN is a PyTorch implementation of the RGCN, originally proposed by Schlichtkrull et al. in Modeling Relational Data with Graph Conv

ZSL-KG is a general-purpose zero-shot learning framework with a novel transformer graph convolutional network (TrGCN) to learn class representation from common sense knowledge graphs.
ZSL-KG is a general-purpose zero-shot learning framework with a novel transformer graph convolutional network (TrGCN) to learn class representation from common sense knowledge graphs.

ZSL-KG is a general-purpose zero-shot learning framework with a novel transformer graph convolutional network (TrGCN) to learn class representa

MVGCN: a novel multi-view graph convolutional network (MVGCN) framework for link prediction in biomedical bipartite networks.

MVGCN MVGCN: a novel multi-view graph convolutional network (MVGCN) framework for link prediction in biomedical bipartite networks. Developer: Fu Hait

Meta graph convolutional neural network-assisted resilient swarm communications
Meta graph convolutional neural network-assisted resilient swarm communications

Resilient UAV Swarm Communications with Graph Convolutional Neural Network This repository contains the source codes of Resilient UAV Swarm Communicat

Official implementation of the paper "Steganographer Detection via a Similarity Accumulation Graph Convolutional Network"

SAGCN - Official PyTorch Implementation | Paper | Project Page This is the official implementation of the paper "Steganographer detection via a simila

This is a model made out of Neural Network specifically a Convolutional Neural Network model
This is a model made out of Neural Network specifically a Convolutional Neural Network model

This is a model made out of Neural Network specifically a Convolutional Neural Network model. This was done with a pre-built dataset from the tensorflow and keras packages. There are other alternative libraries that can be used for this purpose, one of which is the PyTorch library.

This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of Coordinate Independent Convolutional Networks.
This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of Coordinate Independent Convolutional Networks.

Orientation independent Möbius CNNs This repository implements and evaluates convolutional networks on the Möbius strip as toy model instantiations of

CoSMA: Convolutional Semi-Regular Mesh Autoencoder. From Paper
CoSMA: Convolutional Semi-Regular Mesh Autoencoder. From Paper "Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes"

Mesh Convolutional Autoencoder for Semi-Regular Meshes of Different Sizes Implementation of CoSMA: Convolutional Semi-Regular Mesh Autoencoder arXiv p

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL [Deep Graph Library] and PyTorch.

This is an open-source toolkit for Heterogeneous Graph Neural Network(OpenHGNN) based on DGL [Deep Graph Library] and PyTorch.

Unofficial TensorFlow implementation of Protein Interface Prediction using Graph Convolutional Networks.
Unofficial TensorFlow implementation of Protein Interface Prediction using Graph Convolutional Networks.

[TensorFlow] Protein Interface Prediction using Graph Convolutional Networks Unofficial TensorFlow implementation of Protein Interface Prediction usin

PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021.

GCResNet PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021. The code will

A PyTorch implementation of
A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019).

ClusterGCN ⠀⠀ A PyTorch implementation of "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" (KDD 2019). A

An implementation of
An implementation of "MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing" (ICML 2019).

MixHop and N-GCN ⠀ A PyTorch implementation of "MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing" (ICML 2019)

Convolutional 2D Knowledge Graph Embeddings resources

ConvE Convolutional 2D Knowledge Graph Embeddings resources. Paper: Convolutional 2D Knowledge Graph Embeddings Used in the paper, but do not use thes

Danfeng Hong, Lianru Gao, Jing Yao, Bing Zhang, Antonio Plaza, Jocelyn Chanussot. Graph Convolutional Networks for Hyperspectral Image Classification, IEEE TGRS, 2021.
Danfeng Hong, Lianru Gao, Jing Yao, Bing Zhang, Antonio Plaza, Jocelyn Chanussot. Graph Convolutional Networks for Hyperspectral Image Classification, IEEE TGRS, 2021.

Graph Convolutional Networks for Hyperspectral Image Classification Danfeng Hong, Lianru Gao, Jing Yao, Bing Zhang, Antonio Plaza, Jocelyn Chanussot T

Comments
  • Bundle generation

    Bundle generation

    Dear, I found this github repository, because I want to extend on the topic of bundle generation and graph generation for recommender systems. To do this I wanted to test your bundle generation model (BGGN) on other datasets. Can I get access to the code for bundle generation?

    opened by Sprinkhaan42 0
  • hard negative sample的抽样方式有误

    hard negative sample的抽样方式有误

    在作者提供的dataset文件中给出了negative sample的采样步骤 `class BundleTrainDataset(BasicDataset):

    def __init__(self, path, name, item_data, assist_data, seed=None):
        super().__init__(path, name, 'train', 1)
        # U-B
        self.U_B_pairs = self.load_U_B_interaction()
        indice = np.array(self.U_B_pairs, dtype=np.int32)
        values = np.ones(len(self.U_B_pairs), dtype=np.float32)
        
        self.ground_truth_u_b = sp.coo_matrix(
            (values, (indice[:, 0], indice[:, 1])), shape=(self.num_users, self.num_bundles)).tocsr()
        
    
        print_statistics(self.ground_truth_u_b, 'U-B statistics in train')
    
       
        if CONFIG['sample'] == 'hard': 
            #  1. u_p --> b_n1
            u_b_from_i = item_data.ground_truth_u_i @ assist_data.ground_truth_b_i.T 
            u_b_from_i = u_b_from_i.todense() 
            bn1_window = [int(i*self.num_bundles) for i in CONFIG['hard_window']] 
            #'hard_window': [0.7, 1.0]
            self.u_b_for_neg_sample = np.argsort(u_b_from_i, axis=1)[:,bn1_window[0]:bn1_window[1]]
            
            
            #  2. b_p --> b_n2
            overlap_graph = assist_data.ground_truth_b_i @ assist_data.ground_truth_b_i.T
            overlap_graph = overlap_graph.todense()
            bn2_window = [int(i*self.num_bundles) for i in CONFIG['hard_window']]
            self.b_b_for_neg_sample = np.argsort(overlap_graph, axis=1)[:,bn2_window[0]:bn2_window[1]]
            #对每个bundle i,选出与其重合度较高的一些bundle
    
    def __getitem__(self, index):
        user_b, pos_bundle = self.U_B_pairs[index]
        all_bundles = [pos_bundle]
        if CONFIG['sample'] == 'simple': #普通模式
            while True:
                i = np.random.randint(self.num_bundles)
                if self.ground_truth_u_b[user_b, i] == 0 and not i in all_bundles:
                    all_bundles.append(i)
                    if len(all_bundles) == self.neg_sample+1:
                        break
        elif CONFIG['sample'] == 'hard': #hard模式
            hard_probability = round(np.random.uniform(0, 1), 1)
            if  hard_probability <= CONFIG['hard_prob'][0]:
                while True:
                    i = np.random.randint(self.u_b_for_neg_sample.shape[1])
                    b_n1 = self.u_b_for_neg_sample[user_b, i]
                    if self.ground_truth_u_b[user_b, b_n1] == 0 and not b_n1 in all_bundles:
                        all_bundles.append(b_n1)
                        if len(all_bundles) == self.neg_sample+1:
                            break
            elif CONFIG['hard_prob'][0] < hard_probability \
                <= CONFIG['hard_prob'][0] + CONFIG['hard_prob'][1]:
                while True:
                    i = np.random.randint(self.b_b_for_neg_sample.shape[1])
                    b_n2 = self.b_b_for_neg_sample[pos_bundle, i]
                    if self.ground_truth_u_b[user_b, b_n2] == 0 and not b_n2 in all_bundles:
                        all_bundles.append(b_n2)
                        if len(all_bundles) == self.neg_sample+1:
                            break
            else:
                while True:
                    i = np.random.randint(self.num_bundles)
                    if self.ground_truth_u_b[user_b, i] == 0 and not i in all_bundles:
                        all_bundles.append(i)
                        if len(all_bundles) == self.neg_sample+1:
                            break
        else:
            raise ValueError(r"sample's method is wrong")
    
        return torch.LongTensor([user_b]), torch.LongTensor(all_bundles)
    

    ` 代码里使用np.argsort和hard_window来取出交互程度为hard_window%的bundle,但实际上np.argsort返回的是每个项从小到大排列时的位置索引,并非返回排序后的列表;所以我认为在后续的__getitem__函数抽样取出的样本并非hard sample

    opened by Chuan1997 0
  • Futher Train and Test

    Futher Train and Test

    • Futher Train

    Replace 'sample' from 'simple' to 'hard' in CONFIG and add model file path obtained by Train to 'conti_train', then run

    python main.py

    I cannot find the model file path obtained by Train, could you tell me where i can find it?

    Thank you very much!

    opened by weilu4606 0
  • 复现训练hard数据集报错

    复现训练hard数据集报错

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "E:\Anconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
    Traceback (most recent call last):
      File "main.py", line 155, in <module>
        exitcode = _main(fd, parent_sentinel)
      File "E:\Anconda3\lib\multiprocessing\spawn.py", line 126, in _main
        self = reduction.pickle.load(from_parent)
    _pickle.UnpicklingError: pickle data was truncated
        main()
      File "main.py", line 120, in main
        trainloss = train(model, epoch+1, train_loader, op, device, CONFIG, loss_func
    )
      File "F:\GNN\BGCN-master\train.py", line 15, in train
        for i, data in enumerate(loader):
      File "E:\Anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 352,
    in __iter__
        return self._get_iterator()
      File "E:\Anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 294,
    in _get_iterator
        return _MultiProcessingDataLoaderIter(self)
      File "E:\Anconda3\lib\site-packages\torch\utils\data\dataloader.py", line 801,
    in __init__
        w.start()
      File "E:\Anconda3\lib\multiprocessing\process.py", line 121, in start
        self._popen = self._Popen(self)
      File "E:\Anconda3\lib\multiprocessing\context.py", line 224, in _Popen
        return _default_context.get_context().Process._Popen(process_obj)
      File "E:\Anconda3\lib\multiprocessing\context.py", line 327, in _Popen
        return Popen(process_obj)
      File "E:\Anconda3\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
        reduction.dump(process_obj, to_child)
      File "E:\Anconda3\lib\multiprocessing\reduction.py", line 60, in dump
        ForkingPickler(file, protocol).dump(obj)
    OSError: [Errno 22] Invalid argument
    
    

    您好,这是我在train sample后接着训练hard报出的错,请问一下是什么问题呢?万分感谢

    opened by 1qweasdzxc 0
Owner
M.S. student from E.E., Tsinghua University.
null
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to eth_sendBundle and eth_callBundle, and sends them to an RPC endpoint which you have specified, which corresponds to mev-geth.

Georgios Konstantopoulos 294 Jan 4, 2023
Python script to extract all Humble Bundle keys and redeem them on Steam automagically.

humble-steam-key-redeemer Python script to extract all Humble keys and redeem them on Steam automagically. This is primarily designed to be a set-it-a

null 74 Jan 8, 2023
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is do

Flashbots 293 Dec 31, 2022
Rotation-Only Bundle Adjustment

ROBA: Rotation-Only Bundle Adjustment Paper, Video, Poster, Presentation, Supplementary Material In this repository, we provide the implementation of

Seong 51 Nov 29, 2022
Square Root Bundle Adjustment for Large-Scale Reconstruction

RootBA: Square Root Bundle Adjustment Project Page | Paper | Poster | Video | Code Table of Contents Citation Dependencies Installing dependencies on

Nikolaus Demmel 205 Dec 20, 2022
Poetry plugin to bundle projects into various formats

Poetry bundle plugin This package is a plugin that allows the bundling of Poetry projects into various formats. Installation The easiest way to instal

Poetry 54 Jan 2, 2023
BARF: Bundle-Adjusting Neural Radiance Fields 🤮 (ICCV 2021 oral)

BARF ?? : Bundle-Adjusting Neural Radiance Fields Chen-Hsuan Lin, Wei-Chiu Ma, Antonio Torralba, and Simon Lucey IEEE International Conference on Comp

Chen-Hsuan Lin 539 Dec 28, 2022
Deep Unsupervised 3D SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment.

(ACMMM 2021 Oral) SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment This repository shows two tasks: Face landmark detection and Fac

BoomStar 51 Dec 13, 2022
Deep Unsupervised 3D SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment.

(ACMMM 2021 Oral) SfM Face Reconstruction Based on Massive Landmark Bundle Adjustment This repository shows two tasks: Face landmark detection and Fac

BoomStar 51 Dec 13, 2022
An easy-to-bundle GTK terminal emulator.

EasyTerm An easy-to-bundle GTK terminal emulator. This project is meant to be used as a dependency for other

Bottles 4 May 15, 2022