Skip to content

Commit

Permalink
analyze ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Schneider committed Aug 4, 2020
1 parent 2a7e0cc commit 4a08ae6
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions eval/research_q_2_distance_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@
" return [label_mapping[l] for l in original_labels]"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [],
"source": [
"# analyze difference between k=1,2,3\n",
"def analyze_ratio(metric, k1_by_k3=False):\n",
" df_k1 = df_wo_inf[df_wo_inf['hierarchy'] == '[1]']\n",
" df_k3 = df_wo_inf[df_wo_inf['hierarchy'] == '[2, 4]']\n",
"\n",
" np.mean(df_k3[metric].to_numpy() / df_k1[metric].to_numpy())\n",
"\n",
" # how much do the means per request deviate?\n",
" ratios = []\n",
" for r in range(1, 6):\n",
" mean_k1 = df_k1[df_k1['request_count'] == r][metric].mean()\n",
" mean_k3 = df_k3[df_k3['request_count'] == r][metric].mean()\n",
" if k1_by_k3:\n",
" ratio = mean_k1 / mean_k3\n",
" print(f'Ratio k1/k3 for {r} requests: {ratio}')\n",
" else:\n",
" ratio = mean_k3 / mean_k1\n",
" print(f'Ratio k3/k1 for {r} requests: {ratio}')\n",
" ratios.append(ratio)\n",
" \n",
" print(f'Min: {min(ratios)}, Max: {max(ratios)}, Mean: {np.mean(ratios)}')"
]
},
{
"cell_type": "code",
"execution_count": 60,
Expand Down Expand Up @@ -97,6 +126,28 @@
"plot_runtime(df_wo_inf)"
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ratio k1/k3 for 1 requests: 14.039137608004829\n",
"Ratio k1/k3 for 2 requests: 3.490641264692949\n",
"Ratio k1/k3 for 3 requests: 4.047355549885894\n",
"Ratio k1/k3 for 4 requests: 1.3483874411788275\n",
"Ratio k1/k3 for 5 requests: 0.9387512659005236\n",
"Min: 0.9387512659005236, Max: 14.039137608004829, Mean: 4.772854625932604\n"
]
}
],
"source": [
"analyze_ratio('runtime', k1_by_k3=True)"
]
},
{
"cell_type": "code",
"execution_count": 54,
Expand Down Expand Up @@ -146,6 +197,28 @@
"plot_delay(df_wo_inf)"
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ratio k3/k1 for 1 requests: 1.2680510324454204\n",
"Ratio k3/k1 for 2 requests: 1.176557213089767\n",
"Ratio k3/k1 for 3 requests: 1.07766541555919\n",
"Ratio k3/k1 for 4 requests: 1.1598862750934744\n",
"Ratio k3/k1 for 5 requests: 1.1741791440663432\n",
"Min: 1.07766541555919, Max: 1.2680510324454204, Mean: 1.1712678160508392\n"
]
}
],
"source": [
"analyze_ratio('sum_total_delay')"
]
},
{
"cell_type": "code",
"execution_count": 61,
Expand Down Expand Up @@ -195,6 +268,28 @@
"plot_vnfs(df_wo_inf)"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ratio k3/k1 for 1 requests: 1.0\n",
"Ratio k3/k1 for 2 requests: 1.0666666666666667\n",
"Ratio k3/k1 for 3 requests: 1.1463414634146343\n",
"Ratio k3/k1 for 4 requests: 1.1132075471698115\n",
"Ratio k3/k1 for 5 requests: 1.079734219269103\n",
"Min: 1.0, Max: 1.1463414634146343, Mean: 1.0811899793040431\n"
]
}
],
"source": [
"analyze_ratio('placements')"
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down

0 comments on commit 4a08ae6

Please sign in to comment.