<jupyter_start><jupyter_text>Eigenvector Centrality Heatmaps of the learned world connectivity structure $-$ This notebook corresponds to Fig. 2 in the paperIt will reload all pre-trained models corresponding to th Fig. 2 plots, and computethe eigenvector centrality score of all nodes, to then produce a heatmap of them.The used models have the strongest performance among the four ensemble members reported in our main results.<jupyter_code>def reload_and_plot_eigv_centrality(model_dir, lead_months, data_dir=None, device='cuda', ID='50ep'):
    out = f'out/{lead_months}lead/'
    try:
        model_dir = out + model_dir
        model_dict = torch.load(os.path.join(model_dir, ID + '_model.pkl'))
    except FileNotFoundError as e:
        print(e)
        return
    params, net_params = model_dict['metadata']['params'], model_dict['metadata']['net_params']
    load_data_kwargs = {
        'window': params['window'], 'lead_months': params['horizon'], 'lon_min': params['lon_min'],
        'lon_max': params['lon_max'], 'lat_min': params['lat_min'], 'lat_max': params['lat_max'],
        'data_dir': params['data_dir'], 'use_heat_content': params['use_heat_content'],
        'add_index_node': net_params['index_node'], 
    }
    if data_dir is not None:
        load_data_kwargs['data_dir'] = data_dir
    cmip5, SODA, GODAS, cords = load_cnn_data(**load_data_kwargs,
                                                return_new_coordinates=True,
                                                return_mask=False, verbose=False)
    static_feats = get_static_feats(params, net_params, cords, SODA[0])
    lats, lons = GODAS[0].attrs["Lats"], GODAS[0].attrs["Lons"]

    model = GCN(net_params, static_feat=static_feats, verbose=False)
    state_dict = model_dict['model']
    model.load_state_dict(state_dict)
    model.eval()
    model.to(device)

    adj = model.graph_learner().detach().cpu().numpy()
    if net_params['index_node']:  # do not plot the index node
        adj = adj[:-1, :-1]
    plot_centrality_from_adj(adj, lats, lons, coordinates=cords, save_to=None, set_title=False, verbose=False,
                                    min_weight=0, show=True, horizon=params['horizon'])

kwargs = {
    'device': 'cuda',
    'ID': '50ep', 
    'data_dir': './Data/'
}<jupyter_output><empty_output><jupyter_text>1 lead<jupyter_code>reload_and_plot_eigv_centrality('250x250', lead_months=1, **kwargs)<jupyter_output>MASKING OUT 384 nodes<jupyter_text>3 lead<jupyter_code>reload_and_plot_eigv_centrality('250x250', lead_months=3, **kwargs)<jupyter_output>MASKING OUT 384 nodes<jupyter_text>6 lead<jupyter_code>reload_and_plot_eigv_centrality('200x200x200_Mean+Sum', lead_months=6, **kwargs)<jupyter_output><empty_output><jupyter_text>9 lead<jupyter_code>reload_and_plot_eigv_centrality('250x250', lead_months=9, **kwargs)<jupyter_output><empty_output><jupyter_text>12 lead<jupyter_code>reload_and_plot_eigv_centrality('200x200x200_Mean+Sum', lead_months=12, **kwargs)<jupyter_output><empty_output><jupyter_text>23 lead<jupyter_code>reload_and_plot_eigv_centrality('200x200x200_Mean+Sum', lead_months=23, **kwargs)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12456418383518225, 'fraction_numerical': 0.025356576862123614, 'mean_word_length': 4.833641404805915, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '427949', 'license': 'MIT', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1068, 'n_words': 192, 'path': 'interpretability_plots.ipynb', 'repo_name': 'salvaRC/Graphino', 'size': '3155'}