{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":28755,"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)\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:\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\n\n# Use the kagglehub client library to attach Kaggle resources like competitions, datasets, and models to your session\n# Learn more about kagglehub: https://github.com/Kaggle/kagglehub/blob/main/README.md\n\nimport kagglehub\n# kagglehub.dataset_download('<owner>/<dataset-slug>')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:20.932720Z","iopub.execute_input":"2026-07-25T12:14:20.933076Z","iopub.status.idle":"2026-07-25T12:14:20.944458Z","shell.execute_reply.started":"2026-07-25T12:14:20.933046Z","shell.execute_reply":"2026-07-25T12:14:20.943026Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"\ntrain = pd.read_csv(\"/kaggle/input/competitions/Store-Sales-Forecasting/train.csv\")\n\ntest = pd.read_csv(\"/kaggle/input/competitions/Store-Sales-Forecasting/test.csv\")\ntrain.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:20.946462Z","iopub.execute_input":"2026-07-25T12:14:20.946967Z","iopub.status.idle":"2026-07-25T12:14:23.067053Z","shell.execute_reply.started":"2026-07-25T12:14:20.946935Z","shell.execute_reply":"2026-07-25T12:14:23.066014Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"trainでモデルを作る","metadata":{}},{"cell_type":"markdown","source":"特徴量を確認。","metadata":{}},{"cell_type":"code","source":"train.describe()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:23.068869Z","iopub.execute_input":"2026-07-25T12:14:23.069280Z","iopub.status.idle":"2026-07-25T12:14:23.379466Z","shell.execute_reply.started":"2026-07-25T12:14:23.069251Z","shell.execute_reply":"2026-07-25T12:14:23.378562Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"特徴量に曜日の要素を加える。idを日付","metadata":{}},{"cell_type":"code","source":"train[\"date\"] = pd.to_datetime(train[\"date\"])\ntest[\"date\"] = pd.to_datetime(test[\"date\"])\n\ntrain[\"date\"].head(10000)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:23.380729Z","iopub.execute_input":"2026-07-25T12:14:23.381158Z","iopub.status.idle":"2026-07-25T12:14:23.692128Z","shell.execute_reply.started":"2026-07-25T12:14:23.381128Z","shell.execute_reply":"2026-07-25T12:14:23.691057Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train[\"dayofweek\"] = train[\"date\"].dt.dayofweek\ntest[\"dayofweek\"] = test[\"date\"].dt.dayofweek\ntrain[\"dayname\"] = train[\"date\"].dt.day_name()\ntrain[[\"dayofweek\", \"dayname\"]].head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:23.694129Z","iopub.execute_input":"2026-07-25T12:14:23.694572Z","iopub.status.idle":"2026-07-25T12:14:24.596292Z","shell.execute_reply.started":"2026-07-25T12:14:23.694501Z","shell.execute_reply":"2026-07-25T12:14:24.595220Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train.isna().sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:24.597526Z","iopub.execute_input":"2026-07-25T12:14:24.597917Z","iopub.status.idle":"2026-07-25T12:14:24.938455Z","shell.execute_reply.started":"2026-07-25T12:14:24.597878Z","shell.execute_reply":"2026-07-25T12:14:24.937390Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"欠損値はないということ。","metadata":{}},{"cell_type":"markdown","source":"↓曜日ごとの売り上げ平均を可視化。","metadata":{}},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\nday_order = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"]\nsns.barplot(x=\"dayname\",y=\"sales\",data=train,order=day_order)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:14:24.939742Z","iopub.execute_input":"2026-07-25T12:14:24.940192Z","iopub.status.idle":"2026-07-25T12:15:07.086695Z","shell.execute_reply.started":"2026-07-25T12:14:24.940148Z","shell.execute_reply":"2026-07-25T12:15:07.085739Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features = [\"dayofweek\"]\n\nX_train = train[features]\ny_train = train[\"sales\"]\n\nX_test = test[features]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:07.088651Z","iopub.execute_input":"2026-07-25T12:15:07.089047Z","iopub.status.idle":"2026-07-25T12:15:07.107709Z","shell.execute_reply.started":"2026-07-25T12:15:07.088997Z","shell.execute_reply":"2026-07-25T12:15:07.106657Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from lightgbm import LGBMRegressor\n\nmodel = LGBMRegressor(\n    random_state=42\n)\n\nmodel.fit(X_train, y_train)\n\npred = model.predict(X_test)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:07.109045Z","iopub.execute_input":"2026-07-25T12:15:07.109443Z","iopub.status.idle":"2026-07-25T12:15:11.339932Z","shell.execute_reply.started":"2026-07-25T12:15:07.109398Z","shell.execute_reply":"2026-07-25T12:15:11.338959Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train[\"month\"] = train[\"date\"].dt.month\ntest[\"month\"] = test[\"date\"].dt.month","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:11.341127Z","iopub.execute_input":"2026-07-25T12:15:11.341755Z","iopub.status.idle":"2026-07-25T12:15:11.428306Z","shell.execute_reply.started":"2026-07-25T12:15:11.341722Z","shell.execute_reply":"2026-07-25T12:15:11.427266Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features = [\n    \"dayofweek\",\n    \"month\"\n]\n\nX_train = train[features]\ny_train = train[\"sales\"]\nX_test = test[features]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:11.431153Z","iopub.execute_input":"2026-07-25T12:15:11.431494Z","iopub.status.idle":"2026-07-25T12:15:11.461745Z","shell.execute_reply.started":"2026-07-25T12:15:11.431465Z","shell.execute_reply":"2026-07-25T12:15:11.460354Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from lightgbm import LGBMRegressor\n\nmodel = LGBMRegressor(random_state=42)\nmodel.fit(X_train, y_train)\n\npred = model.predict(X_test)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:11.463420Z","iopub.execute_input":"2026-07-25T12:15:11.463854Z","iopub.status.idle":"2026-07-25T12:15:18.441516Z","shell.execute_reply.started":"2026-07-25T12:15:11.463807Z","shell.execute_reply":"2026-07-25T12:15:18.440378Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"transactions = pd.read_csv(\n    \"/kaggle/input/competitions/Store-Sales-Forecasting/transactions.csv\"\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:18.442954Z","iopub.execute_input":"2026-07-25T12:15:18.443329Z","iopub.status.idle":"2026-07-25T12:15:18.478799Z","shell.execute_reply.started":"2026-07-25T12:15:18.443302Z","shell.execute_reply":"2026-07-25T12:15:18.477779Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(transactions)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:18.480004Z","iopub.execute_input":"2026-07-25T12:15:18.480768Z","iopub.status.idle":"2026-07-25T12:15:18.489345Z","shell.execute_reply.started":"2026-07-25T12:15:18.480733Z","shell.execute_reply":"2026-07-25T12:15:18.487912Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"stores = pd.read_csv(\n    \"/kaggle/input/competitions/Store-Sales-Forecasting/stores.csv\"\n)\n\ntrain = train.merge(\n    stores[[\"store_nbr\", \"type\"]],\n    on=\"store_nbr\",\n    how=\"left\"\n)\n\ntest = test.merge(\n    stores[[\"store_nbr\", \"type\"]],\n    on=\"store_nbr\",\n    how=\"left\"\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:18.490807Z","iopub.execute_input":"2026-07-25T12:15:18.491248Z","iopub.status.idle":"2026-07-25T12:15:19.124591Z","shell.execute_reply.started":"2026-07-25T12:15:18.491205Z","shell.execute_reply":"2026-07-25T12:15:19.123210Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.preprocessing import LabelEncoder\n\nle = LabelEncoder()\n\ntrain[\"type\"] = le.fit_transform(train[\"type\"])\ntest[\"type\"] = le.transform(test[\"type\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.125770Z","iopub.execute_input":"2026-07-25T12:15:19.126151Z","iopub.status.idle":"2026-07-25T12:15:19.590804Z","shell.execute_reply.started":"2026-07-25T12:15:19.126104Z","shell.execute_reply":"2026-07-25T12:15:19.588927Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"holidays = pd.read_csv(\n    \"/kaggle/input/competitions/Store-Sales-Forecasting/holidays_events.csv\"\n)\nholidays[\"date\"] = pd.to_datetime(holidays[\"date\"])\nholiday_flag = holidays[[\"date\"]].drop_duplicates().copy()\nholiday_flag[\"holiday\"] = 1","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.592141Z","iopub.execute_input":"2026-07-25T12:15:19.592512Z","iopub.status.idle":"2026-07-25T12:15:19.606212Z","shell.execute_reply.started":"2026-07-25T12:15:19.592468Z","shell.execute_reply":"2026-07-25T12:15:19.604907Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"holidays[\"date\"] = pd.to_datetime(holidays[\"date\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.616731Z","iopub.execute_input":"2026-07-25T12:15:19.617249Z","iopub.status.idle":"2026-07-25T12:15:19.638144Z","shell.execute_reply.started":"2026-07-25T12:15:19.617187Z","shell.execute_reply":"2026-07-25T12:15:19.637075Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(train[\"date\"].dtype)\nprint(test[\"date\"].dtype)\nprint(holiday_flag[\"date\"].dtype)\n\nholiday_flag.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.639319Z","iopub.execute_input":"2026-07-25T12:15:19.640251Z","iopub.status.idle":"2026-07-25T12:15:19.666965Z","shell.execute_reply.started":"2026-07-25T12:15:19.640219Z","shell.execute_reply":"2026-07-25T12:15:19.666102Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"holiday_flag[\"date\"] = pd.to_datetime(holiday_flag[\"date\"])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.668109Z","iopub.execute_input":"2026-07-25T12:15:19.668522Z","iopub.status.idle":"2026-07-25T12:15:19.686780Z","shell.execute_reply.started":"2026-07-25T12:15:19.668494Z","shell.execute_reply":"2026-07-25T12:15:19.685488Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = train.merge(holiday_flag, on=\"date\", how=\"left\")\ntest = test.merge(holiday_flag, on=\"date\", how=\"left\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:19.687995Z","iopub.execute_input":"2026-07-25T12:15:19.688640Z","iopub.status.idle":"2026-07-25T12:15:20.035391Z","shell.execute_reply.started":"2026-07-25T12:15:19.688597Z","shell.execute_reply":"2026-07-25T12:15:20.034118Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features = [\n    \"dayofweek\",\n    \"month\",\n    \"type\",\n    \"holiday\"\n]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.036877Z","iopub.execute_input":"2026-07-25T12:15:20.037282Z","iopub.status.idle":"2026-07-25T12:15:20.042912Z","shell.execute_reply.started":"2026-07-25T12:15:20.037241Z","shell.execute_reply":"2026-07-25T12:15:20.041791Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = train.sort_values(\"date\")\n\nvalid_date = train[\"date\"].max() - pd.DateOffset(months=3)\n\ntrain_data = train[train[\"date\"] < valid_date]\nvalid_data = train[train[\"date\"] >= valid_date]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.044315Z","iopub.execute_input":"2026-07-25T12:15:20.044783Z","iopub.status.idle":"2026-07-25T12:15:20.723904Z","shell.execute_reply.started":"2026-07-25T12:15:20.044740Z","shell.execute_reply":"2026-07-25T12:15:20.722756Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(train_data.shape)\nprint(valid_data.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.725504Z","iopub.execute_input":"2026-07-25T12:15:20.725909Z","iopub.status.idle":"2026-07-25T12:15:20.731477Z","shell.execute_reply.started":"2026-07-25T12:15:20.725868Z","shell.execute_reply":"2026-07-25T12:15:20.730292Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features = [\n    \"dayofweek\",\n    \"month\",\n    \"type\",\n    \"holiday\"\n]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.733016Z","iopub.execute_input":"2026-07-25T12:15:20.733436Z","iopub.status.idle":"2026-07-25T12:15:20.749845Z","shell.execute_reply.started":"2026-07-25T12:15:20.733392Z","shell.execute_reply":"2026-07-25T12:15:20.748640Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"\n\nprint(features)\nprint(train_data.columns)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.750954Z","iopub.execute_input":"2026-07-25T12:15:20.751319Z","iopub.status.idle":"2026-07-25T12:15:20.771623Z","shell.execute_reply.started":"2026-07-25T12:15:20.751292Z","shell.execute_reply":"2026-07-25T12:15:20.770466Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train = train.rename(columns={\"holiday_y\": \"holiday\"})\ntest = test.rename(columns={\"holiday_y\": \"holiday\"})","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:20.772833Z","iopub.execute_input":"2026-07-25T12:15:20.773246Z","iopub.status.idle":"2026-07-25T12:15:21.034728Z","shell.execute_reply.started":"2026-07-25T12:15:20.773205Z","shell.execute_reply":"2026-07-25T12:15:21.033497Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features = [\n    \"dayofweek\",\n    \"month\",\n    \"type\",\n    \"holiday\"\n]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:21.039258Z","iopub.execute_input":"2026-07-25T12:15:21.039692Z","iopub.status.idle":"2026-07-25T12:15:21.045932Z","shell.execute_reply.started":"2026-07-25T12:15:21.039659Z","shell.execute_reply":"2026-07-25T12:15:21.044484Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from lightgbm import LGBMRegressor\n\nmodel = LGBMRegressor(\n    random_state=42,\n    n_estimators=500,\n    learning_rate=0.05\n)\n\nmodel.fit(\n    train_data[features],\n    train_data[\"sales\"]\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:21.047924Z","iopub.execute_input":"2026-07-25T12:15:21.048365Z","iopub.status.idle":"2026-07-25T12:15:45.686888Z","shell.execute_reply.started":"2026-07-25T12:15:21.048333Z","shell.execute_reply":"2026-07-25T12:15:45.685887Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"valid_pred = model.predict(valid_data[features])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:45.688957Z","iopub.execute_input":"2026-07-25T12:15:45.689219Z","iopub.status.idle":"2026-07-25T12:15:46.861658Z","shell.execute_reply.started":"2026-07-25T12:15:45.689195Z","shell.execute_reply":"2026-07-25T12:15:46.860684Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import numpy as np\nfrom sklearn.metrics import mean_squared_log_error\n\nrmsle = np.sqrt(\n    mean_squared_log_error(\n        valid_data[\"sales\"],\n        np.maximum(valid_pred, 0)\n    )\n)\n\nprint(\"RMSLE:\", rmsle)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.862917Z","iopub.execute_input":"2026-07-25T12:15:46.863266Z","iopub.status.idle":"2026-07-25T12:15:46.880392Z","shell.execute_reply.started":"2026-07-25T12:15:46.863230Z","shell.execute_reply":"2026-07-25T12:15:46.879343Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"全て込みの精度↑\n","metadata":{}},{"cell_type":"code","source":"train[features].head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.881743Z","iopub.execute_input":"2026-07-25T12:15:46.882022Z","iopub.status.idle":"2026-07-25T12:15:46.910087Z","shell.execute_reply.started":"2026-07-25T12:15:46.881998Z","shell.execute_reply":"2026-07-25T12:15:46.909120Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test[features].head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.911327Z","iopub.execute_input":"2026-07-25T12:15:46.911809Z","iopub.status.idle":"2026-07-25T12:15:46.923778Z","shell.execute_reply.started":"2026-07-25T12:15:46.911778Z","shell.execute_reply":"2026-07-25T12:15:46.922710Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train[\"holiday\"] = train[\"holiday\"].fillna(0)\ntest[\"holiday\"] = test[\"holiday\"].fillna(0)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.925027Z","iopub.execute_input":"2026-07-25T12:15:46.925395Z","iopub.status.idle":"2026-07-25T12:15:46.952657Z","shell.execute_reply.started":"2026-07-25T12:15:46.925359Z","shell.execute_reply":"2026-07-25T12:15:46.951465Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"X_train = train[features]\ny_train = train[\"sales\"]\n\nX_test = test[features]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.953773Z","iopub.execute_input":"2026-07-25T12:15:46.954029Z","iopub.status.idle":"2026-07-25T12:15:46.984656Z","shell.execute_reply.started":"2026-07-25T12:15:46.954005Z","shell.execute_reply":"2026-07-25T12:15:46.983375Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from lightgbm import LGBMRegressor\n\nmodel = LGBMRegressor(\n    random_state=42,\n    n_estimators=500,\n    learning_rate=0.05\n)\n\nmodel.fit(\n    X_train,\n    y_train\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:15:46.985849Z","iopub.execute_input":"2026-07-25T12:15:46.986156Z","iopub.status.idle":"2026-07-25T12:16:13.653003Z","shell.execute_reply.started":"2026-07-25T12:15:46.986130Z","shell.execute_reply":"2026-07-25T12:16:13.652026Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pred = model.predict(X_test)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:13.654229Z","iopub.execute_input":"2026-07-25T12:16:13.654629Z","iopub.status.idle":"2026-07-25T12:16:13.859818Z","shell.execute_reply.started":"2026-07-25T12:16:13.654590Z","shell.execute_reply":"2026-07-25T12:16:13.858790Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pred = np.maximum(pred, 0)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:13.860968Z","iopub.execute_input":"2026-07-25T12:16:13.861281Z","iopub.status.idle":"2026-07-25T12:16:13.866744Z","shell.execute_reply.started":"2026-07-25T12:16:13.861254Z","shell.execute_reply":"2026-07-25T12:16:13.865497Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission = pd.DataFrame({\n    \"id\": test[\"id\"],\n    \"sales\": pred\n})","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:13.868161Z","iopub.execute_input":"2026-07-25T12:16:13.868586Z","iopub.status.idle":"2026-07-25T12:16:13.887964Z","shell.execute_reply.started":"2026-07-25T12:16:13.868510Z","shell.execute_reply":"2026-07-25T12:16:13.886682Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:13.890197Z","iopub.execute_input":"2026-07-25T12:16:13.890597Z","iopub.status.idle":"2026-07-25T12:16:13.911242Z","shell.execute_reply.started":"2026-07-25T12:16:13.890509Z","shell.execute_reply":"2026-07-25T12:16:13.910237Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"submission.to_csv(\n    \"submission.csv\",\n    index=False\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:13.912606Z","iopub.execute_input":"2026-07-25T12:16:13.912961Z","iopub.status.idle":"2026-07-25T12:16:14.010047Z","shell.execute_reply.started":"2026-07-25T12:16:13.912922Z","shell.execute_reply":"2026-07-25T12:16:14.008900Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pd.read_csv(\"submission.csv\").head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-07-25T12:16:14.011469Z","iopub.execute_input":"2026-07-25T12:16:14.011995Z","iopub.status.idle":"2026-07-25T12:16:14.034976Z","shell.execute_reply.started":"2026-07-25T12:16:14.011962Z","shell.execute_reply":"2026-07-25T12:16:14.033987Z"}},"outputs":[],"execution_count":null}]}