{"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":112509,"databundleVersionId":14254895,"sourceType":"competition"},{"sourceId":13586352,"sourceType":"datasetVersion","datasetId":8630412}],"dockerImageVersionId":31153,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport torch\n\n# ====================================================\n# Configuration\n# ====================================================\nclass CFG:\n    output_file = \"submission.csv\"   # Final output in CSV format\n    num_samples = 5                  # Number of predictions to generate\n    model_name = \"convnext_tiny\"\n    folds = 5\n    device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n\n# ====================================================\n# Dummy Prediction Generator (replace with real model preds if available)\n# ====================================================\ndef generate_predictions(num_samples, folds):\n    \"\"\"\n    Generate dummy predictions for submission.\n    Replace with real model predictions if available.\n    \"\"\"\n    preds = []\n    for fold in range(folds):\n        print(f\"✅ Simulating fold {fold} predictions...\")\n        fold_preds = np.random.rand(num_samples) * 100  # Example predictions\n        preds.append(fold_preds)\n    final_preds = np.mean(preds, axis=0)\n    return final_preds\n\n# ====================================================\n# Inference Function\n# ====================================================\ndef run_inference():\n    print(\"🚀 Starting Inference...\")\n\n    # Simulate model inference (replace with real model outputs)\n    final_preds = generate_predictions(CFG.num_samples, CFG.folds)\n\n    # Create simple DataFrame for submission\n    sub_df = pd.DataFrame({\n        \"sample_id\": [f\"sample_{i}\" for i in range(len(final_preds))],\n        \"biomass\": final_preds\n    })\n\n    # Save CSV file\n    sub_df.to_csv(CFG.output_file, index=False)\n    print(f\"\\n✅ Submission file saved successfully: {CFG.output_file}\")\n    print(sub_df.head())\n\n# ====================================================\n# Run\n# ====================================================\nif __name__ == \"__main__\":\n    run_inference()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-03T19:37:06.736650Z","iopub.execute_input":"2025-11-03T19:37:06.736987Z","iopub.status.idle":"2025-11-03T19:37:13.277686Z","shell.execute_reply.started":"2025-11-03T19:37:06.736963Z","shell.execute_reply":"2025-11-03T19:37:13.276687Z"}},"outputs":[],"execution_count":null}]}