| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| ReadMe.txt | 2022-07-18 | 4.4 kB | |
| IM2Vec.zip | 2022-07-18 | 160.9 MB | |
| Totals: 2 Items | 160.9 MB | 0 |
Welcome to use the source code of the IM2Vec algorithm proposed by Jin et al.
When using this code please cite:
Ziwei Jin, Jiaxing Shang, Wancheng Ni, Liang Zhao, Dajiang Liu, Baohua Qiang, Wu Xie, Geyong Ming. "IM2Vec: Representation learning-based preference maximization in geo-social networks." Information Sciences 604 (2022): 170-196.
1. All2Vec
- AlI2Vec: Learning user preference weight for target location
# preprocess
- preprocess1.py
Input:
df_preprocess.txt (All the POIs and their coordinates.)
poi2id.txt(All the POIs and their indexs.)
poi_count.txt(All the POIs and how many times their been check-in.)
Output:
id2route.npy(The path from root node to each POI)
id2lr.npy(The Huffman code for each POI)
id2prob.npy(The probability of every path for a POI)
- preprocess2.py
Input:
checkin_perfect.txt(All check-in records.)
Output:
training.txt(training data)
testing.txt(testing data)
&
train_context.npy
train_user.npy
train_target.npy
&
valid_context.npy
valid_user.npy
valid_target.npy
&
test_context.npy
test_user.npy
test_target.npy
## preference feature
- Compile
run train.py
- Output:
poi_embedding.npy(The embeddings of all POIs)
user_embedding.npy(The embeddings of all users)
### get preference weights
- Output:
weights_887.txt(The user preference weights)
2. IM2Vec algorithm:
- Compile
Makefile is included, just type type "make" to compile all the source codes.
"linux & gcc 4.7.2" preferred
- Execute
Example:
./im2vec_discrete -dataset ../Brightkite/ -k 5000 -model IC -epsilon 0.1
Arguments:
-dataset:
path to the dataset and preference weight directory
-k:
number of selected nodes
-model:
the diffusion model uses——IC
-epsilon:
algorithm parameter;a double value for epsilon
## Dataset Format
Three files are necessary inside path_to_dataset folder
## Format for attribute
Location:
path_to_dataset/attribute.txt
Format:
This file should have exactly two lines
n=number of nodes
m=number of edges
### Format for IC model
Location:
path_to_dataset/BrightKite_graph.txt
Format:
Each line has three numbers
node1 node2 propogation_probability_from_node1_to_node2
Comments:
It is always a directed graph
node number should range in [0 to n-1] (inclusive)
3. Evaluation
- Evalution for IM2Vec
Makefile is included, just type type "make" to compile all the source codes.
"linux & gcc 4.7.2" preferred
To evaluate the influence spread of any algorithm using Monte-Carlo simulation, run:
./InfluSpread -data ../Brightkite/BrightKite_dataset/BrightKite_graph_with_attribute.txt -seeds ../Brightkite/seeds_LPIM_315_5000.txt -weight ..BrightKite/weights_887.txt -k 5000 -simus 10000
Arguments:
-data:
the graph file
-seeds:
the seed file consisting of the k seed node ids.
-weight:
the user pregference weight file
-k:
the number of seeds
-simus:
the times of Monte Carlo experiment
- Graph file format
The first line indicates the number of nodes and edges.
The following lines includes the source and destination node id of an edge, followed by its propagation probability
line 1 : #nodes #edges
line 2 to 1+#edge : src_id dest_id pp
All inputs are separated by tab(\t).
Example:
4 3
0 1 0.2
1 0 0.1
2 3 0.4
This graph contains four nodes and three edges.
Sample graph file "BrightKite_graph_with_attribute.txt" is included.
To run the program correctly, please make sure that all node ids are ranged from 0 to #nodes-1.
4. BrightKite file contains all the sample data are needed for the code.