This commit is contained in:
araison 2023-01-09 23:54:55 +01:00
parent f7bb1e7858
commit d0faea89db
1 changed files with 58 additions and 64 deletions

View File

@ -2,15 +2,11 @@ import glob
import os import os
import shutil import shutil
from explaining_framework.utils.io import read_yaml, write_yaml
from torch_geometric.data.makedirs import makedirs from torch_geometric.data.makedirs import makedirs
from torch_geometric.graphgym.loader import create_dataset from torch_geometric.graphgym.loader import create_dataset
from torch_geometric.graphgym.utils.io import string_to_python from torch_geometric.graphgym.utils.io import string_to_python
from explaining_framework.utils.io import read_yaml, write_yaml
def chunkizing_list(l, n):
return [l[i : i + n] for i in range(0, len(l), n)]
if "__main__" == __name__: if "__main__" == __name__:
config_folder = os.path.abspath( config_folder = os.path.abspath(
@ -21,61 +17,60 @@ if "__main__" == __name__:
makedirs(explaining_folder) makedirs(explaining_folder)
explainer_folder = os.path.join(config_folder, "explaining") explainer_folder = os.path.join(config_folder, "explaining")
makedirs(explainer_folder) makedirs(explainer_folder)
chunk = list(range(154, 160, 2))
DATASET = [ DATASET = [
"CIFAR10", "CIFAR10",
# "TRIANGLES", "TRIANGLES",
# "COLORS-3", "COLORS-3",
# "REDDIT-BINARY", "REDDIT-BINARY",
# "REDDIT-MULTI-5K", "REDDIT-MULTI-5K",
# "REDDIT-MULTI-12K", "REDDIT-MULTI-12K",
# "COLLAB", "COLLAB",
# "DBLP_v1", "DBLP_v1",
# "COIL-DEL", "COIL-DEL",
# "COIL-RAG", "COIL-RAG",
# "Fingerprint", "Fingerprint",
# "Letter-high", "Letter-high",
# "Letter-low", "Letter-low",
# "Letter-med", "Letter-med",
# "MSRC_9", "MSRC_9",
# "MSRC_21", "MSRC_21",
# "MSRC_21C", "MSRC_21C",
# "DD", "DD",
# "ENZYMES", "ENZYMES",
# "PROTEINS", "PROTEINS",
# "QM9", "QM9",
# "MUTAG", "MUTAG",
# "Mutagenicity", "Mutagenicity",
# "AIDS", "AIDS",
# "PATTERN", "PATTERN",
# "CLUSTER", "CLUSTER",
# "MNIST", "MNIST",
# "CIFAR10", "CIFAR10",
# "TSP", "TSP",
# "CSL", "CSL",
# "KarateClub", "KarateClub",
# "CS", "CS",
# "Physics", "Physics",
# "BBBP", "BBBP",
# "Tox21", "Tox21",
# "HIV", "HIV",
# "PCBA", "PCBA",
# "MUV", "MUV",
# "BACE", "BACE",
# "SIDER", "SIDER",
# "ClinTox", "ClinTox",
# "AIFB", "AIFB",
# "AM", "AM",
# "MUTAG", "MUTAG",
# "BGS", "BGS",
# "FAUST", "FAUST",
# "DynamicFAUST", "DynamicFAUST",
# "ShapeNet", "ShapeNet",
# "ModelNet10", "ModelNet10",
# "ModelNet40", "ModelNet40",
# "PascalVOC-SP", "PascalVOC-SP",
# "COCO-SP", "COCO-SP",
] ]
EXPLAINER = [ EXPLAINER = [
"CAM", "CAM",
@ -100,15 +95,14 @@ if "__main__" == __name__:
explaining_cfg = {} explaining_cfg = {}
# explaining_cfg['adjust']['strategy']= 'rpns' # explaining_cfg['adjust']['strategy']= 'rpns'
# explaining_cfg['attack']['name']= 'all' # explaining_cfg['attack']['name']= 'all'
explaining_cfg[ explaining_cfg["cfg_dest"] = string_to_python(
"cfg_dest" f"dataset={dataset_name}-model={model_kind}=explainer={explainer_name}"
] = f"dataset={dataset_name}-model={model_kind}=explainer={explainer_name}-chunk=[{chunk[0]},{chunk[-1]}]" )
# = f"dataset={dataset_name}-model={model_kind}=explainer={explainer_name}-chunk=[{chunk[0]},{chunk[-1]}]"
# = string_to_python(
# f"dataset={dataset_name}-model={model_kind}=explainer={explainer_name}"
explaining_cfg["dataset"] = {} explaining_cfg["dataset"] = {}
explaining_cfg["dataset"]["name"] = string_to_python(dataset_name) explaining_cfg["dataset"]["name"] = string_to_python(dataset_name)
explaining_cfg["dataset"]["item"] = chunk # explaining_cfg["dataset"]["item"] = chunk
# explaining_cfg['explainer']['cfg']= 'default' # explaining_cfg['explainer']['cfg']= 'default'
explaining_cfg["explainer"] = {} explaining_cfg["explainer"] = {}
explaining_cfg["explainer"]["name"] = string_to_python(explainer_name) explaining_cfg["explainer"]["name"] = string_to_python(explainer_name)
@ -120,7 +114,7 @@ if "__main__" == __name__:
explaining_cfg["model"] = {} explaining_cfg["model"] = {}
explaining_cfg["model"]["ckpt"] = string_to_python(model_kind) explaining_cfg["model"]["ckpt"] = string_to_python(model_kind)
explaining_cfg["model"]["path"] = string_to_python( explaining_cfg["model"]["path"] = string_to_python(
"/home/SIC/araison/test_ggym/pytorch_geometric/graphgym/results" "/media/data/SIC/araison/exps/pyg_fork/graphgym/results/graph_classif_base_grid_graph_classif_grid"
) )
# explaining_cfg['out_dir']='./explanation' # explaining_cfg['out_dir']='./explanation'
# explaining_cfg['print']='both' # explaining_cfg['print']='both'