Files
aiRtrafficNN/Code/python/notebooks/04_error_analysis.ipynb
T
2025-12-16 19:45:53 +01:00

741 lines
26 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "08d348cd",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from aiRNN import preprocessors"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "bb069134",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.microsoft.datawrangler.viewer.v0+json": {
"columns": [
{
"name": "index",
"rawType": "int64",
"type": "integer"
},
{
"name": "true_x",
"rawType": "float64",
"type": "float"
},
{
"name": "true_y",
"rawType": "float64",
"type": "float"
},
{
"name": "true_z",
"rawType": "float64",
"type": "float"
},
{
"name": "pred_x",
"rawType": "float64",
"type": "float"
},
{
"name": "pred_y",
"rawType": "float64",
"type": "float"
},
{
"name": "pred_z",
"rawType": "float64",
"type": "float"
}
],
"ref": "14740448-3222-42dd-972b-b69f865a9b20",
"rows": [
[
"0",
"-4.07136344909668",
"-0.10714199393987656",
"0.009901186451315882",
"-4.071313381195068",
"-0.1070994883775711",
"0.00982444267719984"
],
[
"1",
"-4.0713629722595215",
"-0.10714200884103776",
"0.009901186451315882",
"-4.071313858032227",
"-0.1070997565984726",
"0.009824465028941631"
],
[
"2",
"-4.071362495422363",
"-0.10714201629161833",
"0.009901186451315882",
"-4.071313381195068",
"-0.10710033774375916",
"0.009824340231716633"
],
[
"3",
"-4.071362018585205",
"-0.10714201629161833",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709811747074129",
"0.009824666194617747"
],
[
"4",
"-4.071361541748047",
"-0.10714202374219894",
"0.009901186451315882",
"-4.071311950683594",
"-0.1071004569530487",
"0.009824617765843868"
],
[
"5",
"-4.071361064910889",
"-0.10714203864336012",
"0.009901186451315882",
"-4.071310520172119",
"-0.107100710272789",
"0.00982434581965208"
],
[
"6",
"-4.07136058807373",
"-0.10714204609394072",
"0.009901186451315882",
"-4.071310520172119",
"-0.10710053145885468",
"0.009824211709201338"
],
[
"7",
"-4.071360111236572",
"-0.10714205354452132",
"0.009901186451315882",
"-4.071311473846436",
"-0.10710014402866364",
"0.009824209846556185"
],
[
"8",
"-4.071359634399414",
"-0.10714206844568253",
"0.009901186451315882",
"-4.071311950683594",
"-0.10709992051124571",
"0.009824250824749468"
],
[
"9",
"-4.071359157562256",
"-0.10714207589626312",
"0.009901186451315882",
"-4.07131290435791",
"-0.10709977149963378",
"0.00982432533055544"
],
[
"10",
"-4.071358680725098",
"-0.10714209079742432",
"0.009901186451315882",
"-4.07131290435791",
"-0.1070997565984726",
"0.009824340231716633"
],
[
"11",
"-4.0713582038879395",
"-0.10714209824800491",
"0.009901186451315882",
"-4.07131290435791",
"-0.1070997416973114",
"0.009824355132877825"
],
[
"12",
"-4.07135772705078",
"-0.1071421131491661",
"0.009901186451315882",
"-4.071313381195068",
"-0.10709968209266663",
"0.009824332781136038"
],
[
"13",
"-4.071357250213623",
"-0.1071421205997467",
"0.009901186451315882",
"-4.071313381195068",
"-0.1070996969938278",
"0.009824338369071485"
],
[
"14",
"-4.071356773376465",
"-0.1071421280503273",
"0.009901186451315882",
"-4.071313381195068",
"-0.1070996969938278",
"0.009824338369071485"
],
[
"15",
"-4.071356296539307",
"-0.10714214295148848",
"0.009901186451315882",
"-4.071313381195068",
"-0.10709966719150545",
"0.009824353270232676"
],
[
"16",
"-4.071356296539307",
"-0.10714215040206908",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709656774997713",
"0.009824494831264019"
],
[
"17",
"-4.071355819702148",
"-0.10714215785264967",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709936916828156",
"0.009824671782553198"
],
[
"18",
"-4.07135534286499",
"-0.10714216530323029",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709904134273528",
"0.009824867360293863"
],
[
"19",
"-4.071354389190674",
"-0.10714217275381088",
"0.009901186451315882",
"-4.071313858032227",
"-0.1070992350578308",
"0.009825271554291248"
],
[
"20",
"-4.071353912353516",
"-0.10714218020439148",
"0.009901186451315882",
"-4.07131290435791",
"-0.10709865391254424",
"0.009825694374740125"
],
[
"21",
"-4.0713534355163565",
"-0.10714218765497208",
"0.009901186451315882",
"-4.071312427520752",
"-0.10709834098815917",
"0.00982579868286848"
],
[
"22",
"-4.071352958679199",
"-0.10714219510555267",
"0.009901186451315882",
"-4.071312427520752",
"-0.10709817707538603",
"0.009825858287513256"
],
[
"23",
"-4.071352481842041",
"-0.10714220255613328",
"0.009901186451315882",
"-4.071312427520752",
"-0.10709817707538603",
"0.009825858287513256"
],
[
"24",
"-4.071352481842041",
"-0.10714221000671385",
"0.009901186451315882",
"-4.071314811706543",
"-0.10709813237190247",
"0.009824962355196478"
],
[
"25",
"-4.071352005004883",
"-0.10714221000671385",
"0.009901186451315882",
"-4.071314811706543",
"-0.107098251581192",
"0.009824880398809906"
],
[
"26",
"-4.071351528167725",
"-0.10714221745729446",
"0.009901186451315882",
"-4.071315288543701",
"-0.10709668695926666",
"0.009824709035456179"
],
[
"27",
"-4.071351528167725",
"-0.10714221745729446",
"0.009901186451315882",
"-4.071315288543701",
"-0.10709708929061888",
"0.009824770502746103"
],
[
"28",
"-4.071351528167725",
"-0.10714221745729446",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709868371486664",
"0.009825290180742739"
],
[
"29",
"-4.071351051330566",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314811706543",
"-0.1070963740348816",
"0.009824949316680431"
],
[
"30",
"-4.071351051330566",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314334869385",
"-0.1070968061685562",
"0.009825025685131548"
],
[
"31",
"-4.071350574493408",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709695518016817",
"0.009825008921325207"
],
[
"32",
"-4.071350574493408",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709667205810545",
"0.009825062938034534"
],
[
"33",
"-4.071350574493408",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709863901138304",
"0.009825351648032664"
],
[
"34",
"-4.071350574493408",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709786415100096",
"0.009825329296290873"
],
[
"35",
"-4.071350574493408",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709673166275024",
"0.009825232438743113"
],
[
"36",
"-4.07135009765625",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314811706543",
"-0.1070956140756607",
"0.009824995882809162"
],
[
"37",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709735751152039",
"0.009825254790484904"
],
[
"38",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709798336029051",
"0.009825344197452067"
],
[
"39",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709767043590544",
"0.009825344197452067"
],
[
"40",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709761083126068",
"0.009825321845710276"
],
[
"41",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071313858032227",
"-0.10709746181964874",
"0.00982531439512968"
],
[
"42",
"-4.07135009765625",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314811706543",
"-0.1070948839187622",
"0.009824995882809162"
],
[
"43",
"-4.071349620819092",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709795355796813",
"0.009825351648032664"
],
[
"44",
"-4.071349620819092",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314334869385",
"-0.1070973426103592",
"0.009825284592807295"
],
[
"45",
"-4.071349620819092",
"-0.10714222490787506",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709701478481291",
"0.009825254790484904"
],
[
"46",
"-4.07135009765625",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709661245346068",
"0.009825210087001325"
],
[
"47",
"-4.07135009765625",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709643363952635",
"0.009825195185840128"
],
[
"48",
"-4.07135009765625",
"-0.10714223235845564",
"0.009901186451315882",
"-4.071314811706543",
"-0.10709492862224577",
"0.009824988432228563"
],
[
"49",
"-4.07135009765625",
"-0.10714223980903624",
"0.009901186451315882",
"-4.071314334869385",
"-0.10709787905216216",
"0.009825299493968487"
]
],
"shape": {
"columns": 6,
"rows": 476160
}
},
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>true_x</th>\n",
" <th>true_y</th>\n",
" <th>true_z</th>\n",
" <th>pred_x</th>\n",
" <th>pred_y</th>\n",
" <th>pred_z</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>-4.071363</td>\n",
" <td>-0.107142</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071313</td>\n",
" <td>-0.107099</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>-4.071363</td>\n",
" <td>-0.107142</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071314</td>\n",
" <td>-0.107100</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>-4.071362</td>\n",
" <td>-0.107142</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071313</td>\n",
" <td>-0.107100</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>-4.071362</td>\n",
" <td>-0.107142</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071314</td>\n",
" <td>-0.107098</td>\n",
" <td>0.009825</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>-4.071362</td>\n",
" <td>-0.107142</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071312</td>\n",
" <td>-0.107100</td>\n",
" <td>0.009825</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476155</th>\n",
" <td>-4.070156</td>\n",
" <td>-0.107135</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071300</td>\n",
" <td>-0.107112</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476156</th>\n",
" <td>-4.070156</td>\n",
" <td>-0.107135</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071300</td>\n",
" <td>-0.107112</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476157</th>\n",
" <td>-4.070157</td>\n",
" <td>-0.107135</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071300</td>\n",
" <td>-0.107112</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476158</th>\n",
" <td>-4.070158</td>\n",
" <td>-0.107135</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071300</td>\n",
" <td>-0.107112</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476159</th>\n",
" <td>-4.070158</td>\n",
" <td>-0.107135</td>\n",
" <td>0.009901</td>\n",
" <td>-4.071300</td>\n",
" <td>-0.107112</td>\n",
" <td>0.009824</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>476160 rows × 6 columns</p>\n",
"</div>"
],
"text/plain": [
" true_x true_y true_z pred_x pred_y pred_z\n",
"0 -4.071363 -0.107142 0.009901 -4.071313 -0.107099 0.009824\n",
"1 -4.071363 -0.107142 0.009901 -4.071314 -0.107100 0.009824\n",
"2 -4.071362 -0.107142 0.009901 -4.071313 -0.107100 0.009824\n",
"3 -4.071362 -0.107142 0.009901 -4.071314 -0.107098 0.009825\n",
"4 -4.071362 -0.107142 0.009901 -4.071312 -0.107100 0.009825\n",
"... ... ... ... ... ... ...\n",
"476155 -4.070156 -0.107135 0.009901 -4.071300 -0.107112 0.009824\n",
"476156 -4.070156 -0.107135 0.009901 -4.071300 -0.107112 0.009824\n",
"476157 -4.070157 -0.107135 0.009901 -4.071300 -0.107112 0.009824\n",
"476158 -4.070158 -0.107135 0.009901 -4.071300 -0.107112 0.009824\n",
"476159 -4.070158 -0.107135 0.009901 -4.071300 -0.107112 0.009824\n",
"\n",
"[476160 rows x 6 columns]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"predictions = pd.read_csv(\"predictions_LSTM_wu900_ps1600_aw0.001.csv\")\n",
"predictions"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "42444041",
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Must have equal len keys and value when setting with an ndarray",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mValueError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[6]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mpredictions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mloc\u001b[49m\u001b[43m[\u001b[49m\u001b[43m:\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtrue_lat\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtrue_lon\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtrue_alt\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m = np.array(preprocessors.denorm_coords(\n\u001b[32m 2\u001b[39m predictions[\u001b[33m\"\u001b[39m\u001b[33mtrue_x\u001b[39m\u001b[33m\"\u001b[39m], predictions[\u001b[33m\"\u001b[39m\u001b[33mtrue_y\u001b[39m\u001b[33m\"\u001b[39m], predictions[\u001b[33m\"\u001b[39m\u001b[33mtrue_z\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 3\u001b[39m ))\n\u001b[32m 4\u001b[39m predictions.loc[:, [\u001b[33m\"\u001b[39m\u001b[33mpred_lat\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mpred_lon\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mpred_alt\u001b[39m\u001b[33m\"\u001b[39m]] = np.array(preprocessors.denorm_coords(\n\u001b[32m 5\u001b[39m predictions[\u001b[33m\"\u001b[39m\u001b[33mpred_x\u001b[39m\u001b[33m\"\u001b[39m], predictions[\u001b[33m\"\u001b[39m\u001b[33mpred_y\u001b[39m\u001b[33m\"\u001b[39m], predictions[\u001b[33m\"\u001b[39m\u001b[33mpred_z\u001b[39m\u001b[33m\"\u001b[39m]\n\u001b[32m 6\u001b[39m ))\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Studium/UiO/data_analysis/project3/Code/python/.venv/lib64/python3.13/site-packages/pandas/core/indexing.py:912\u001b[39m, in \u001b[36m_LocationIndexer.__setitem__\u001b[39m\u001b[34m(self, key, value)\u001b[39m\n\u001b[32m 909\u001b[39m \u001b[38;5;28mself\u001b[39m._has_valid_setitem_indexer(key)\n\u001b[32m 911\u001b[39m iloc = \u001b[38;5;28mself\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m.name == \u001b[33m\"\u001b[39m\u001b[33miloc\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m.obj.iloc\n\u001b[32m--> \u001b[39m\u001b[32m912\u001b[39m \u001b[43miloc\u001b[49m\u001b[43m.\u001b[49m\u001b[43m_setitem_with_indexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Studium/UiO/data_analysis/project3/Code/python/.venv/lib64/python3.13/site-packages/pandas/core/indexing.py:1943\u001b[39m, in \u001b[36m_iLocIndexer._setitem_with_indexer\u001b[39m\u001b[34m(self, indexer, value, name)\u001b[39m\n\u001b[32m 1940\u001b[39m \u001b[38;5;66;03m# align and set the values\u001b[39;00m\n\u001b[32m 1941\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m take_split_path:\n\u001b[32m 1942\u001b[39m \u001b[38;5;66;03m# We have to operate column-wise\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1943\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_setitem_with_indexer_split_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1944\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1945\u001b[39m \u001b[38;5;28mself\u001b[39m._setitem_single_block(indexer, value, name)\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Studium/UiO/data_analysis/project3/Code/python/.venv/lib64/python3.13/site-packages/pandas/core/indexing.py:1983\u001b[39m, in \u001b[36m_iLocIndexer._setitem_with_indexer_split_path\u001b[39m\u001b[34m(self, indexer, value, name)\u001b[39m\n\u001b[32m 1978\u001b[39m \u001b[38;5;28mself\u001b[39m._setitem_with_indexer_frame_value(indexer, value, name)\n\u001b[32m 1980\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m np.ndim(value) == \u001b[32m2\u001b[39m:\n\u001b[32m 1981\u001b[39m \u001b[38;5;66;03m# TODO: avoid np.ndim call in case it isn't an ndarray, since\u001b[39;00m\n\u001b[32m 1982\u001b[39m \u001b[38;5;66;03m# that will construct an ndarray, which will be wasteful\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1983\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_setitem_with_indexer_2d_value\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1985\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(ilocs) == \u001b[32m1\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m lplane_indexer == \u001b[38;5;28mlen\u001b[39m(value) \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_scalar(pi):\n\u001b[32m 1986\u001b[39m \u001b[38;5;66;03m# We are setting multiple rows in a single column.\u001b[39;00m\n\u001b[32m 1987\u001b[39m \u001b[38;5;28mself\u001b[39m._setitem_single_column(ilocs[\u001b[32m0\u001b[39m], value, pi)\n",
"\u001b[36mFile \u001b[39m\u001b[32m~/Documents/Studium/UiO/data_analysis/project3/Code/python/.venv/lib64/python3.13/site-packages/pandas/core/indexing.py:2049\u001b[39m, in \u001b[36m_iLocIndexer._setitem_with_indexer_2d_value\u001b[39m\u001b[34m(self, indexer, value)\u001b[39m\n\u001b[32m 2047\u001b[39m value = np.array(value, dtype=\u001b[38;5;28mobject\u001b[39m)\n\u001b[32m 2048\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(ilocs) != value.shape[\u001b[32m1\u001b[39m]:\n\u001b[32m-> \u001b[39m\u001b[32m2049\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[32m 2050\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mMust have equal len keys and value when setting with an ndarray\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 2051\u001b[39m )\n\u001b[32m 2053\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m i, loc \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(ilocs):\n\u001b[32m 2054\u001b[39m value_col = value[:, i]\n",
"\u001b[31mValueError\u001b[39m: Must have equal len keys and value when setting with an ndarray"
]
}
],
"source": [
"predictions.loc[:, [\"true_lat\", \"true_lon\", \"true_alt\"]] = np.array(preprocessors.denorm_coords(\n",
" predictions[\"true_x\"], predictions[\"true_y\"], predictions[\"true_z\"]\n",
"))\n",
"predictions.loc[:, [\"pred_lat\", \"pred_lon\", \"pred_alt\"]] = np.array(preprocessors.denorm_coords(\n",
" predictions[\"pred_x\"], predictions[\"pred_y\"], predictions[\"pred_z\"]\n",
"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bb83932e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "adsbpy",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}