-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot.py
executable file
·46 lines (36 loc) · 1.11 KB
/
plot.py
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
37
38
39
40
41
42
43
44
45
46
import argparse
import os
import os.path as osp
import numpy as np
import math
import itertools
import copy
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU, Sigmoid, Tanh, Dropout, LeakyReLU
from torch.autograd import Variable
from sklearn import preprocessing
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import KFold
from torch_geometric.data import Data, InMemoryDataset, DataLoader
from torch_geometric.nn import NNConv, BatchNorm, EdgePooling, TopKPooling, global_add_pool
import matplotlib.pyplot as plt
def plot(loss, title, losses):
fig = plt.figure()
plt.plot(losses)
plt.xlabel("# epoch")
plt.ylabel(loss)
plt.title(title)
plt.savefig('./plots/' + title + '.png')
plt.close()
def plot_matrix(out, strategy):
fig = plt.figure()
plt.pcolor(abs(out))
plt.colorbar()
plt.imshow(out)
title = "RBGM Output, Strategy = " + strategy
plt.title(title)
plt.savefig('./plots/' + str(strategy) + '.png')
plt.close()