asammoud
Re-add large CSVs using Git LFS
b265364
raw
history blame
1.53 kB
import glob
def get_feature_map(dataset):
feature_file = open(f'list.txt', 'r')
feature_list = []
for ft in feature_file:
feature_list.append(ft.strip())
return feature_list
# graph is 'fully-connect'
def get_fc_graph_struc(dataset):
feature_file = open(f'list.txt', 'r')
struc_map = {}
feature_list = []
for ft in feature_file:
feature_list.append(ft.strip())
for ft in feature_list:
if ft not in struc_map:
struc_map[ft] = []
for other_ft in feature_list:
if other_ft is not ft:
struc_map[ft].append(other_ft)
return struc_map
def get_prior_graph_struc(dataset):
feature_file = open(f'./data/{dataset}/features.txt', 'r')
struc_map = {}
feature_list = []
for ft in feature_file:
feature_list.append(ft.strip())
for ft in feature_list:
if ft not in struc_map:
struc_map[ft] = []
for other_ft in feature_list:
if dataset == 'wadi' or dataset == 'wadi2':
# same group, 1_xxx, 2A_xxx, 2_xxx
if other_ft is not ft and other_ft[0] == ft[0]:
struc_map[ft].append(other_ft)
elif dataset == 'swat':
# FIT101, PV101
if other_ft is not ft and other_ft[-3] == ft[-3]:
struc_map[ft].append(other_ft)
return struc_map
if __name__ == '__main__':
get_graph_struc()