import itstgcnEvolveGCNH
import torch
import itstgcnEvolveGCNH.planner
SimualtionPlanner-Tutorial
ST-GCN
table
BLOCK
List
- max_iter=30/linear/epoch=50~200/STGCN,IT-STGCN
- missing 만드는 법(block 생각)
4.반복의미 없음, 고정된 값 출력되어서
할 거
- missing 0일 때 STGCN/GNAR 비교(CHECK)
- baseline 제시될만한 데이터셋 뭘까.
- GNAR warning 안 나오는 법 찾아보기
- mindex가 중요ㅡ mtype은 기록용으로만 사용됨
_df = pd.concat([_a,,_b,_c],axis=0)
save_data(_df, './data/Pedal_estgcn_randomly_by_rate.pkl')
imports
https://pytorch-geometric-temporal.readthedocs.io/en/latest/_modules/index.html
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 WindmillOutputLargeDatasetLoader
= WindmillOutputLargeDatasetLoader() loader4
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
# dataset6 = _a.get_dataset(lags=8)
from torch_geometric_temporal.dataset import MontevideoBusDatasetLoader
= MontevideoBusDatasetLoader() loader10
import numpy as np
import pandas as pd
read data
# _data = itstgcn.load_data('./data/fivenodes.pkl')
# _edges = torch.tensor(_data['edges']).nonzero().tolist()
# _FX = _data['f'].tolist()
# _node_ids = {'node1':0, 'node2':1, 'node3':2, 'node4':3, 'node5':4}
# data_dict = {'edges':_edges, 'node_ids':_node_ids, 'FX':_FX}
= itstgcn.load_data('./data/fivenodes.pkl')
data_dict = itstgcn.DatasetLoader(data_dict) loader
PLNR_STGCN_RAND
= {
plans_stgcn_rand 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0,0.7,0.8],
'lags': [2],
'nof_filters': [12],
'inter_method': ['linear','nearest'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader1,dataset_name='fivenodes')
plnr plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0.3,0.8],
'lags': [4],
'nof_filters': [16],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader1,dataset_name='chickenpox')
plnr plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 30,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0],
'lags': [4],
'nof_filters': [16],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcn.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader1,dataset_name='chickenpox')
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,loader6,dataset_name='windmillsmall')
plnr plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'mrate': [0.3],
'lags': [2, 4],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnadd.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader3,dataset_name='wikimath') plnr
plnr.simulate()
= {
plans_stgcn_rand 'max_iteration': 1,
'method': ['STGCN', 'IT-STGCN'],
'RecurrentGCN' : ['DCRNN'],
'mrate': [0],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnadd.planner.PLNR_STGCN_RAND(plans_stgcn_rand,loader6,dataset_name='windmillsmall')
plnr plnr.simulate()
= [[] 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': 1,
'method': ['STGCN', 'IT-STGCN'],
'mindex': [mindex],
'lags': [8],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnEvolveGCNH.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader6,dataset_name='windmillsmall')
plnr =mindex,mtype='block') plnr.simulate(mindex
PLNR_STGCN_MANUAL
= [[] for _ in range(20)] #chickenpox
my_list = list(range(100,400))
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[13] = another_list
my_list[15] = another_list
my_list[= my_list mindex
= [[] for _ in range(15)] #pedalme
my_list = list(range(5,35))
another_list 2] = another_list
my_list[4] = another_list
my_list[7] = another_list
my_list[11] = another_list
my_list[= my_list mindex
import random
= [[] for _ in range(1068)] # wikimath
my_list = random.sample(range(570), 72)
another_list # my_list에서 250개 요소 무작위 선택
= random.sample(range(len(my_list)), 250)
selected_indexes # 선택된 요소에 해당하는 값들을 another_list에 할당
for index in selected_indexes:
= another_list my_list[index]
# _data = itstgcn.load_data('./data/fivenodes.pkl')
# _edges = torch.tensor(_data['edges']).nonzero().tolist()
# _FX = _data['f'].tolist()
# _node_ids = {'node1':0, 'node2':1, 'node3':2, 'node4':3, 'node5':4}
# data_dict = {'edges':_edges, 'node_ids':_node_ids, 'FX':_FX}
# loader = itstgcn.DatasetLoader(data_dict)
# data_dict = itstgcn.load_data('./data/fivenodes.pkl')
# loader = itstgcn.DatasetLoader(data_dict)
# mindex= [[],[],[],list(range(50,150)),[]]
# mindex= [list(range(50,150)),[],list(range(50,90)),list(range(50,150)),[]] # node 2
= {
plans_stgcn_block 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'RecurrentGCN' : ['GConvGRU','GConvLSTM'],
'mindex': [mindex],
'lags': [4],
'nof_filters': [16],
'inter_method': ['linear'],
'epoch': [50],
'lr': [0.01]
}
= itstgcn.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader1,dataset_name='chickenpox')
plnr
=mindex,mtype='block') plnr.simulate(mindex
# mindex= [[],[],[],list(range(50,150)),[]]
# mindex= [list(range(50,150)),[],list(range(50,90)),list(range(50,150)),[]] # node 2
= {
plans_stgcn_block 'max_iteration': 10,
'method': ['STGCN', 'IT-STGCN'],
'RecurrentGCN' : ['GConvGRU','GConvLSTM'],
'mindex': [mindex],
'lags': [2,4],
'nof_filters': [12],
'inter_method': ['linear'],
'epoch': [50]
}
= itstgcnadd.planner.PLNR_STGCN_MANUAL(plans_stgcn_block,loader3,dataset_name='wikimath') plnr
=mindex,mtype='block') plnr.simulate(mindex
PLNR_GNAR_RAND
# _data = itstgcn.load_data('./data/fivenodes.pkl')
# _edges = torch.tensor(_data['edges']).nonzero().tolist()
# _FX = _data['f'].tolist()
# _node_ids = {'node1':0, 'node2':1, 'node3':2, 'node4':3, 'node5':4}
# data_dict = {'edges':_edges, 'node_ids':_node_ids, 'FX':_FX}
# loader = itstgcn.DatasetLoader(data_dict)
# data_dict=itstgcn.load_data('./data/fivenodes.pkl')
# loader = itstgcn.DatasetLoader(data_dict)
= {
plans_gnar_rand 'max_iteration': 30,
# 'method': ['GNAR'],
'mrate': [0.1],
'lags': [4],
# 'nof_filters': [8,16],
'inter_method': ['linear','cubic'],
# 'epoch': [1]
}
= itstgcn.planner.PLNR_GNAR_RAND(plans_gnar_rand,loader2,dataset_name='pedalme')
plnr plnr.simulate()
= {
plans_gnar_rand 'max_iteration': 3,
# 'method': ['GNAR'],
'mrate': [0],
'lags': [2,4],
# 'nof_filters': [8,16],
'inter_method': ['linear'],
# 'epoch': [1]
}
= itstgcn.planner.PLNR_GNAR_RAND(plans_gnar_rand,loader3,dataset_name='wikimath')
plnr plnr.simulate()
= {
plans_gnar_rand 'max_iteration': 3,
# 'method': ['GNAR'],
'mrate': [0,0.3],
'lags': [8],
# 'nof_filters': [8,16],
'inter_method': ['linear'],
# 'epoch': [1]
}
= itstgcn.planner.PLNR_GNAR_RAND(plans_gnar_rand,loader5,dataset_name='windmillmedium')
plnr plnr.simulate()
PLNR_GNAR_BLOCK
# _data = itstgcn.load_data('./data/fivenodes.pkl')
# _edges = torch.tensor(_data['edges']).nonzero().tolist()
# _FX = _data['f'].tolist()
# _node_ids = {'node1':0, 'node2':1, 'node3':2, 'node4':3, 'node5':4}
# data_dict = {'edges':_edges, 'node_ids':_node_ids, 'FX':_FX}
# loader = itstgcn.DatasetLoader(data_dict)
# loader = itstgcn.load_data('./data/fivenodes.pkl')
26
Nodes :
26 windmills
vertices represent -Edges : 676
weighted edges describe the strength of relationships- Time : 17464
= [[] for _ in range(26)] #medium
my_list = list(range(1000,2000))+list(range(4000,5000))+list(range(7000,8000)) #17464
another_list
for i in np.array(random.sample(range(0, 26), 15)):
= another_list
my_list[i] = my_list mindex
= [[] for _ in range(20)] #chickenpox
my_list = list(range(100,400))
another_list 2] = another_list
my_list[4] = another_list
my_list[6] = another_list
my_list[8] = another_list
my_list[10] = another_list
my_list[12] = another_list
my_list[14] = another_list
my_list[16] = another_list
my_list[= my_list mindex
# mindex= [[],[],[],list(range(50,150)),[]]
# mindex= [list(range(50,150)),[],list(range(50,90)),list(range(50,150)),[]] # node 2
= {
plans_gnar_block 'max_iteration': 3,
'method': ['GNAR'],
'mindex': [mindex],
'lags': [4],
'inter_method': ['cubic','linear'],
}
= itstgcn.planner.PLNR_GNAR_MANUAL(plans_gnar_block,loader1,dataset_name='chickenpox')
plnr ='block') plnr.simulate(mindex,mtype
# mindex= [[],[],[],list(range(50,150)),[]]
# mindex= [list(range(50,150)),[],list(range(50,90)),list(range(50,150)),[]] # node 2
= {
plans_gnar_block 'max_iteration': 3,
'method': ['GNAR'],
'mindex': [mindex],
'lags': [2,4],
'inter_method': ['linear'],
}