From 4a08ae63a4534e846cce4ec508d3a1f15e2db656 Mon Sep 17 00:00:00 2001 From: Stefan Schneider Date: Tue, 4 Aug 2020 08:50:43 +0200 Subject: [PATCH] analyze ratio --- eval/research_q_2_distance_plots.ipynb | 95 ++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/eval/research_q_2_distance_plots.ipynb b/eval/research_q_2_distance_plots.ipynb index 8fc9085..187c7dd 100644 --- a/eval/research_q_2_distance_plots.ipynb +++ b/eval/research_q_2_distance_plots.ipynb @@ -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, @@ -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, @@ -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, @@ -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,