{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"## NOTE\n\nThis notebook aims to make sure that **weighted multi-class logarithmic loss** doesn't return zero when all of the predictions are LAA=1.0:\n\n$\\text{Log Loss} = - \\left( \\frac{\\sum^{M}_{i=1} w_{i} \\cdot \\sum_{j=1}^{N_{i}} \\frac{y_{ij}}{N_{i}} \\cdot \\ln  p_{ij} }{\\sum^{M}_{i=1} w_{i}} \\right)$\n","metadata":{}},{"cell_type":"code","source":"import pandas as pd ","metadata":{"execution":{"iopub.status.busy":"2022-09-11T00:07:19.446669Z","iopub.execute_input":"2022-09-11T00:07:19.447184Z","iopub.status.idle":"2022-09-11T00:07:19.473392Z","shell.execute_reply.started":"2022-09-11T00:07:19.447051Z","shell.execute_reply":"2022-09-11T00:07:19.472168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pd.read_csv('../input/mayo-clinic-strip-ai/test.csv')","metadata":{"execution":{"iopub.status.busy":"2022-09-11T00:07:19.475384Z","iopub.execute_input":"2022-09-11T00:07:19.475742Z","iopub.status.idle":"2022-09-11T00:07:19.48936Z","shell.execute_reply.started":"2022-09-11T00:07:19.475706Z","shell.execute_reply":"2022-09-11T00:07:19.487843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = df_test.drop_duplicates(subset=['patient_id'])","metadata":{"execution":{"iopub.status.busy":"2022-09-11T00:07:19.490758Z","iopub.execute_input":"2022-09-11T00:07:19.491153Z","iopub.status.idle":"2022-09-11T00:07:19.509733Z","shell.execute_reply.started":"2022-09-11T00:07:19.491119Z","shell.execute_reply":"2022-09-11T00:07:19.508258Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.DataFrame({ \"patient_id\": df_test.patient_id, \"CE\": [0.0] * len(df_test), \"LAA\": [1.0] * len(df_test) })\nsubmission","metadata":{"execution":{"iopub.status.busy":"2022-09-11T00:07:19.512762Z","iopub.execute_input":"2022-09-11T00:07:19.513431Z","iopub.status.idle":"2022-09-11T00:07:19.537477Z","shell.execute_reply.started":"2022-09-11T00:07:19.513381Z","shell.execute_reply":"2022-09-11T00:07:19.536207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-09-11T00:07:19.538634Z","iopub.execute_input":"2022-09-11T00:07:19.539461Z","iopub.status.idle":"2022-09-11T00:07:19.547359Z","shell.execute_reply.started":"2022-09-11T00:07:19.539423Z","shell.execute_reply":"2022-09-11T00:07:19.546157Z"},"trusted":true},"execution_count":null,"outputs":[]}]}