Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mengzaiqiao committed Oct 31, 2018
0 parents commit 4556b82
Show file tree
Hide file tree
Showing 24 changed files with 432,092 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
@@ -0,0 +1,17 @@
## CAN: Co-embedding Attributed Networks
This repository contains the Python implementation for CAN
> Zaiqiao Meng, Shangsong Liang, Hongyan Bao, Xiangliang Zhang. Co-embedding Attributed Networks. (WSDM2019)
Further details about CAN can be found in our paper.

## Requirements
=================
* TensorFlow (1.0 or later)
* python 2.7/3.6
* scikit-learn
* scipy

## Run the demo
=================
```bash
python train.py
```
2 changes: 2 additions & 0 deletions __init__.py
@@ -0,0 +1,2 @@
from __future__ import print_function
from __future__ import division
61 changes: 61 additions & 0 deletions classification.py
@@ -0,0 +1,61 @@
from __future__ import division
from __future__ import print_function
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.svm import LinearSVC,SVC
from sklearn.metrics import *


def multiclass_node_classification_eval(X, y, ratio=0.5, rnd=2018):

X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=ratio, random_state=rnd)
clf = SVC()
clf.fit(X_train, y_train)

y_pred = clf.predict(X_test)

macro_f1 = f1_score(y_test, y_pred, average="macro")
micro_f1 = f1_score(y_test, y_pred, average="micro")

return macro_f1, micro_f1


def node_classification_F1(Embeddings, y, ratio):
macro_f1_avg = 0
micro_f1_avg = 0
for i in range(10):
rnd = np.random.randint(2018)
macro_f1, micro_f1 = multiclass_node_classification_eval(
Embeddings, y, ratio, rnd)
macro_f1_avg += macro_f1
micro_f1_avg += micro_f1
macro_f1_avg /= 10
micro_f1_avg /= 10
print ("Macro_f1: " + str(macro_f1_avg))
print ("Micro_f1: " + str(micro_f1_avg))


def read_label(inputFileName):
f = open(inputFileName, "r")
lines = f.readlines()
f.close()
N = len(lines)
y = np.zeros(N, dtype=int)
i = 0
for line in lines:
l = line.strip("\n\r")
y[i] = int(l)
i += 1
return y


datasets = ['cora' ]#'cora', 'citeseer', 'pubmed', 'pubmed','BlogCatalog']
for datasetname in datasets:
for ratio in [0.2]:
print('dataset:', datasetname, ',ratio:', ratio)
embedding_node_result_file = "result/AGAE_{}_n_mu.emb.npy".format(datasetname)
label_file = "data/" + datasetname + ".label"
y = read_label(label_file)
Embeddings = np.load(embedding_node_result_file)
node_classification_F1(Embeddings, y, ratio)
173 changes: 173 additions & 0 deletions data/DBLP.attidx
@@ -0,0 +1,173 @@
#Attributes 172
0 NSDI
1 SDM
2 NDSS
3 CVPR
4 COGSCI
5 UIST
6 ICSOC
7 COMPGEOM
8 CLOUD
9 POPL
10 DCC
11 SC
12 PPOPP
13 ASPLOS
14 USENIX
15 RE
16 ICCBR
17 CONCUR
18 ICSE
19 ITC
20 ICDT
21 SAS
22 ICNP
23 NIPS
24 IPPS
25 PG
26 KDD
27 EDBT
28 CHI
29 VISSYM
30 AIPS
31 PKDD
32 CIDR
33 HPDC
34 VR
35 SIGGRAPH
36 MM
37 STOC
38 AAAI
39 SI3D
40 CODES
41 EUROSYS
42 ETAPS
43 SECON
44 CRYPTO
45 ICS
46 ICMCS
47 SIGCOMM
48 SCA
49 HUC
50 ICPP
51 SP
52 IJCAI
53 ICFP
54 UAI
55 PERCOM
56 VLDB
57 BIBM
58 SIGMOD
59 SIGMETRICS
60 PPSN
61 MOBICOM
62 IPSN
63 ECAI
64 IWQOS
65 IUI
66 EMSOFT
67 ESORICS
68 ICRA
69 SMA
70 CCS
71 COCO
72 OOPSLA
73 EUROCRYPT
74 ICWS
75 EMNLP
76 ECCV
77 SGP
78 ESA
79 ICCD
80 SODA
81 HOTOS
82 SEMWEB
83 RT
84 SOSP
85 ICSM
86 FAST
87 MODELS
88 WSDM
89 DATE
90 CSCW
91 ICASSP
92 HIPEAC
93 ECOOP
94 RECOMB
95 PODS
96 SENSYS
97 ACSAC
98 RAID
99 MOBIHOC
100 IWPC
101 ISSRE
102 CSFW
103 RTSS
104 ASIACRYPT
105 CNHPCA
106 SRDS
107 ACL
108 CGO
109 PLDI
110 NOSSDAV
111 VEE
112 ECSCW
113 VISUALIZATION
114 FOCS
115 MSS
116 CIKM
117 KBSE
118 FSE
119 ECML
120 IMC
121 SIGIR
122 LICS
123 RTAS
124 ICDE
125 CONEXT
126 ICDM
127 DAC
128 OSDI
129 WWW
130 ISSTA
131 FPGA
132 ICCV
133 GROUP
134 COLING
135 ISCA
136 FM
137 USS
138 MICRO
139 ICML
140 MOBISYS
141 ATAL
142 WCRE
143 CP
144 DSN
145 HYBRID
146 MHCI
147 ESEM
148 CAV
149 TCC
150 KR
151 MIR
152 ICCAD
153 IEEEPACT
154 CAISE
155 ICDCS
156 CHES
157 ICALP
158 TABLETOP
159 MIDDLEWARE
160 CADE
161 VMCAI
162 COLT
163 EUROGRAPHICS
164 INFOCOM
165 PKC
166 SPAA
167 DASFAA
168 LCTRTS
169 SIGSOFT
170 PODC
171 LISA

0 comments on commit 4556b82

Please sign in to comment.