<jupyter_start><jupyter_text>Constructing Adjacency Matrix  Import<jupyter_code>import src.adjacency_matrix.adjacency_matrix as am
from src.data import subjects
from config import *
import networkx as nx<jupyter_output><empty_output><jupyter_text>Read Data<jupyter_code>sub_list = subjects.to_construct_adj
sub_list
#sub_list = ['002S2043', '002S2010']
correlations = {}
for sub in sub_list:
    correlations[sub]={}
    for ds in denoising_strategies:
        correlations[sub][ds]={}
        for ct in correlation_types:     
            correlations[sub][ds][ct]={}
            correlations[sub][ds][ct]['M'] = am.read_M(sub,ds,ct)
            correlations[sub][ds][ct]['G'] = am.read_G(sub,ds,ct)<jupyter_output><empty_output><jupyter_text>Adjacency matrix with user defined threshold  generating an adjacency matrix by thresholding the correlation matrix to generate an adjacency matrix. we will choose the top K persent of edges.where the k equals to thresholding_values defined in the config file.<jupyter_code>print(thresholding_values)
am.all_userdefined(sub_list,correlations)<jupyter_output><empty_output><jupyter_text>Using global cost efficiency (GCE) for generating adjacency matrix The other way is to choose a threshold that maximizes the global cost efficiency (GCE).GCE = E - PSWwhere:    E   : Global Efficiency    PSW :Proportional Threshold<jupyter_code>am.all_gce(sub_list,correlations,tol=0.01)<jupyter_output><empty_output><jupyter_text>Adjacency matrix of negative correlationIn this section we will genarate the adjacency matrix of the nodes with negative correlation<jupyter_code>correlation_types
if negative_corr == True:
    sub_list =subjects.to_construct_adj

    print(sub_list)
    
    correlations = {}
    for sub in sub_list:
        correlations[sub]={}
        for ds in denoising_strategies:
            correlations[sub][ds]={}
            for ct in correlation_types:     
                correlations[sub][ds][ct]={}
                correlations[sub][ds][ct]['M'] = am.read_M(sub,ds,ct)
                correlations[sub][ds][ct]['G'] = am.read_G(sub,ds,ct)
                
    am.all_Ngce(sub_list,correlations,tol=0.01)<jupyter_output>[]
{'fraction_non_alphanumeric': 0.09848831882730189, 'fraction_numerical': 0.009161704076958314, 'mean_word_length': 4.405940594059406, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '407224', 'license': 'MIT', 'n_tokens_mistral': 728, 'n_tokens_neox': 691, 'n_words': 159, 'path': 'notebooks/05_adjacency_matrix.ipynb', 'repo_name': 'Alirezafathian/fmriprediction', 'size': '2183'}