Commit 8fab53e8 authored by Danniene Wete's avatar Danniene Wete

rerun parameter tuning

parent b6f08075
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -33,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -179,8 +179,8 @@
" x1z2_words = list(zip(x_acc[i], z_gyr[i]))\n",
" words.extend([(str('xz')+(a+b)) for (a, b) in x1z2_words])\n",
" \n",
" #y1x2_words = list(zip(y_acc[i], x_gyr[i]))\n",
" #words.extend([(str('yz')+(a+b)) for (a, b) in y1x2_words]) \n",
" y1x2_words = list(zip(y_acc[i], x_gyr[i]))\n",
" words.extend([(str('yz')+(a+b)) for (a, b) in y1x2_words]) \n",
" \n",
" \n",
" y1y2_words = list(zip(y_acc[i], y_gyr[i]))\n",
......@@ -189,11 +189,11 @@
" y1z2_words = list(zip(y_acc[i], z_gyr[i]))\n",
" words.extend([(str('yz')+(a+b)) for (a, b) in y1z2_words]) \n",
" \n",
" #z1x2_words = list(zip(z_acc[i], x_gyr[i]))\n",
" #words.extend([(str('zx')+(a+b)) for (a, b) in z1x2_words])\n",
" z1x2_words = list(zip(z_acc[i], x_gyr[i]))\n",
" words.extend([(str('zx')+(a+b)) for (a, b) in z1x2_words])\n",
" \n",
" #z1y2_words = list(zip(z_acc[i], y_gyr[i]))\n",
" #words.extend([(str('zy')+(a+b)) for (a, b) in z1y2_words])\n",
" z1y2_words = list(zip(z_acc[i], y_gyr[i]))\n",
" words.extend([(str('zy')+(a+b)) for (a, b) in z1y2_words])\n",
" \n",
" \n",
" z1z2_words = list(zip(z_acc[i], z_gyr[i]))\n",
......@@ -205,7 +205,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......@@ -235,9 +235,9 @@
" trainGyr_centroids = calc_centroids_array(trainGyr_window, n_cluster)\n",
" \n",
" # Save centroids on disk for using later\n",
" with open('trainTestCorpus_fs4/trainAcc.centroids', 'wb') as fp:\n",
" with open('trainTestPaper/trainAcc.centroids', 'wb') as fp:\n",
" pickle.dump(trainAcc_centroids, fp)\n",
" with open('trainTestCorpus_fs4/trainGyr.centroids', 'wb') as fp: \n",
" with open('trainTestPaper/trainGyr.centroids', 'wb') as fp: \n",
" pickle.dump(trainGyr_centroids, fp)\n",
" \n",
" \n",
......@@ -291,7 +291,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.7"
}
},
"nbformat": 4,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -179,8 +179,8 @@
" x1z2_words = list(zip(x_acc[i], z_gyr[i]))\n",
" words.extend([(str('xz')+(a+b)) for (a, b) in x1z2_words])\n",
" \n",
" #y1x2_words = list(zip(y_acc[i], x_gyr[i]))\n",
" #words.extend([(str('yz')+(a+b)) for (a, b) in y1x2_words]) \n",
" y1x2_words = list(zip(y_acc[i], x_gyr[i]))\n",
" words.extend([(str('yz')+(a+b)) for (a, b) in y1x2_words]) \n",
" \n",
" \n",
" y1y2_words = list(zip(y_acc[i], y_gyr[i]))\n",
......@@ -192,12 +192,12 @@
" z1x2_words = list(zip(z_acc[i], x_gyr[i]))\n",
" words.extend([(str('zx')+(a+b)) for (a, b) in z1x2_words])\n",
" \n",
" #z1y2_words = list(zip(z_acc[i], y_gyr[i]))\n",
" #words.extend([(str('zy')+(a+b)) for (a, b) in z1y2_words])\n",
" z1y2_words = list(zip(z_acc[i], y_gyr[i]))\n",
" words.extend([(str('zy')+(a+b)) for (a, b) in z1y2_words])\n",
" \n",
" \n",
" # z1z2_words = list(zip(z_acc[i], z_gyr[i]))\n",
" # words.extend([(str('zz')+(a+b)) for (a, b) in z1z2_words])\n",
" z1z2_words = list(zip(z_acc[i], z_gyr[i]))\n",
" words.extend([(str('zz')+(a+b)) for (a, b) in z1z2_words])\n",
" bow.append(words)\n",
" \n",
" return np.array(bow) "
......@@ -225,8 +225,8 @@
" trainAcc_window = sliding_window_approach(trainAcc,window_length,overlap_length)\n",
" trainGyr_window = sliding_window_approach(trainGyr,window_length,overlap_length)\n",
" \n",
" #testAcc_window = sliding_window_approach(testAcc,window_length,overlap_length)\n",
" #testGyr_window = sliding_window_approach(testGyr,window_length,overlap_length)\n",
" testAcc_window = sliding_window_approach(testAcc,window_length,overlap_length)\n",
" testGyr_window = sliding_window_approach(testGyr,window_length,overlap_length)\n",
" \n",
" \n",
" \n",
......@@ -235,10 +235,10 @@
" trainGyr_centroids = calc_centroids_array(trainGyr_window, n_cluster)\n",
" \n",
" # Save centroids on disk for using later\n",
" #with open('trainTestCorpus_m2c/trainAcc.centroids', 'wb') as fp:\n",
" # pickle.dump(trainAcc_centroids, fp)\n",
" # with open('trainTestCorpus_m2c/trainGyr.centroids', 'wb') as fp: \n",
" # pickle.dump(trainGyr_centroids, fp)\n",
" with open('trainTestPaper/trainAcc.centroids', 'wb') as fp:\n",
" pickle.dump(trainAcc_centroids, fp)\n",
" with open('trainTestPaper/trainGyr.centroids', 'wb') as fp: \n",
" pickle.dump(trainGyr_centroids, fp)\n",
" \n",
" \n",
" #3. Map centroids to characters\n",
......@@ -249,22 +249,22 @@
" \n",
" trainAcc_count = trainAcc.shape[0]\n",
" trainGyr_count = trainGyr.shape[0]\n",
" #testAcc_count = testAcc.shape[0]\n",
" #testGyr_count = testGyr.shape[0]\n",
" testAcc_count = testAcc.shape[0]\n",
" testGyr_count = testGyr.shape[0]\n",
" \n",
" #4 Assign subsequences to cluster centre and replace subsequence with alphabet of cluster centre\n",
" trainAcc_charsSeq = mapCodewordsToChars(trainAcc_window, trainAcc_centroids,trainAcc_count)\n",
" trainGyr_charsSeq = mapCodewordsToChars(trainGyr_window, trainGyr_centroids,trainGyr_count) \n",
" #testAcc_charsSeq = mapCodewordsToChars(testAcc_window, trainAcc_centroids, testAcc_count)\n",
" #testGyr_charsSeq = mapCodewordsToChars(testGyr_window, trainGyr_centroids, testGyr_count)\n",
" testAcc_charsSeq = mapCodewordsToChars(testAcc_window, trainAcc_centroids, testAcc_count)\n",
" testGyr_charsSeq = mapCodewordsToChars(testGyr_window, trainGyr_centroids, testGyr_count)\n",
" \n",
" \n",
" #5. Create train and test bag of words\n",
" trainBow = create_words(trainAcc_charsSeq, trainGyr_charsSeq)\n",
" #testBow = create_words(testAcc_charsSeq, testGyr_charsSeq) \n",
" testBow = create_words(testAcc_charsSeq, testGyr_charsSeq) \n",
" \n",
" \n",
" return trainBow# testBow "
" return trainBow, testBow "
]
},
{
......@@ -291,7 +291,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.7"
}
},
"nbformat": 4,
......
......@@ -27,7 +27,7 @@ z
" style="fill:#ffffff;"/>
</g>
<g id="patch_3">
<path clip-path="url(#pba5578783b)" d="M 46.145455 252
<path clip-path="url(#pfec6ded6a0)" d="M 46.145455 252
L 74.132915 252
L 74.132915 251.990413
L 46.145455 251.990413
......@@ -35,7 +35,7 @@ z
" style="fill:#0000ff;"/>
</g>
<g id="patch_4">
<path clip-path="url(#pba5578783b)" d="M 81.129781 252
<path clip-path="url(#pfec6ded6a0)" d="M 81.129781 252
L 109.117241 252
L 109.117241 251.990413
L 81.129781 251.990413
......@@ -43,7 +43,7 @@ z
" style="fill:#0000ff;"/>
</g>
<g id="patch_5">
<path clip-path="url(#pba5578783b)" d="M 116.114107 252
<path clip-path="url(#pfec6ded6a0)" d="M 116.114107 252
L 144.101567 252
L 144.101567 251.990413
L 116.114107 251.990413
......@@ -51,7 +51,7 @@ z
" style="fill:#0000ff;"/>
</g>
<g id="patch_6">
<path clip-path="url(#pba5578783b)" d="M 151.098433 252
<path clip-path="url(#pfec6ded6a0)" d="M 151.098433 252
L 179.085893 252
L 179.085893 251.990413
L 151.098433 251.990413
......@@ -59,7 +59,7 @@ z
" style="fill:#0000ff;"/>
</g>
<g id="patch_7">
<path clip-path="url(#pba5578783b)" d="M 186.082759 252
<path clip-path="url(#pfec6ded6a0)" d="M 186.082759 252
L 214.070219 252
L 214.070219 44.914286
L 186.082759 44.914286
......@@ -67,7 +67,7 @@ z
" style="fill:#0000ff;"/>
</g>
<g id="patch_8">
<path clip-path="url(#pba5578783b)" d="M 221.067085 252
<path clip-path="url(#pfec6ded6a0)" d="M 221.067085 252
L 249.054545 252
L 249.054545 251.990413
L 221.067085 251.990413
......@@ -80,10 +80,10 @@ z
<defs>
<path d="M 0 0
L 0 3.5
" id="m7bb0afb362" style="stroke:#000000;stroke-width:0.8;"/>
" id="mf69b6e1491" style="stroke:#000000;stroke-width:0.8;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="60.139185" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="60.139185" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_1">
......@@ -128,7 +128,7 @@ z
<g id="xtick_2">
<g id="line2d_2">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="95.123511" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="95.123511" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_2">
......@@ -161,7 +161,7 @@ z
<g id="xtick_3">
<g id="line2d_3">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="130.107837" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="130.107837" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_3">
......@@ -214,7 +214,7 @@ z
<g id="xtick_4">
<g id="line2d_4">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="165.092163" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="165.092163" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_4">
......@@ -246,7 +246,7 @@ z
<g id="xtick_5">
<g id="line2d_5">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="200.076489" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="200.076489" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_5">
......@@ -270,7 +270,7 @@ z
<g id="xtick_6">
<g id="line2d_6">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="235.060815" xlink:href="#m7bb0afb362" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="235.060815" xlink:href="#mf69b6e1491" y="252"/>
</g>
</g>
<g id="text_6">
......@@ -508,10 +508,10 @@ z
<defs>
<path d="M 0 0
L -3.5 0
" id="md7e963cc21" style="stroke:#000000;stroke-width:0.8;"/>
" id="m326b02a1e8" style="stroke:#000000;stroke-width:0.8;"/>
</defs>
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="252"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="252"/>
</g>
</g>
<g id="text_8">
......@@ -555,7 +555,7 @@ z
<g id="ytick_2">
<g id="line2d_8">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="210.57327"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="210.57327"/>
</g>
</g>
<g id="text_9">
......@@ -596,7 +596,7 @@ z
<g id="ytick_3">
<g id="line2d_9">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="169.146541"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="169.146541"/>
</g>
</g>
<g id="text_10">
......@@ -630,7 +630,7 @@ z
<g id="ytick_4">
<g id="line2d_10">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="127.719811"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="127.719811"/>
</g>
</g>
<g id="text_11">
......@@ -677,7 +677,7 @@ z
<g id="ytick_5">
<g id="line2d_11">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="86.293081"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="86.293081"/>
</g>
</g>
<g id="text_12">
......@@ -733,7 +733,7 @@ z
<g id="ytick_6">
<g id="line2d_12">
<g>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#md7e963cc21" y="44.866351"/>
<use style="stroke:#000000;stroke-width:0.8;" x="36" xlink:href="#m326b02a1e8" y="44.866351"/>
</g>
</g>
<g id="text_13">
......@@ -978,7 +978,7 @@ z
</g>
</g>
<defs>
<clipPath id="pba5578783b">
<clipPath id="pfec6ded6a0">
<rect height="217.44" width="223.2" x="36" y="34.56"/>
</clipPath>
</defs>
......
......@@ -259,7 +259,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.7"
}
},
"nbformat": 4,
......
......@@ -574,7 +574,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.7"
}
},
"nbformat": 4,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment