-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdata_loader.py
More file actions
36 lines (31 loc) · 764 Bytes
/
data_loader.py
File metadata and controls
36 lines (31 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import scipy.io as scio
import numpy as np
UMIST = 'UMIST'
COIL20 = 'COIL20'
JAFFE = 'JAFFE'
PALM = 'Palm'
USPS = 'USPSdata_20_uni'
MNIST_TEST = 'mnist_test'
SEGMENT = 'segment_uni'
NEWS = '20news_uni'
TEXT = 'text1_uni'
ISOLET = 'Isolet'
def load_cora():
path = 'data/cora.mat'
data = scio.loadmat(path)
labels = data['gnd']
labels = np.reshape(labels, (labels.shape[0],))
X = data['fea']
X = X.astype(np.float32)
X /= np.max(X)
links = data['W']
return X, labels, links
def load_data(name):
path = 'data/{}.mat'.format(name)
data = scio.loadmat(path)
labels = data['Y']
labels = np.reshape(labels, (labels.shape[0],))
X = data['X']
X = X.astype(np.float32)
X /= np.max(X)
return X, labels