flowstab.scripts.run_clusterings ================================ .. py:module:: flowstab.scripts.run_clusterings .. autoapi-nested-parse:: Clusters the covariance integrals computed with `run_cov_integrals.py` (step 2). The clusterings are computed with the Louvain algorithm for each file containing the result of step 2 in {savedir}. The Louvain algorithm is repeated `num_repeat` times and the best partition (maximizing the flow stability) is selected. The ensemble of partitions is used to compute the variation of information. The computations for the different files is spread of `nproc_files` in parallel. It is also possible to parallelize the repeated clusterings using `nproc_clustering`. This requires nproc_files*nproc_clustering cores. A number of metadata (e.g. all the parameters used to run the code) is saved together with the results in a dictionary. The results of the clustering are saved with the following keys: - 'clust_counter' : All the different partitions found at each run of the Louvain algorithm togheter with the number of times they appeared. - 'stabilites' : All the values of the flow stability for each run. - 'seeds' : Random seeds for each run. - 'nvarinf' : Average normalized variation of information computed over the ensemble of partitions. - 'avg_stab': Average flow stability computed over the ensemble of partitions. - 'avg_nclust' : Average number of clusters computed over the ensemble of partitions. - 'best_cluster' : Best partition (the one with the max flow stability from the ensemble). - 'best_stab' : Flow stability value of the best partition. The results are saved in files named f'{savedir}/clusters_{netname}_tau_w{tau_w:.3e}_PT_{int_start:06d}_to_{int_stop:06d}.pickle' Attributes ---------- .. autoapisummary:: flowstab.scripts.run_clusterings.ap flowstab.scripts.run_clusterings.clust_verbose flowstab.scripts.run_clusterings.compute_clustering flowstab.scripts.run_clusterings.compute_nvarinf flowstab.scripts.run_clusterings.compute_static_clustering flowstab.scripts.run_clusterings.datadir flowstab.scripts.run_clusterings.direction flowstab.scripts.run_clusterings.files flowstab.scripts.run_clusterings.files flowstab.scripts.run_clusterings.inargs flowstab.scripts.run_clusterings.init_p1 flowstab.scripts.run_clusterings.integral_rtol flowstab.scripts.run_clusterings.max_num_varinf_samples flowstab.scripts.run_clusterings.n_meta_iter_max flowstab.scripts.run_clusterings.n_sub_iter_max flowstab.scripts.run_clusterings.net_name flowstab.scripts.run_clusterings.normalize_cov_mat flowstab.scripts.run_clusterings.nproc_clustering flowstab.scripts.run_clusterings.nproc_files flowstab.scripts.run_clusterings.num_norm_iter flowstab.scripts.run_clusterings.num_repeat flowstab.scripts.run_clusterings.num_varinf_samples flowstab.scripts.run_clusterings.num_varinf_samples flowstab.scripts.run_clusterings.only_largest_comp flowstab.scripts.run_clusterings.optional flowstab.scripts.run_clusterings.print_num_loops flowstab.scripts.run_clusterings.required flowstab.scripts.run_clusterings.save_clustering_before_nvarinf flowstab.scripts.run_clusterings.savedir flowstab.scripts.run_clusterings.separate_comps flowstab.scripts.run_clusterings.var_dict flowstab.scripts.run_clusterings.verbose Functions --------- .. autoapisummary:: flowstab.scripts.run_clusterings.compute_nvi_sample flowstab.scripts.run_clusterings.compute_static_clustering_fct flowstab.scripts.run_clusterings.load_autocov_int flowstab.scripts.run_clusterings.main flowstab.scripts.run_clusterings.n_random_seeds flowstab.scripts.run_clusterings.worker Module Contents --------------- .. py:function:: compute_nvi_sample(params) .. py:function:: compute_static_clustering_fct(params) .. py:function:: load_autocov_int(file, init_p1=False, direction=None) .. py:function:: main() .. py:function:: n_random_seeds(n) .. py:function:: worker(file_args) .. py:data:: ap .. py:data:: clust_verbose .. py:data:: compute_clustering .. py:data:: compute_nvarinf .. py:data:: compute_static_clustering .. py:data:: datadir .. py:data:: direction .. py:data:: files .. py:data:: files .. py:data:: inargs .. py:data:: init_p1 .. py:data:: integral_rtol .. py:data:: max_num_varinf_samples .. py:data:: n_meta_iter_max .. py:data:: n_sub_iter_max .. py:data:: net_name .. py:data:: normalize_cov_mat .. py:data:: nproc_clustering .. py:data:: nproc_files .. py:data:: num_norm_iter .. py:data:: num_repeat .. py:data:: num_varinf_samples .. py:data:: num_varinf_samples .. py:data:: only_largest_comp .. py:data:: optional .. py:data:: print_num_loops .. py:data:: required .. py:data:: save_clustering_before_nvarinf .. py:data:: savedir .. py:data:: separate_comps .. py:data:: var_dict .. py:data:: verbose