-
Notifications
You must be signed in to change notification settings - Fork 78
Combine Single Target Results
LNov edited this page May 23, 2019
·
7 revisions
Combine a list of partial network analysis results into a single results object. First, let's load the single target analysis dictionaries using pickle. In this example, the dictionaries 0.pkl, 1.pkl, 2.pkl will be loaded from 'my_folder'.
import pickle
from idtxl.stats import network_fdr
# Set target numbers to combine
targets = [0, 1, 2]
# Load results using pickle
res_list = []
for target_id in targets:
path = 'my_directory/res.{}.pkl'.format(str(target_id))
res_list.append(pickle.load(open(path, 'rb')))
Now, there are two ways of combining the results. If we want to perform the FDR correction (Benjamini et al. (1995)):
alpha_fdr = res_list[0].settings['alpha_fdr']
res = network_fdr({'alpha_fdr': alpha_fdr}, *res_list)
Otherwise, if we don't want to perform the FDR correction:
res = res_list[0]
res.combine_results(*res_list[1:])