import itstgcnEvolveGCNH
import torch
import itstgcnEvolveGCNH.planner
SimualtionPlanner-Tutorial
ST-GCN
table
BASELINE
imports
import rpy2
import rpy2.robjects as ro
from rpy2.robjects.vectors import FloatVector
from rpy2.robjects.packages import importr
%load_ext rpy2.ipython
%%R
library(GNAR)
library(igraph)
read data
from torch_geometric_temporal.dataset import ChickenpoxDatasetLoader
= ChickenpoxDatasetLoader() loader1
from torch_geometric_temporal.dataset import PedalMeDatasetLoader
= PedalMeDatasetLoader() loader2
from torch_geometric_temporal.dataset import WikiMathsDatasetLoader
= WikiMathsDatasetLoader() loader3
from torch_geometric_temporal.dataset import WindmillOutputMediumDatasetLoader
= WindmillOutputMediumDatasetLoader() loader5
from torch_geometric_temporal.dataset import WindmillOutputSmallDatasetLoader
= WindmillOutputSmallDatasetLoader() loader6
= itstgcnEvolveGCNH.load_data('./data/Windmillsmall.pkl') loader6
from torch_geometric_temporal.dataset import MontevideoBusDatasetLoader
= MontevideoBusDatasetLoader() loader10
= itstgcnGCLSTM.load_data('./data/Windmillsmall.pkl') loader6
PLNR_STGCN_RAND
= {
plans_stgcn_rand 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0,0.3,0.6],
'lags': [4],
'nof_filters': [12],
'inter_method': ['linear','nearest'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader2,dataset_name='pedalme')
plnr
plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 15,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0.3],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath')
plnr
plnr.simulate()
1/15 is done
2/15 is done
3/15 is done
4/15 is done
5/500
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath')
plnr
plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 15,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0.8],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath')
plnr
plnr.simulate()
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath')
plnr
plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 15,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath')
plnr
plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 1,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0.7],
'lags': [8],
'nof_filters': [16],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnGConvLSTM.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader6,dataset_name='windmillsmall')
plnr plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 1,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnEvolveGCNH.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader6,dataset_name='windmillsmall')
plnr plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 1,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader5,dataset_name='windmillmedium')
plnr plnr.simulate()
PLNR_STGCN_MANUAL
= [[] for _ in range(20)] #chickenpox
my_list = list(range(100,200))
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(15)] #pedalme
my_list = list(range(5,25))
another_list 1] = another_list
my_list[3] = another_list
my_list[5] = another_list
my_list[7] = another_list
my_list[9] = another_list
my_list[11] = another_list
my_list[= my_list mindex
= [[] for _ in range(1068)] #wikimath
my_list = list(range(200,500))
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(26)] #windmilmedi
my_list = list(range(200,500)) # 676*0.8 = 540.8
another_list 10] = another_list
my_list[= my_list mindex
import numpy as np
import random
= [[] for _ in range(675)] #monte
my_list = list(range(200,350)) #743
another_list
for i in np.array(random.sample(range(0, 675), 400)):
= another_list
my_list[i] = my_list mindex
# mindex= [[],[],[],list(range(50,150)),[]] # node 1
# mindex= [list(range(10,100)),[],list(range(50,80)),[],[]] # node 2
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]] # node3
= {
plans_stgcn_block 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnadd.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader,dataset_name='fivenodes')
plnr =mindex,mtype='block') plnr.simulate(mindex
= [[] for _ in range(11)] #windmilsmall
my_list = list(range(5000,7500)) # 17470*0.8 = 13976.0
another_list 1] = another_list
my_list[3] = another_list
my_list[5] = another_list
my_list[7] = another_list
my_list[9] = another_list
my_list[= my_list mindex
# mindex= [[],[],[],list(range(50,150)),[]] # node 1
# mindex= [list(range(10,100)),[],list(range(50,80)),[],[]] # node 2
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]] # node3
= {
plans_stgcn_block 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader6,dataset_name='windmiloutputsmall')
plnr =mindex,mtype='block') plnr.simulate(mindex
= [[] for _ in range(1068)] #wikimath
my_list = random.sample(range(0, 576), 432)
another_list for i in range(0, 1068):
= another_list
my_list[i] = my_list mindex
# mindex= [[],[],[],list(range(50,150)),[]] # node 1
# mindex= [list(range(10,100)),[],list(range(50,80)),[],[]] # node 2
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]] # node3
= {
plans_stgcn_block 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [4],
'nof_filters': [12],
'inter_method': ['nearest','linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader3,dataset_name='wikimath')
plnr =mindex,mtype='block') plnr.simulate(mindex
# mindex= [[],[],[],list(range(50,150)),[]] # node 1
# mindex= [list(range(10,100)),[],list(range(50,80)),[],[]] # node 2
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]] # node3
= {
plans_stgcn_block 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [4],
'nof_filters': [12],
'inter_method': ['nearest','linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader3,dataset_name='wikimath')
plnr =mindex,mtype='block') plnr.simulate(mindex
# mindex= [[],[],[],list(range(50,150)),[]] # node 1
# mindex= [list(range(10,100)),[],list(range(50,80)),[],[]] # node 2
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]] # node3
= {
plans_stgcn_block 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [4],
'nof_filters': [12],
'inter_method': ['nearest','linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader3,dataset_name='wikimath')
plnr =mindex,mtype='block') plnr.simulate(mindex
PLNR_GNAR_RAND
= {
plans_gnar_rand 'max_iteration': 30,
# 'method': ['GNAR'],
'mrate': [0.8, 0.9],
'lags': [4],
# 'nof_filters': [8,16],
'inter_method': ['cubic','linear'],
# 'epoch': [1]
}
= itstgcn.planner.PLNR_GNAR_RAND(plans_gnar_rand,loader1,dataset_name='chickenpox')
plnr plnr.simulate()
PLNR_GNAR_BLOCK
= [[] for _ in range(20)] #chickenpox
my_list = list(range(100,200))
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(15)] #pedalme
my_list = list(range(5,25))
another_list 1] = another_list
my_list[3] = another_list
my_list[5] = another_list
my_list[7] = another_list
my_list[9] = another_list
my_list[11] = another_list
my_list[= my_list mindex
= [[] for _ in range(1068)] #wikimath
my_list = list(range(10,20))
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(26)] #windmilmedi
my_list = list(range(200,500)) # 676*0.8 = 540.8
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(11)] #windmilsmall
my_list = list(range(5000,10000)) # 17470*0.8 = 13976.0
another_list 10] = another_list
my_list[= my_list mindex
= [[] for _ in range(675)] #monte
my_list = list(range(200,350)) #743
another_list
for i in np.array(random.sample(range(0, 675), 400)):
= another_list
my_list[i] = my_list mindex
# mindex = [[],[],list(range(50,250)),[],[]]
# mindex = [list(range(10,100)),[],list(range(50,80)),[],[]]
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]]
= {
plans_gnar_block 'max_iteration': 3,
'method': ['GNAR'],
'mindex': [mindex],
'lags': [4,8],
'inter_method': ['linear'],
}
= itstgcn.planner.PLNR_GNAR_MANUAL(plans_gnar_block,loader1,dataset_name='chickenpox')
plnr ='block') plnr.simulate(mindex,mtype
# mindex = [[],[],list(range(50,250)),[],[]]
# mindex = [list(range(10,100)),[],list(range(50,80)),[],[]]
# mindex= [list(range(10,100)),[],list(range(50,80)),list(range(50,150)),[]]
= {
plans_gnar_block 'max_iteration': 3,
'method': ['GNAR'],
'mindex': [mindex],
'lags': [8],
'inter_method': ['linear'],
}
= itstgcn.planner.PLNR_GNAR_MANUAL(plans_gnar_block,loader3,dataset_name='wikimath')
plnr ='block') plnr.simulate(mindex,mtype