{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"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","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-11-09T15:26:53.106896Z","iopub.execute_input":"2022-11-09T15:26:53.107654Z","iopub.status.idle":"2022-11-09T15:26:53.126557Z","shell.execute_reply.started":"2022-11-09T15:26:53.107598Z","shell.execute_reply":"2022-11-09T15:26:53.124474Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Подключение библиотек и загрузка данных","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport seaborn as sns\n\nfrom sklearn.linear_model import Lasso","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:26:57.226465Z","iopub.execute_input":"2022-11-09T15:26:57.226999Z","iopub.status.idle":"2022-11-09T15:26:57.233305Z","shell.execute_reply.started":"2022-11-09T15:26:57.226947Z","shell.execute_reply":"2022-11-09T15:26:57.232020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = pd.read_csv('../input/departure-delay3/data/x_train.csv', index_col = 0)\nX_test = pd.read_csv('../input/departure-delay3/data/x_test.csv', index_col = 0)\ny_train = pd.read_csv('../input/departure-delay3/data/y_train.csv', index_col = 0)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:26:59.294515Z","iopub.execute_input":"2022-11-09T15:26:59.294958Z","iopub.status.idle":"2022-11-09T15:27:13.296882Z","shell.execute_reply.started":"2022-11-09T15:26:59.294923Z","shell.execute_reply":"2022-11-09T15:27:13.295527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Разведывательный анализ данных","metadata":{}},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:13.299412Z","iopub.execute_input":"2022-11-09T15:27:13.299915Z","iopub.status.idle":"2022-11-09T15:27:13.348282Z","shell.execute_reply.started":"2022-11-09T15:27:13.299868Z","shell.execute_reply":"2022-11-09T15:27:13.347147Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.describe()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:27.789691Z","iopub.execute_input":"2022-11-09T15:27:27.790416Z","iopub.status.idle":"2022-11-09T15:27:29.515972Z","shell.execute_reply.started":"2022-11-09T15:27:27.790356Z","shell.execute_reply":"2022-11-09T15:27:29.514717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:33.685979Z","iopub.execute_input":"2022-11-09T15:27:33.686711Z","iopub.status.idle":"2022-11-09T15:27:33.696174Z","shell.execute_reply.started":"2022-11-09T15:27:33.686671Z","shell.execute_reply":"2022-11-09T15:27:33.694686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Обзор символьных признаков","metadata":{}},{"cell_type":"code","source":"X_train.UniqueCarrier.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:37.177569Z","iopub.execute_input":"2022-11-09T15:27:37.178040Z","iopub.status.idle":"2022-11-09T15:27:37.275528Z","shell.execute_reply.started":"2022-11-09T15:27:37.177998Z","shell.execute_reply":"2022-11-09T15:27:37.274101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.UniqueCarrier.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:38.975812Z","iopub.execute_input":"2022-11-09T15:27:38.976246Z","iopub.status.idle":"2022-11-09T15:27:39.024029Z","shell.execute_reply.started":"2022-11-09T15:27:38.976213Z","shell.execute_reply":"2022-11-09T15:27:39.022790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.TailNum.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:40.836713Z","iopub.execute_input":"2022-11-09T15:27:40.837986Z","iopub.status.idle":"2022-11-09T15:27:40.960493Z","shell.execute_reply.started":"2022-11-09T15:27:40.837900Z","shell.execute_reply":"2022-11-09T15:27:40.959106Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.CancellationCode.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:44.395449Z","iopub.execute_input":"2022-11-09T15:27:44.395859Z","iopub.status.idle":"2022-11-09T15:27:44.490295Z","shell.execute_reply.started":"2022-11-09T15:27:44.395826Z","shell.execute_reply":"2022-11-09T15:27:44.488924Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.Origin.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:47.566384Z","iopub.execute_input":"2022-11-09T15:27:47.566845Z","iopub.status.idle":"2022-11-09T15:27:47.666775Z","shell.execute_reply.started":"2022-11-09T15:27:47.566808Z","shell.execute_reply":"2022-11-09T15:27:47.665533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.Dest.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:52.086103Z","iopub.execute_input":"2022-11-09T15:27:52.086525Z","iopub.status.idle":"2022-11-09T15:27:52.186294Z","shell.execute_reply.started":"2022-11-09T15:27:52.086492Z","shell.execute_reply":"2022-11-09T15:27:52.184766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Заполнение пропущенных значений","metadata":{}},{"cell_type":"code","source":"X_train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:27:56.410614Z","iopub.execute_input":"2022-11-09T15:27:56.411080Z","iopub.status.idle":"2022-11-09T15:27:56.755614Z","shell.execute_reply.started":"2022-11-09T15:27:56.411041Z","shell.execute_reply":"2022-11-09T15:27:56.754128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:28:08.680832Z","iopub.execute_input":"2022-11-09T15:28:08.681231Z","iopub.status.idle":"2022-11-09T15:28:08.837548Z","shell.execute_reply.started":"2022-11-09T15:28:08.681198Z","shell.execute_reply":"2022-11-09T15:28:08.836117Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Для заполнения пропущенных значений используем медиану как более робастую метрику","metadata":{}},{"cell_type":"code","source":"X_train.ArrTime = X_train.ArrTime.fillna(X_train.ArrTime.median())\nX_test.ArrTime = X_test.ArrTime.fillna(X_test.ArrTime.median())\n\nX_train.ActualElapsedTime = X_train.ActualElapsedTime.fillna(X_train.ActualElapsedTime.median())\nX_test.ActualElapsedTime = X_test.ActualElapsedTime.fillna(X_test.ActualElapsedTime.median())\n\nX_train.CRSElapsedTime = X_train.CRSElapsedTime.fillna(X_train.CRSElapsedTime.median())\nX_test.CRSElapsedTime = X_test.CRSElapsedTime.fillna(X_test.CRSElapsedTime.median())\n\nX_train.AirTime = X_train.AirTime.fillna(X_train.AirTime.median())\nX_test.AirTime = X_test.AirTime.fillna(X_test.AirTime.median())\n\nX_train.ArrDelay = X_train.ArrDelay.fillna(X_train.ArrDelay.median())\nX_test.ArrDelay = X_test.ArrDelay.fillna(X_test.ArrDelay.median())\n\nX_train.TaxiIn = X_train.TaxiIn.fillna(X_train.TaxiIn.median())\nX_test.TaxiIn = X_test.TaxiIn.fillna(X_test.TaxiIn.median())\n\nX_train.TaxiOut = X_train.TaxiOut.fillna(X_train.TaxiOut.median())\nX_test.TaxiOut = X_test.TaxiOut.fillna(X_test.TaxiOut.median())\n\nX_train.TailNum = X_train.TailNum.fillna(X_train.TailNum.mode()[0])\nX_test.TailNum = X_test.TailNum.fillna(X_test.TailNum.mode()[0])","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:35:54.063936Z","iopub.execute_input":"2022-11-09T15:35:54.064688Z","iopub.status.idle":"2022-11-09T15:35:54.806199Z","shell.execute_reply.started":"2022-11-09T15:35:54.064642Z","shell.execute_reply":"2022-11-09T15:35:54.804851Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(X_train.CarrierDelay)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:29:08.124046Z","iopub.execute_input":"2022-11-09T15:29:08.124671Z","iopub.status.idle":"2022-11-09T15:29:11.725599Z","shell.execute_reply.started":"2022-11-09T15:29:08.124605Z","shell.execute_reply":"2022-11-09T15:29:11.724222Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Так как признаки отвечают за время и тип задержки самолета, и причина задержки может быть только одна, то остальные типы задержки будут иметь нулевое значение","metadata":{}},{"cell_type":"code","source":"X_train.CarrierDelay = X_train.CarrierDelay.fillna(0)\nX_test.CarrierDelay = X_test.CarrierDelay.fillna(0)\n\nX_train.WeatherDelay = X_train.WeatherDelay.fillna(0)\nX_test.WeatherDelay = X_test.WeatherDelay.fillna(0)\n\nX_train.NASDelay = X_train.NASDelay.fillna(0)\nX_test.NASDelay = X_test.NASDelay.fillna(0)\n\nX_train.SecurityDelay = X_train.SecurityDelay.fillna(0)\nX_test.SecurityDelay = X_test.SecurityDelay.fillna(0)\n\nX_train.LateAircraftDelay = X_train.LateAircraftDelay.fillna(0)\nX_test.LateAircraftDelay = X_test.LateAircraftDelay.fillna(0)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:36:08.257077Z","iopub.execute_input":"2022-11-09T15:36:08.257515Z","iopub.status.idle":"2022-11-09T15:36:08.337151Z","shell.execute_reply.started":"2022-11-09T15:36:08.257481Z","shell.execute_reply":"2022-11-09T15:36:08.335700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:36:14.098663Z","iopub.execute_input":"2022-11-09T15:36:14.099013Z","iopub.status.idle":"2022-11-09T15:36:14.442049Z","shell.execute_reply.started":"2022-11-09T15:36:14.098980Z","shell.execute_reply":"2022-11-09T15:36:14.440782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:37:38.551239Z","iopub.execute_input":"2022-11-09T15:37:38.552598Z","iopub.status.idle":"2022-11-09T15:37:38.708105Z","shell.execute_reply.started":"2022-11-09T15:37:38.552534Z","shell.execute_reply":"2022-11-09T15:37:38.706903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Признак Year имеет только одно значение равное 2008, поэтому смысла для регрессии он не имеет","metadata":{}},{"cell_type":"code","source":"X_train = X_train.drop(['Year'], axis = 1)\n\nX_test = X_test.drop(['Year' ], axis = 1)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:37:42.494513Z","iopub.execute_input":"2022-11-09T15:37:42.495087Z","iopub.status.idle":"2022-11-09T15:37:42.694247Z","shell.execute_reply.started":"2022-11-09T15:37:42.495046Z","shell.execute_reply":"2022-11-09T15:37:42.692752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.corr()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:37:48.574733Z","iopub.execute_input":"2022-11-09T15:37:48.575154Z","iopub.status.idle":"2022-11-09T15:37:50.627477Z","shell.execute_reply.started":"2022-11-09T15:37:48.575120Z","shell.execute_reply":"2022-11-09T15:37:50.626178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Между признаками низкий коэффициент корреляции, при использовании PCA большая часть данных будет потеряна, что негативно отобразится на обучении модели","metadata":{}},{"cell_type":"markdown","source":"# Preprocessing","metadata":{}},{"cell_type":"code","source":"X_train.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:03.118200Z","iopub.execute_input":"2022-11-09T15:38:03.119294Z","iopub.status.idle":"2022-11-09T15:38:03.128725Z","shell.execute_reply.started":"2022-11-09T15:38:03.119245Z","shell.execute_reply":"2022-11-09T15:38:03.127161Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.UniqueCarrier.unique()","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:08.006155Z","iopub.execute_input":"2022-11-09T15:38:08.007316Z","iopub.status.idle":"2022-11-09T15:38:08.103306Z","shell.execute_reply.started":"2022-11-09T15:38:08.007260Z","shell.execute_reply":"2022-11-09T15:38:08.102096Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list_UniqueCarrier = list(\n    set(\n        [*list(X_train.UniqueCarrier.unique()), *list(X_test.UniqueCarrier.unique())]\n    )\n)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:10.407438Z","iopub.execute_input":"2022-11-09T15:38:10.407833Z","iopub.status.idle":"2022-11-09T15:38:10.537523Z","shell.execute_reply.started":"2022-11-09T15:38:10.407801Z","shell.execute_reply":"2022-11-09T15:38:10.536383Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"d = {v: k for k, v in enumerate(list_UniqueCarrier)}\n\nX_train.UniqueCarrier = X_train.UniqueCarrier.replace(d)\nX_test.UniqueCarrier = X_test.UniqueCarrier.replace(d)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:13.469430Z","iopub.execute_input":"2022-11-09T15:38:13.470138Z","iopub.status.idle":"2022-11-09T15:38:15.353911Z","shell.execute_reply.started":"2022-11-09T15:38:13.470097Z","shell.execute_reply":"2022-11-09T15:38:15.352512Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.UniqueCarrier","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:17.908565Z","iopub.execute_input":"2022-11-09T15:38:17.909022Z","iopub.status.idle":"2022-11-09T15:38:17.918004Z","shell.execute_reply.started":"2022-11-09T15:38:17.908980Z","shell.execute_reply":"2022-11-09T15:38:17.917047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list_TailNum = list(\n    set(\n        [*list(X_train.TailNum.unique()), *list(X_test.TailNum.unique())]\n    )\n)\n\nd_TailNum = {v: k for k, v in enumerate(list_TailNum)}","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:22.925929Z","iopub.execute_input":"2022-11-09T15:38:22.926370Z","iopub.status.idle":"2022-11-09T15:38:23.095162Z","shell.execute_reply.started":"2022-11-09T15:38:22.926323Z","shell.execute_reply":"2022-11-09T15:38:23.093768Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.TailNum = X_train.TailNum.replace(d_TailNum)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:38:26.054187Z","iopub.execute_input":"2022-11-09T15:38:26.054610Z","iopub.status.idle":"2022-11-09T15:42:27.393656Z","shell.execute_reply.started":"2022-11-09T15:38:26.054573Z","shell.execute_reply":"2022-11-09T15:42:27.392027Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.TailNum = X_test.TailNum.replace(d_TailNum)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:42:27.395743Z","iopub.execute_input":"2022-11-09T15:42:27.396132Z","iopub.status.idle":"2022-11-09T15:44:10.228075Z","shell.execute_reply.started":"2022-11-09T15:42:27.396097Z","shell.execute_reply":"2022-11-09T15:44:10.226881Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"d_Origin = {v: k for k, v in enumerate(list(X_train.Origin.unique()))}\n\nX_train.Origin = X_train.Origin.replace(d_Origin)\nX_test.Origin = X_test.Origin.replace(d_Origin)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:10.230318Z","iopub.execute_input":"2022-11-09T15:44:10.231212Z","iopub.status.idle":"2022-11-09T15:44:28.753093Z","shell.execute_reply.started":"2022-11-09T15:44:10.231163Z","shell.execute_reply":"2022-11-09T15:44:28.751692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list_Dest = list(\n    set(\n        [*list(X_train.Dest.unique()), *list(X_test.Dest.unique())]\n    )\n)\n\nd_Dest = {v: k for k, v in enumerate(list_Dest)}","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:28.755423Z","iopub.execute_input":"2022-11-09T15:44:28.755864Z","iopub.status.idle":"2022-11-09T15:44:28.891683Z","shell.execute_reply.started":"2022-11-09T15:44:28.755832Z","shell.execute_reply":"2022-11-09T15:44:28.890307Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.Dest = X_train.Dest.replace(d_Dest)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:28.893284Z","iopub.execute_input":"2022-11-09T15:44:28.893661Z","iopub.status.idle":"2022-11-09T15:44:42.001820Z","shell.execute_reply.started":"2022-11-09T15:44:28.893628Z","shell.execute_reply":"2022-11-09T15:44:42.000557Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.Dest = X_test.Dest.replace(d_Dest)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:42.003562Z","iopub.execute_input":"2022-11-09T15:44:42.004484Z","iopub.status.idle":"2022-11-09T15:44:47.509179Z","shell.execute_reply.started":"2022-11-09T15:44:42.004387Z","shell.execute_reply":"2022-11-09T15:44:47.507950Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"d_CancellationCode = {v: k for k, v in enumerate(list(X_train.CancellationCode.unique()))}\n\nX_train.CancellationCode = X_train.CancellationCode.replace(d_CancellationCode)\nX_test.CancellationCode = X_test.CancellationCode.replace(d_CancellationCode)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:47.510853Z","iopub.execute_input":"2022-11-09T15:44:47.511245Z","iopub.status.idle":"2022-11-09T15:44:48.337121Z","shell.execute_reply.started":"2022-11-09T15:44:47.511209Z","shell.execute_reply":"2022-11-09T15:44:48.336041Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:48.338555Z","iopub.execute_input":"2022-11-09T15:44:48.338869Z","iopub.status.idle":"2022-11-09T15:44:48.348465Z","shell.execute_reply.started":"2022-11-09T15:44:48.338840Z","shell.execute_reply":"2022-11-09T15:44:48.347048Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test.dtypes","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:48.350073Z","iopub.execute_input":"2022-11-09T15:44:48.350620Z","iopub.status.idle":"2022-11-09T15:44:48.364488Z","shell.execute_reply.started":"2022-11-09T15:44:48.350587Z","shell.execute_reply":"2022-11-09T15:44:48.363213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import Normalizer","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:48.368433Z","iopub.execute_input":"2022-11-09T15:44:48.368815Z","iopub.status.idle":"2022-11-09T15:44:48.374156Z","shell.execute_reply.started":"2022-11-09T15:44:48.368767Z","shell.execute_reply":"2022-11-09T15:44:48.373028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"norm = Normalizer()\nX_train = norm.fit_transform(X_train)\n\nX_test = norm.transform(X_test)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:48.375922Z","iopub.execute_input":"2022-11-09T15:44:48.376322Z","iopub.status.idle":"2022-11-09T15:44:49.197722Z","shell.execute_reply.started":"2022-11-09T15:44:48.376286Z","shell.execute_reply":"2022-11-09T15:44:49.196340Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Обучение модели","metadata":{}},{"cell_type":"code","source":"lasso = Lasso()\nlasso.fit(X_train, y_train.DelayTime)\ny_pred_lasso = lasso.predict(X_test)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:44:49.199445Z","iopub.execute_input":"2022-11-09T15:44:49.199991Z","iopub.status.idle":"2022-11-09T15:44:49.634410Z","shell.execute_reply.started":"2022-11-09T15:44:49.199936Z","shell.execute_reply":"2022-11-09T15:44:49.632769Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(y_pred_lasso.flatten(), name='DelayTime').to_csv('submission.csv', index_label='id', header=True)","metadata":{"execution":{"iopub.status.busy":"2022-11-09T15:45:03.277477Z","iopub.execute_input":"2022-11-09T15:45:03.278569Z","iopub.status.idle":"2022-11-09T15:45:04.793977Z","shell.execute_reply.started":"2022-11-09T15:45:03.278510Z","shell.execute_reply":"2022-11-09T15:45:04.792432Z"},"trusted":true},"execution_count":null,"outputs":[]}]}