Commit c234ff23 authored by Christian Marius Lillelund's avatar Christian Marius Lillelund
Browse files

updated notebooks

parent 2af58327
......@@ -70,4 +70,4 @@ def main():
print(f"Processed data dictionary: {pt.PROCESSED_DATA_DIR}\n")
if __name__ == "__main__":
main()
\ No newline at end of file
main()
......@@ -2,17 +2,17 @@
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import paths as pt\n",
"from tools import data_loader\n",
"from utility.settings import load_settings\n",
"from utility.config import load_config\n",
"\n",
"# Load data\n",
"target_settings = load_settings(pt.CONFIGS_DIR, \"alarm.yaml\")\n",
"target_settings = load_config(pt.CONFIGS_DIR, \"alarm.yaml\")\n",
"dl = data_loader.AlarmDataLoader(pt.PROCESSED_DATA_DIR,\n",
" \"alarm_emb.csv\",\n",
" target_settings).load_data()\n",
......@@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 2,
"metadata": {},
"outputs": [
{
......@@ -68,16 +68,16 @@
" <td>1</td>\n",
" <td>1356</td>\n",
" <td>1</td>\n",
" <td>0.199672</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>0.166656</td>\n",
" <td>0.105815</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
......@@ -85,16 +85,16 @@
" <td>0</td>\n",
" <td>941</td>\n",
" <td>2</td>\n",
" <td>-0.594549</td>\n",
" <td>-0.392896</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.570200</td>\n",
" <td>-0.435632</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
......@@ -102,16 +102,16 @@
" <td>0</td>\n",
" <td>756</td>\n",
" <td>19</td>\n",
" <td>-0.181450</td>\n",
" <td>-0.091430</td>\n",
" <td>0.019236</td>\n",
" <td>-0.117416</td>\n",
" <td>-0.511346</td>\n",
" <td>-0.075962</td>\n",
" <td>-0.150036</td>\n",
" <td>0.287876</td>\n",
" <td>0.041141</td>\n",
" <td>-0.220559</td>\n",
" <td>-0.193359</td>\n",
" <td>-0.006311</td>\n",
" <td>0.055417</td>\n",
" <td>-0.119053</td>\n",
" <td>-0.361302</td>\n",
" <td>-0.066996</td>\n",
" <td>-0.100513</td>\n",
" <td>0.303188</td>\n",
" <td>0.060278</td>\n",
" <td>-0.205257</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
......@@ -119,16 +119,16 @@
" <td>0</td>\n",
" <td>1374</td>\n",
" <td>2</td>\n",
" <td>-0.166661</td>\n",
" <td>-0.110422</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.166832</td>\n",
" <td>-0.225226</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
......@@ -136,16 +136,16 @@
" <td>1</td>\n",
" <td>1129</td>\n",
" <td>2</td>\n",
" <td>-0.166661</td>\n",
" <td>-0.110422</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.166832</td>\n",
" <td>-0.225226</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
......@@ -170,16 +170,16 @@
" <td>0</td>\n",
" <td>792</td>\n",
" <td>3</td>\n",
" <td>-0.204980</td>\n",
" <td>-0.144575</td>\n",
" <td>0.794214</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.257455</td>\n",
" <td>-0.168293</td>\n",
" <td>0.776252</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12391</th>\n",
......@@ -187,16 +187,16 @@
" <td>0</td>\n",
" <td>1412</td>\n",
" <td>17</td>\n",
" <td>0.104034</td>\n",
" <td>0.031789</td>\n",
" <td>0.019236</td>\n",
" <td>0.676085</td>\n",
" <td>0.398754</td>\n",
" <td>0.243811</td>\n",
" <td>0.021354</td>\n",
" <td>-0.087159</td>\n",
" <td>-0.250247</td>\n",
" <td>-0.220559</td>\n",
" <td>0.083509</td>\n",
" <td>0.078646</td>\n",
" <td>0.055417</td>\n",
" <td>0.530685</td>\n",
" <td>0.307721</td>\n",
" <td>0.261204</td>\n",
" <td>0.042398</td>\n",
" <td>-0.126977</td>\n",
" <td>-0.273135</td>\n",
" <td>-0.205257</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12392</th>\n",
......@@ -204,16 +204,16 @@
" <td>0</td>\n",
" <td>1406</td>\n",
" <td>7</td>\n",
" <td>-0.292079</td>\n",
" <td>-0.252366</td>\n",
" <td>0.028053</td>\n",
" <td>-0.189861</td>\n",
" <td>0.146364</td>\n",
" <td>0.301017</td>\n",
" <td>-0.043149</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.308412</td>\n",
" <td>-0.255356</td>\n",
" <td>-0.012714</td>\n",
" <td>-0.144388</td>\n",
" <td>0.205516</td>\n",
" <td>0.346183</td>\n",
" <td>0.043181</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12393</th>\n",
......@@ -221,16 +221,16 @@
" <td>0</td>\n",
" <td>1423</td>\n",
" <td>1</td>\n",
" <td>1.154176</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>1.059167</td>\n",
" <td>0.105815</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.089250</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12394</th>\n",
......@@ -238,16 +238,16 @@
" <td>1</td>\n",
" <td>437</td>\n",
" <td>5</td>\n",
" <td>0.199672</td>\n",
" <td>0.051522</td>\n",
" <td>0.019236</td>\n",
" <td>0.296423</td>\n",
" <td>0.025089</td>\n",
" <td>0.101120</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>0.166656</td>\n",
" <td>0.081168</td>\n",
" <td>0.055417</td>\n",
" <td>0.337234</td>\n",
" <td>0.006832</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.130080</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
......@@ -256,35 +256,35 @@
],
"text/plain": [
" BirthYear Gender LoanPeriod NumberAts 1Ats 2Ats 3Ats \\\n",
"0 3 1 1356 1 0.199672 0.100135 0.064326 \n",
"1 26 0 941 2 -0.594549 -0.392896 0.064326 \n",
"2 30 0 756 19 -0.181450 -0.091430 0.019236 \n",
"3 32 0 1374 2 -0.166661 -0.110422 0.064326 \n",
"4 33 1 1129 2 -0.166661 -0.110422 0.064326 \n",
"0 3 1 1356 1 0.166656 0.105815 0.059605 \n",
"1 26 0 941 2 -0.570200 -0.435632 0.059605 \n",
"2 30 0 756 19 -0.193359 -0.006311 0.055417 \n",
"3 32 0 1374 2 -0.166832 -0.225226 0.059605 \n",
"4 33 1 1129 2 -0.166832 -0.225226 0.059605 \n",
"... ... ... ... ... ... ... ... \n",
"12390 59 0 792 3 -0.204980 -0.144575 0.794214 \n",
"12391 64 0 1412 17 0.104034 0.031789 0.019236 \n",
"12392 65 0 1406 7 -0.292079 -0.252366 0.028053 \n",
"12393 75 0 1423 1 1.154176 0.100135 0.064326 \n",
"12394 98 1 437 5 0.199672 0.051522 0.019236 \n",
"12390 59 0 792 3 -0.257455 -0.168293 0.776252 \n",
"12391 64 0 1412 17 0.083509 0.078646 0.055417 \n",
"12392 65 0 1406 7 -0.308412 -0.255356 -0.012714 \n",
"12393 75 0 1423 1 1.059167 0.105815 0.059605 \n",
"12394 98 1 437 5 0.166656 0.081168 0.055417 \n",
"\n",
" 4Ats 5Ats 6Ats 7Ats 8Ats 9Ats 10Ats \n",
"0 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"1 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"2 -0.117416 -0.511346 -0.075962 -0.150036 0.287876 0.041141 -0.220559 \n",
"3 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"4 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"0 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"1 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"2 -0.119053 -0.361302 -0.066996 -0.100513 0.303188 0.060278 -0.205257 \n",
"3 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"4 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"... ... ... ... ... ... ... ... \n",
"12390 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"12391 0.676085 0.398754 0.243811 0.021354 -0.087159 -0.250247 -0.220559 \n",
"12392 -0.189861 0.146364 0.301017 -0.043149 -0.054068 -0.129894 -0.127555 \n",
"12393 -0.134273 -0.103049 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"12394 0.296423 0.025089 0.101120 -0.132757 -0.054068 -0.129894 -0.127555 \n",
"12390 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"12391 0.530685 0.307721 0.261204 0.042398 -0.126977 -0.273135 -0.205257 \n",
"12392 -0.144388 0.205516 0.346183 0.043181 -0.025583 -0.146478 -0.130080 \n",
"12393 -0.103876 -0.089250 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"12394 0.337234 0.006832 0.119591 -0.159822 -0.025583 -0.146478 -0.130080 \n",
"\n",
"[12395 rows x 14 columns]"
]
},
"execution_count": 15,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
......@@ -295,7 +295,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 3,
"metadata": {},
"outputs": [
{
......@@ -306,7 +306,7 @@
" dtype=[('Status', '?'), ('Days_to_alarm', '>i4')])"
]
},
"execution_count": 16,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
......@@ -317,7 +317,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -334,7 +334,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -401,7 +401,7 @@
"5 False 2420"
]
},
"execution_count": 18,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
......@@ -412,7 +412,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 6,
"metadata": {},
"outputs": [
{
......@@ -421,7 +421,7 @@
"Text(0.5, 0, 'time $t$')"
]
},
"execution_count": 19,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
......@@ -450,7 +450,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -468,7 +468,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 8,
"metadata": {},
"outputs": [
{
......@@ -494,7 +494,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
......@@ -506,7 +506,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -515,7 +515,7 @@
"RandomSurvivalForest(max_depth=3, n_estimators=200, n_jobs=-1, random_state=0)"
]
},
"execution_count": 23,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
......@@ -532,16 +532,16 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.707258074451117"
"0.704631146739095"
]
},
"execution_count": 24,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
......@@ -552,26 +552,26 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 43.852772\n",
"1 106.172583\n",
"2 120.851955\n",
"3 128.619932\n",
"4 107.511293\n",
"5 204.250038\n",
"6 88.117035\n",
"7 120.768701\n",
"8 107.511293\n",
"9 202.797878\n",
"0 47.075996\n",
"1 103.167818\n",
"2 122.470135\n",
"3 128.431295\n",
"4 104.533085\n",
"5 211.591133\n",
"6 91.882114\n",
"7 117.041465\n",
"8 104.533085\n",
"9 202.621235\n",
"dtype: float64"
]
},
"execution_count": 25,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
......@@ -583,7 +583,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 13,
"metadata": {},
"outputs": [
{
......@@ -630,16 +630,16 @@
" <td>1</td>\n",
" <td>1045</td>\n",
" <td>1</td>\n",
" <td>0.199672</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.10112</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>0.166656</td>\n",
" <td>0.105815</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.08925</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.13008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5131</th>\n",
......@@ -647,16 +647,16 @@
" <td>1</td>\n",
" <td>163</td>\n",
" <td>1</td>\n",
" <td>-0.204980</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.10112</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.257455</td>\n",
" <td>0.105815</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.08925</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.13008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11062</th>\n",
......@@ -664,16 +664,16 @@
" <td>0</td>\n",
" <td>12</td>\n",
" <td>1</td>\n",
" <td>-0.315005</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.10112</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.225707</td>\n",
" <td>0.105815</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.08925</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.13008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11890</th>\n",
......@@ -681,16 +681,16 @@
" <td>0</td>\n",
" <td>1144</td>\n",
" <td>2</td>\n",
" <td>-0.280638</td>\n",
" <td>0.147751</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.10112</td>\n",
" <td>-0.132757</td>\n",
" <td>-0.054068</td>\n",
" <td>-0.129894</td>\n",
" <td>-0.127555</td>\n",
" <td>-0.267148</td>\n",
" <td>0.138215</td>\n",
" <td>0.059605</td>\n",
" <td>-0.103876</td>\n",
" <td>-0.08925</td>\n",
" <td>0.119591</td>\n",
" <td>-0.159822</td>\n",
" <td>-0.025583</td>\n",
" <td>-0.146478</td>\n",
" <td>-0.13008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2610</th>\n",
......@@ -698,16 +698,16 @@
" <td>0</td>\n",
" <td>331</td>\n",
" <td>1</td>\n",
" <td>-0.204980</td>\n",
" <td>0.100135</td>\n",
" <td>0.064326</td>\n",
" <td>-0.134273</td>\n",
" <td>-0.103049</td>\n",
" <td>0.10112</td>\n",