{"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":"code","source":"%%capture\n!pip install nb-black","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:57:29.221074Z","iopub.execute_input":"2023-01-10T02:57:29.221465Z","iopub.status.idle":"2023-01-10T02:57:41.550057Z","shell.execute_reply.started":"2023-01-10T02:57:29.221373Z","shell.execute_reply":"2023-01-10T02:57:41.548692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%capture\n%load_ext lab_black\n%load_ext autoreload\n%autoreload 2","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:57:41.551899Z","iopub.execute_input":"2023-01-10T02:57:41.553092Z","iopub.status.idle":"2023-01-10T02:57:41.730872Z","shell.execute_reply.started":"2023-01-10T02:57:41.553029Z","shell.execute_reply":"2023-01-10T02:57:41.729864Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\nimport pandas as pd\n\nplt.style.use(\"ggplot\")","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:57:41.732754Z","iopub.execute_input":"2023-01-10T02:57:41.733133Z","iopub.status.idle":"2023-01-10T02:57:42.240409Z","shell.execute_reply.started":"2023-01-10T02:57:41.733099Z","shell.execute_reply":"2023-01-10T02:57:42.239761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lb = pd.read_csv(\n    \"/kaggle/input/otto-public-leader-board/otto-recommender-system-publicleaderboard.csv\"\n)\nlb[\"SubmissionDate\"] = pd.to_datetime(lb[\"SubmissionDate\"])","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:57:42.242852Z","iopub.execute_input":"2023-01-10T02:57:42.243464Z","iopub.status.idle":"2023-01-10T02:57:42.306950Z","shell.execute_reply.started":"2023-01-10T02:57:42.243410Z","shell.execute_reply":"2023-01-10T02:57:42.306017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(figsize=(16, 6))\ndf = lb.query(\"Score > 0.57\")\nsns.histplot(data=df, x=\"Score\", binwidth=0.001)","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:57:42.308223Z","iopub.execute_input":"2023-01-10T02:57:42.308839Z","iopub.status.idle":"2023-01-10T02:57:42.610382Z","shell.execute_reply.started":"2023-01-10T02:57:42.308807Z","shell.execute_reply":"2023-01-10T02:57:42.609528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\n    f\"{len(lb.query('Score >= 0.579')) / len(lb) * 100:.2f}% of teams scored >= 0.579.\"\n)","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:58:31.292893Z","iopub.execute_input":"2023-01-10T02:58:31.293220Z","iopub.status.idle":"2023-01-10T02:58:31.329016Z","shell.execute_reply.started":"2023-01-10T02:58:31.293193Z","shell.execute_reply":"2023-01-10T02:58:31.327984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(figsize=(16, 6))\nsns.histplot(data=lb, x=\"Score\", cumulative=True, stat=\"percent\", bins=200)","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:58:44.550786Z","iopub.execute_input":"2023-01-10T02:58:44.551227Z","iopub.status.idle":"2023-01-10T02:58:45.066759Z","shell.execute_reply.started":"2023-01-10T02:58:44.551191Z","shell.execute_reply":"2023-01-10T02:58:45.065851Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\n    \"{:.1f}% of teams are active in current 7 days.\".format(\n        len(lb.query(\"SubmissionDate > '2023-01-03'\")) / len(lb) * 100\n    )\n)","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:58:26.230723Z","iopub.execute_input":"2023-01-10T02:58:26.231058Z","iopub.status.idle":"2023-01-10T02:58:26.266525Z","shell.execute_reply.started":"2023-01-10T02:58:26.231033Z","shell.execute_reply":"2023-01-10T02:58:26.265358Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_, ax = plt.subplots(figsize=(16, 6))\nsns.histplot(data=lb, x=\"SubmissionDate\", bins=100, cumulative=True, stat=\"percent\")","metadata":{"execution":{"iopub.status.busy":"2023-01-10T02:58:45.068680Z","iopub.execute_input":"2023-01-10T02:58:45.069052Z","iopub.status.idle":"2023-01-10T02:58:45.451338Z","shell.execute_reply.started":"2023-01-10T02:58:45.069017Z","shell.execute_reply":"2023-01-10T02:58:45.450444Z"},"trusted":true},"execution_count":null,"outputs":[]}]}