{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":13836,"databundleVersionId":1718836,"sourceType":"competition"}],"dockerImageVersionId":30886,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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)\nimport matplotlib.pyplot as plt\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[:10]:\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":{"iopub.status.busy":"2025-02-20T16:05:58.524596Z","iopub.execute_input":"2025-02-20T16:05:58.525081Z","iopub.status.idle":"2025-02-20T16:06:31.191537Z","shell.execute_reply.started":"2025-02-20T16:05:58.525047Z","shell.execute_reply":"2025-02-20T16:06:31.190110Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"input_path = '/kaggle/input/cassava-leaf-disease-classification'\ntrain_csv_filename = 'train.csv'\n\ntrain_csv = pd.read_csv(os.path.join(input_path, train_csv_filename))\ntrain_csv","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.193307Z","iopub.execute_input":"2025-02-20T16:06:31.194028Z","iopub.status.idle":"2025-02-20T16:06:31.262167Z","shell.execute_reply.started":"2025-02-20T16:06:31.193979Z","shell.execute_reply":"2025-02-20T16:06:31.260986Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train_csv['label'].hist()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.264325Z","iopub.execute_input":"2025-02-20T16:06:31.264622Z","iopub.status.idle":"2025-02-20T16:06:31.679481Z","shell.execute_reply.started":"2025-02-20T16:06:31.264596Z","shell.execute_reply":"2025-02-20T16:06:31.678105Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"most_frequent = train_csv['label'].mode().iat[0]\nmost_frequent","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.681598Z","iopub.execute_input":"2025-02-20T16:06:31.682029Z","iopub.status.idle":"2025-02-20T16:06:31.696359Z","shell.execute_reply.started":"2025-02-20T16:06:31.681992Z","shell.execute_reply":"2025-02-20T16:06:31.694976Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"sample_csv_filename = 'sample_submission.csv'\n\nsample_csv = pd.read_csv(os.path.join(input_path, sample_csv_filename))\nsample_csv","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.697346Z","iopub.execute_input":"2025-02-20T16:06:31.697704Z","iopub.status.idle":"2025-02-20T16:06:31.734664Z","shell.execute_reply.started":"2025-02-20T16:06:31.697671Z","shell.execute_reply":"2025-02-20T16:06:31.729457Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test_path = 'test_images'\n\ntest_image_ids = os.listdir(os.path.join(input_path, test_path))\ntest_image_ids","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.735819Z","iopub.execute_input":"2025-02-20T16:06:31.736263Z","iopub.status.idle":"2025-02-20T16:06:31.747547Z","shell.execute_reply.started":"2025-02-20T16:06:31.736227Z","shell.execute_reply":"2025-02-20T16:06:31.746225Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"predicted_values = np.full(len(test_image_ids), most_frequent)\npredicted_values","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.748932Z","iopub.execute_input":"2025-02-20T16:06:31.749334Z","iopub.status.idle":"2025-02-20T16:06:31.770471Z","shell.execute_reply.started":"2025-02-20T16:06:31.749299Z","shell.execute_reply":"2025-02-20T16:06:31.769092Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission = pd.DataFrame({\n    'image_id': test_image_ids,\n    'label': predicted_values\n})","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.773406Z","iopub.execute_input":"2025-02-20T16:06:31.774136Z","iopub.status.idle":"2025-02-20T16:06:31.796743Z","shell.execute_reply.started":"2025-02-20T16:06:31.774095Z","shell.execute_reply":"2025-02-20T16:06:31.795293Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-02-20T16:06:31.797945Z","iopub.execute_input":"2025-02-20T16:06:31.798384Z","iopub.status.idle":"2025-02-20T16:06:31.825499Z","shell.execute_reply.started":"2025-02-20T16:06:31.798343Z","shell.execute_reply":"2025-02-20T16:06:31.823994Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}