{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":102335,"databundleVersionId":12518947,"sourceType":"competition"},{"sourceId":242561727,"sourceType":"kernelVersion"}],"dockerImageVersionId":31040,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# CMI 2025\n## Using the metric\n\nJust a quick note to show how to use the competition metric without copy-pasting any code or having to write your own function.\n\nAdd the notebook [\"CMI_2025\"](https://www.kaggle.com/code/metric/cmi-2025) to your notebook using the \"Add Input\" button in the \"Notebook\" pane to the right of the notebook editor. Just search for \"CMI_2025\" in the search bar. \n\nNext include the following import statement:","metadata":{}},{"cell_type":"code","source":"from metric import score","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-06T11:46:09.553012Z","iopub.execute_input":"2025-06-06T11:46:09.553352Z","iopub.status.idle":"2025-06-06T11:46:09.558434Z","shell.execute_reply.started":"2025-06-06T11:46:09.553331Z","shell.execute_reply":"2025-06-06T11:46:09.557494Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"This loads the scoring function `score` from the utility script `metric.py` contained in the notebook you just added.\n\nThen the score function can be used directly in your own notebook (example taken from the docstring for the `score` function from the CMI_2025 notebook):","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nrow_id_column_name = \"id\"\nsolution = pd.DataFrame({'id': range(4),\n                         'gesture': ['Eyebrow - pull hair']*4})\nsubmission = pd.DataFrame({'id': range(4), \n                           'gesture': ['Forehead - pull hairline']*4})\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-06T11:46:09.560083Z","iopub.execute_input":"2025-06-06T11:46:09.560536Z","iopub.status.idle":"2025-06-06T11:46:09.582137Z","shell.execute_reply.started":"2025-06-06T11:46:09.560508Z","shell.execute_reply":"2025-06-06T11:46:09.580980Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"score(solution, submission, row_id_column_name=row_id_column_name)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-06-06T11:46:09.583748Z","iopub.execute_input":"2025-06-06T11:46:09.584083Z","iopub.status.idle":"2025-06-06T11:46:09.612050Z","shell.execute_reply.started":"2025-06-06T11:46:09.584048Z","shell.execute_reply":"2025-06-06T11:46:09.610907Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"That's it! I plan to make a helper function that will take vectors of observed gestures and predicted gestures (i.e. as output from sklearn models), construct the 'solution' and 'submission' dataframes as above and then call the score function. ","metadata":{}}]}