{"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":"**Finding Average Public Test Probabilities**\n\nSince log loss scoring provides the useful property that the score is maxmimised by predicting the mean value, we should be able to identify the average scoring probabilities for teams A & B in the public test data by LB probing to find the values that give the best scores. Submissions with the same displayed digits can be separated by ordering our submissions by 'Public Score'.","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub = pd.read_csv('../input/tabular-playground-series-oct-2022/sample_submission.csv')\nsub.sort_values(by=['id'], inplace=True)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Public LB P(A)**\n\nResults for varying P(A):\n* (0.0598, 0.0590) -> 0.22538 (1st)\n* (0.0597, 0.0590) -> 0.22538 (2nd)\n* (0.0599, 0.0590) -> 0.22538 (3rd)\n* (0.0600, 0.0590) -> 0.22538 (4th)\n* (0.0595, 0.0590) -> 0.22538 (5th)\n* (0.0590, 0.0590) -> 0.22538 (6th)\n* (0.0610, 0.0590) -> 0.22538 (7th)\n\nWe infer that the optimum value of P(A) is 0.0598 (3sf).\n\n","metadata":{}},{"cell_type":"markdown","source":"**Public LB P(B)**\n\nResults for varying P(B):\n* (0.0598, 0.0591) -> 0.22538 (1st)\n* (0.0598, 0.0590) -> 0.22538 (2nd)\n* (0.0598, 0.0592) -> 0.22538 (3rd)\n* (0.0598, 0.0588) -> 0.22538 (4th)\n* (0.0598, 0.0594) -> 0.22538 (5th)\n* (0.0598, 0.0598) -> 0.22538 (6th)\n* (0.0598, 0.0582) -> 0.22538 (7th)\n\nWe infer that the optimum value of P(B) is 0.0591 (3sf).\n\nHence, the optimum values of P(A), P(B) are (0.0598, 0.0591).","metadata":{}},{"cell_type":"markdown","source":"**Private LB P(A)**\n\nAfter the competition closing date, we are taking a *post hoc* look at the private LB data (private scores quoted).\n\nResults for varying P(A):\n\n* (0.0565, 0.0600) -> 0.21671 (1st)\n* (0.0566, 0.0600) -> 0.21671\n* (0.0564, 0.0600) -> 0.21671\n* (0.0563, 0.0600) -> 0.21671\n* (0.0568, 0.0600) -> 0.21671\n* (0.0570, 0.0600) -> 0.21671\n* (0.0560, 0.0600) -> 0.21671\n* (0.0550, 0.0600) -> 0.21672\n* (0.0590, 0.0600) -> 0.21674\n* (0.0600, 0.0600) -> 0.21676\n* (0.0520, 0.0600) -> 0.21681\n\nWe infer that the optimum value of P(A) in the private LB is 0.0565 (3sf).","metadata":{}},{"cell_type":"markdown","source":"**Private LB P(B)**\n\nAfter the competition closing date, we are taking a *post hoc* look at the private LB data (private scores quoted).\n\nResults for varying P(B):\n\n* (0.0565, 0.0561) -> 0.21664 (1st)\n* (0.0565, 0.0560) -> 0.21664\n* (0.0565, 0.0562) -> 0.21664\n* (0.0565, 0.0558) -> 0.21664\n* (0.0565, 0.0565) -> 0.21664\n* (0.0565, 0.0570) -> 0.21664\n* (0.0565, 0.0550) -> 0.21664\n* (0.0565, 0.0590) -> 0.21668\n* (0.0565, 0.0600) -> 0.21671\n\n\nWe infer that the optimum value of P(B) in the private LB is 0.0561 (3sf).\n\nHence, the optimum values of P(A), P(B) for the private LB are (0.0565, 0.0561).","metadata":{}},{"cell_type":"code","source":"PA = 0.0565\nPB = 0.0561","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub['team_A_scoring_within_10sec'] = PA\nsub['team_B_scoring_within_10sec'] = PB","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub.to_csv('submission.csv', index=False)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub.head(10)","metadata":{},"execution_count":null,"outputs":[]}]}