{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":21154,"databundleVersionId":1243559,"sourceType":"competition"},{"sourceId":3016742,"sourceType":"datasetVersion","datasetId":1847782}],"dockerImageVersionId":31153,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport numpy as np\nimport pandas as pd\nfrom scipy import stats\nimport plotly.express as px\n\n\ntargetName = 'label'\nidName = 'id'\ncompetitionDir = '/kaggle/input/tpu-getting-started'\nsubmission = pd.read_csv('../input/tpu-getting-started/sample_submission.csv')\nsubmission.sort_values(by=[idName], inplace=True)\n\npreds = []\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        if (dirname != competitionDir) & ('.csv' in filename):\n            df = pd.read_csv(os.path.join(dirname, filename))\n            if len(df) == len(submission):\n                try:\n                    df.sort_values(by=[idName], inplace=True)\n                    preds.append(df[targetName])\n                except Exception:\n                    pass\n\nsubmission[targetName] = stats.mode(np.array(preds), axis=0)[0].transpose()\nsubmission.to_csv(\"submission.csv\", index=False)\n\n\ntarget_df = pd.DataFrame(np.log(submission[targetName].value_counts())).reset_index()\ntarget_df.columns = [targetName, 'Count']\n\nfig = px.bar(\n    data_frame=target_df,\n    x=targetName,\n    y='Count',\n    color='Count',\n    color_continuous_scale=[\n        \"#ffb6c1\",\n        \"#ff69b4\",\n        \"#dda0dd\",\n        \"#f0e68c\",\n        \"#98fb98\",\n        \"#20b2aa\"\n    ],\n    title=\"🌸 Distribution with Flower-Themed Colors 🌼\"\n)\n\nfig.update_layout(\n    template=\"plotly_white\",\n    title_font=dict(size=22, color=\"#444\", family=\"Arial Black\"),\n    xaxis_title=targetName,\n    yaxis_title=\"Log(Count)\",\n    plot_bgcolor=\"rgba(255,255,255,0.95)\",\n    paper_bgcolor=\"rgba(255,255,255,1)\",\n    font=dict(size=14, color=\"#333\"),\n)\n\nfig.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-05T14:19:14.425648Z","iopub.execute_input":"2025-11-05T14:19:14.425943Z","iopub.status.idle":"2025-11-05T14:19:23.357797Z","shell.execute_reply.started":"2025-11-05T14:19:14.425919Z","shell.execute_reply":"2025-11-05T14:19:23.357011Z"}},"outputs":[],"execution_count":null}]}