Optimal scales module#
Detect optimal scales from a scale scan.
- pygenstability.optimal_scales.identify_optimal_scales(results, kernel_size=3, window_size=3, max_nvi=1, basin_radius=1)[source]#
Identifies optimal scales in Markov Stability [1].
Robust scales are found in a sequential way. We first search for large diagonal blocks of low values in the NVI(t, t’) matrix that are located at local minima of its pooled diagonal, called block detection curve, and we obtain basins of fixed radius around these local minima. We then determine the minima of the NVI(t) curve for each basin, and these minima correspond to the robust partitions of the network.
- Parameters:
results (dict) – the results from a Markov Stability calculation
kernel_size (int) – size of kernel for average-pooling of the NVI(t,t’) matrix
window_size (int) – size of window for moving mean, to smooth the pooled diagonal
max_nvi (float) – threshold for local minima of the pooled diagonal
basin_radius (int) – radius of basin around local minima of the pooled diagonal
- Returns:
‘selected_partitions’ and ‘block_nvi’
- Return type:
result dictionary with two new keys
References