{"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":101849,"databundleVersionId":12846694,"sourceType":"competition"}],"dockerImageVersionId":31089,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\nfrom tqdm.notebook import tqdm\n\nprint(\"Baseline Model Development Started (with Correct Submission Format)!\")\n\n# --- CONFIGURATION ---\nBASE_PATH = '/kaggle/input/ariel-data-challenge-2025'\n\n# --- 1. Ground Truth Data Load Karna ---\nprint(\"Step 1: Loading Ground Truth (train.csv) to calculate mean spectrum...\")\ntrain_df = pd.read_csv(os.path.join(BASE_PATH, 'train.csv'))\ntrain_spectra = train_df.drop(columns=['planet_id']).to_numpy()\n\n# --- 2. \"Dumb\" Prediction Banana (Mean aur Standard Deviation) ---\nprint(\"Step 2: Calculating Mean Spectrum and Standard Deviation for our prediction...\")\n\n# Mean spectrum (hamara prediction)\nmean_spectrum_prediction = np.mean(train_spectra, axis=0)\n\n# Standard deviation (hamari uncertainty)\nuncertainty_prediction = np.std(train_spectra, axis=0)\n\n# Agar uncertainty mein koi value 0 hai, to use ek choti value de dein taaki error na aaye\nuncertainty_prediction[uncertainty_prediction == 0] = 1e-9 \n\nprint(f\"Mean prediction shape: {mean_spectrum_prediction.shape}\")\nprint(f\"Uncertainty prediction shape: {uncertainty_prediction.shape}\")\n\n# Dono predictions ko jodna\nfull_prediction_values = np.concatenate([mean_spectrum_prediction, uncertainty_prediction])\n\n\n# --- 3. Submission File Banana (Sahi Tarike se) ---\nprint(\"\\nStep 3: Creating the submission file using the correct wide format...\")\n\n# Sample submission ko load karna taaki humein sahi structure mil jaye\nsample_submission_path = os.path.join(BASE_PATH, 'sample_submission.csv')\nsubmission_df = pd.read_csv(sample_submission_path)\n\n# Prediction columns ke naam nikalna (planet_id ko chhodkar)\nprediction_columns = submission_df.columns[1:]\n\nfor col, val in tqdm(zip(prediction_columns, full_prediction_values), total=len(prediction_columns), desc=\"Filling Submission\"):\n    submission_df[col] = val\n\n# Final CSV file save karna\nsubmission_df.to_csv('submission.csv', index=False)\n\nprint(\"\\n✅ Success! `submission.csv` file has been created with the correct format.\")\nprint(\"You can now submit this file. My apologies for the previous error!\")","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-07-12T10:29:38.245094Z","iopub.execute_input":"2025-07-12T10:29:38.245447Z","iopub.status.idle":"2025-07-12T10:29:38.529723Z","shell.execute_reply.started":"2025-07-12T10:29:38.245422Z","shell.execute_reply":"2025-07-12T10:29:38.528786Z"}},"outputs":[],"execution_count":null}]}