Skip to content

Commit 813f4a3

Browse files
committed
add documentation for kaggle functions
1 parent 0ddf12d commit 813f4a3

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

gnss_lib_py/parsers/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def solve_kaggle_baseline(navdata):
532532

533533
return state_estimate
534534

535-
def prepare_kaggle_submission(state_estimate, trip_id):
535+
def prepare_kaggle_submission(state_estimate, trip_id="trace/phone"):
536536
"""Converts from gnss_lib_py receiver state to Kaggle submission.
537537
538538
Parameters

notebooks/tutorials/parsers.ipynb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,84 @@
137137
"gt_data.rows"
138138
]
139139
},
140+
{
141+
"cell_type": "markdown",
142+
"id": "c849214b",
143+
"metadata": {},
144+
"source": [
145+
"# 2022 Google Decimeter Kaggle Challenge\n",
146+
"There are utility functions to prepare Kaggle submissions for the 2022 challenge."
147+
]
148+
},
149+
{
150+
"cell_type": "markdown",
151+
"id": "83ac7998",
152+
"metadata": {},
153+
"source": [
154+
"We offer a function to convert the provided Weighted Least Squares baseline solution into the standard `state_estimate` format found throughout `gnss_lib_py`. Simply pass in the derived data NavData object."
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": null,
160+
"id": "a990ec31",
161+
"metadata": {},
162+
"outputs": [],
163+
"source": [
164+
"from gnss_lib_py.parsers.android import solve_kaggle_baseline\n",
165+
"\n",
166+
"state_estimate = solve_kaggle_baseline(derived_data)\n",
167+
"\n",
168+
"print(state_estimate)"
169+
]
170+
},
171+
{
172+
"cell_type": "markdown",
173+
"id": "f1504d5d",
174+
"metadata": {},
175+
"source": [
176+
"`prepare_kaggle_submission` can be used to convert the standard `state_estimate` format to a NavData object with the same rows and row names which the 2022 Kaggle competition expects. The `trip_id` is a combination of the trajectory trace name and phone name."
177+
]
178+
},
179+
{
180+
"cell_type": "code",
181+
"execution_count": null,
182+
"id": "22f43b10",
183+
"metadata": {},
184+
"outputs": [],
185+
"source": [
186+
"from gnss_lib_py.parsers.android import prepare_kaggle_submission\n",
187+
"\n",
188+
"solution = prepare_kaggle_submission(state_estimate, trip_id = \"my_trace/my_phone\")\n",
189+
"\n",
190+
"print(solution)"
191+
]
192+
},
193+
{
194+
"cell_type": "markdown",
195+
"id": "7e8879f2",
196+
"metadata": {},
197+
"source": [
198+
"`solve_kaggle_dataset` can be used to automatically iterate through all trace trajectory names and phone names, estimate the state using the provided solver, and concatenate all state estimates together for a single submission. The `solver` variable could use `solve_kaggle_baseline`, `solve_wls`, or `solve_gnss_ekf` for example.\n"
199+
]
200+
},
201+
{
202+
"cell_type": "code",
203+
"execution_count": null,
204+
"id": "49659881",
205+
"metadata": {},
206+
"outputs": [],
207+
"source": [
208+
"from gnss_lib_py.parsers.android import solve_kaggle_dataset\n",
209+
"from gnss_lib_py.algorithms.snapshot import solve_wls\n",
210+
"\n",
211+
"# submission = solve_kaggle_dataset(folder_path = \"/path/to/train/or/test/folder/\", \n",
212+
"# solver = solve_wls)\n",
213+
"\n",
214+
"# after the submission NavData object is created, save it to a csv with:\n",
215+
"# submission.to_csv(\"file_path.csv\")"
216+
]
217+
},
140218
{
141219
"cell_type": "markdown",
142220
"id": "0f78bfdb",

0 commit comments

Comments
 (0)