The robustness of the Bangladesh's multimodal freight transport network criticality is analyzed in order to understand the influence of uncertainties to the criticality analysis. 100 replications with different parameter settings were applied to the transport model and the criticality calculation (please refer to Section 5.3 in the thesis report). In this notebook, the robustness of the 100 replications is analysed.
The robustness is analyzed on three fronts:
In [1]:
%matplotlib inline
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.pylab import *
import matplotlib.colors as colors
import seaborn as sns
from __future__ import division
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
#Modules developed for this project
from transport_network_modeling import network_visualization as net_v
from transport_network_modeling import criticality as crit
In [2]:
#load the csv file of the 100 replications
fileloc = r'./criticality_results/100_replications_result.csv'
data_all = pd.read_csv(fileloc)
In [3]:
#record list of metrics which robustness is tested
#it is important to note that some metrics such as empirical data of traffic count do not have 'robustness'
#(please refer to the thesis report)
all_metric = [ 'm03_01','m03_02', 'm05_01', 'm08_02', 'm10',
'm01_01', 'm01_02', 'm02_01', 'm02_02', 'm04_02', 'm06_01',
'm07_01', 'm07_02', 'm07_03', 'm09_01']
Rank robustness analysis investigates the degree to which the criticality outcomes (i.e. ranking of links) change when different parameter settings are applied. Spearman-rank correlation coefficient is used for this purpose.
The correlation matrix heatmap indicates the robustness of the metrics. The more bolder red colors appear in the heatmap, the more robust the metric is (i.e. uncertainties do not considerably influence the links ranking).
In [4]:
spearmans_dict = crit.rank_robustness(data_all, all_metric)
In [5]:
spearmans_dict.keys()
Out[5]:
In [6]:
net_v.corr_plot_rank_robustness(spearmans_dict['m01_01'], title='M01_01 Heatmap')
In [7]:
net_v.corr_plot_rank_robustness(spearmans_dict['m01_02'], title='M01_02 Heatmap')
In [8]:
net_v.corr_plot_rank_robustness(spearmans_dict['m02_01'], title='M02_01 Heatmap')
In [9]:
net_v.corr_plot_rank_robustness(spearmans_dict['m02_02'], title='M02_02 Heatmap')
In [10]:
net_v.corr_plot_rank_robustness(spearmans_dict['m03_01'], title='M03_01 Heatmap')
In [11]:
net_v.corr_plot_rank_robustness(spearmans_dict['m03_02'], title='M03_02 Heatmap')
In [12]:
net_v.corr_plot_rank_robustness(spearmans_dict['m05_01'], title='M05_01 Heatmap')
In [13]:
net_v.corr_plot_rank_robustness(spearmans_dict['m06_01'], title='M06_01 Heatmap')
In [14]:
net_v.corr_plot_rank_robustness(spearmans_dict['m07_01'], title='M07_01 Heatmap')
In [15]:
net_v.corr_plot_rank_robustness(spearmans_dict['m07_02'], title='M07_02 Heatmap')
In [16]:
net_v.corr_plot_rank_robustness(spearmans_dict['m07_03'], title='M07_03 Heatmap')
In [17]:
net_v.corr_plot_rank_robustness(spearmans_dict['m08_02'], title='M08_02 Heatmap')
In [18]:
net_v.corr_plot_rank_robustness(spearmans_dict['m09_01'], title='M09_01 Heatmap')
In [19]:
net_v.corr_plot_rank_robustness(spearmans_dict['m10'], title='M10 Heatmap')
The distribution robustness analysis investigates to what extent the distribution pattern (e.g. normally distributed, or positively skewed, or negatively skewed) of the criticality scores change for different model parameters settings. For this purpose, Kolmogorov-smirnov distances (K-S distance) between all replications are calculated for each metric individually.
The result is plotted on a heatmap with non-diverging colormap between dark purple (signifying low K-S distance) and bright yellow (signifying high K-S distance). The more brighter colors appear in a heatmap, the more higher K-S distances occur between the replications of a metric, thus the less robust the distribution is for that metric.
In [20]:
ks_dict = crit.dist_robustness(data_all, all_metric)
In [21]:
ks_dict.keys()
Out[21]:
In [22]:
net_v.corr_plot_distribution_robustness(ks_dict['m01_01'], title='M01_01 Heatmap')
In [23]:
net_v.corr_plot_distribution_robustness(ks_dict['m01_02'], title='M01_02 Heatmap')
In [24]:
net_v.corr_plot_distribution_robustness(ks_dict['m02_01'], title='M02_01 Heatmap')
In [25]:
net_v.corr_plot_distribution_robustness(ks_dict['m02_02'], title='M02_02 Heatmap')
In [26]:
net_v.corr_plot_distribution_robustness(ks_dict['m03_01'], title='M03_01 Heatmap')
In [27]:
net_v.corr_plot_distribution_robustness(ks_dict['m03_02'], title='M03_01 Heatmap')
In [28]:
net_v.corr_plot_distribution_robustness(ks_dict['m05_01'], title='M05_01 Heatmap')
In [29]:
net_v.corr_plot_distribution_robustness(ks_dict['m06_01'], title='M06_01 Heatmap')
In [30]:
net_v.corr_plot_distribution_robustness(ks_dict['m07_01'], title='M07_01 Heatmap')
In [31]:
net_v.corr_plot_distribution_robustness(ks_dict['m07_02'], title='M07_02 Heatmap')
In [32]:
net_v.corr_plot_distribution_robustness(ks_dict['m07_03'], title='M07_03 Heatmap')
In [33]:
net_v.corr_plot_distribution_robustness(ks_dict['m08_02'], title='M08_02 Heatmap')
In [34]:
net_v.corr_plot_distribution_robustness(ks_dict['m09_01'], title='M09_01 Heatmap')
In [35]:
net_v.corr_plot_distribution_robustness(ks_dict['m10'], title='M10 Heatmap')
The final robustness analysis observes to what extent the actual values (numbers) of the criticality scores change. For this purpose, statistical dispersion measures of Mean Absolute Deviation (MAD) and Standard Deviation (SD) are used. The higher the measures, the more dispersed the change of the criticality value is when faced with uncertainty. This signifies that it is possible that some links become extremely critical, given some parameters settings of the model
In [36]:
val_sen_df = crit.value_sensitivity(data_all, all_metric)
In [38]:
net_v.plot_val_sen(df=val_sen_df, title='Value Sensitivity of All Metrics')
In [ ]: