{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "3723782b", "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2022-09-05T13:02:09.644656Z", "iopub.status.busy": "2022-09-05T13:02:09.643933Z", "iopub.status.idle": "2022-09-05T13:02:09.657508Z", "shell.execute_reply": "2022-09-05T13:02:09.656438Z" }, "papermill": { "duration": 0.023341, "end_time": "2022-09-05T13:02:09.660113", "exception": false, "start_time": "2022-09-05T13:02:09.636772", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/input/nsutai/sample_submission.csv\n", "/kaggle/input/nsutai/train.csv\n", "/kaggle/input/nsutai/test.csv\n" ] } ], "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", "\n", "import numpy as np # linear algebra\n", "import 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", "\n", "import os\n", "for 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" ] }, { "cell_type": "code", "execution_count": 2, "id": "909fe5b2", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:09.669974Z", "iopub.status.busy": "2022-09-05T13:02:09.668381Z", "iopub.status.idle": "2022-09-05T13:02:10.932568Z", "shell.execute_reply": "2022-09-05T13:02:10.931603Z" }, "papermill": { "duration": 1.271004, "end_time": "2022-09-05T13:02:10.934930", "exception": false, "start_time": "2022-09-05T13:02:09.663926", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "from catboost import CatBoostRegressor\n", "from sklearn.model_selection import ShuffleSplit, GridSearchCV\n", "from sklearn.preprocessing import StandardScaler\n", "from sklearn.model_selection import train_test_split, cross_val_score, cross_val_predict\n", "import pandas as pd\n", "import numpy as np\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 3, "id": "1462638a", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:10.943879Z", "iopub.status.busy": "2022-09-05T13:02:10.943596Z", "iopub.status.idle": "2022-09-05T13:02:11.394396Z", "shell.execute_reply": "2022-09-05T13:02:11.393459Z" }, "papermill": { "duration": 0.457904, "end_time": "2022-09-05T13:02:11.396743", "exception": false, "start_time": "2022-09-05T13:02:10.938839", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "df = pd.read_csv('../input/nsutai/train.csv')\n", "# df = df.drop('name',axis=1)\n", "# df = df.drop('sentry_object',axis=1)\n", "df = df.drop('event',axis=1)\n", "df = df.drop('id',axis=1)\n", "terms = 0\n", "total = 0\n", "for i in df:\n", " df[i].fillna(value=df[i].mean(), inplace=True)\n", "df['px12'] = df.px1 * df.px2\n", "df['Q12'] = df.q1 * df.q2\n", "df['phi12'] = df.phi1 * df.phi2\n", "df['eta12'] = df.eta1 * df.eta2\n", "df['pt12'] = df.pt1 * df.pt2\n", "df['E12'] = df.e1 * df.e2\n", "df['pz_diff'] = df.pz1 - df.pz2\n", "df['eta_diff'] = df.eta1 - df.eta2" ] }, { "cell_type": "code", "execution_count": 4, "id": "a9ed9929", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.405872Z", "iopub.status.busy": "2022-09-05T13:02:11.405576Z", "iopub.status.idle": "2022-09-05T13:02:11.426360Z", "shell.execute_reply": "2022-09-05T13:02:11.425332Z" }, "papermill": { "duration": 0.02842, "end_time": "2022-09-05T13:02:11.429254", "exception": false, "start_time": "2022-09-05T13:02:11.400834", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 69940 entries, 0 to 69939\n", "Data columns (total 25 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 e1 69940 non-null float64\n", " 1 px1 69940 non-null float64\n", " 2 py1 69940 non-null float64\n", " 3 pz1 69940 non-null float64\n", " 4 pt1 69940 non-null float64\n", " 5 eta1 69940 non-null float64\n", " 6 phi1 69940 non-null float64\n", " 7 q1 69940 non-null int64 \n", " 8 e2 69940 non-null float64\n", " 9 px2 69940 non-null float64\n", " 10 py2 69940 non-null float64\n", " 11 pz2 69940 non-null float64\n", " 12 pt2 69940 non-null float64\n", " 13 eta2 69940 non-null float64\n", " 14 phi2 69940 non-null float64\n", " 15 q2 69940 non-null int64 \n", " 16 mass 69940 non-null float64\n", " 17 px12 69940 non-null float64\n", " 18 Q12 69940 non-null int64 \n", " 19 phi12 69940 non-null float64\n", " 20 eta12 69940 non-null float64\n", " 21 pt12 69940 non-null float64\n", " 22 E12 69940 non-null float64\n", " 23 pz_diff 69940 non-null float64\n", " 24 eta_diff 69940 non-null float64\n", "dtypes: float64(22), int64(3)\n", "memory usage: 13.3 MB\n" ] } ], "source": [ "df.info()" ] }, { "cell_type": "code", "execution_count": 5, "id": "ff7f9418", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.438260Z", "iopub.status.busy": "2022-09-05T13:02:11.437997Z", "iopub.status.idle": "2022-09-05T13:02:11.483587Z", "shell.execute_reply": "2022-09-05T13:02:11.482534Z" }, "papermill": { "duration": 0.05382, "end_time": "2022-09-05T13:02:11.487122", "exception": false, "start_time": "2022-09-05T13:02:11.433302", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "Xn_data = np.array(df.drop('mass', axis = 1).values)\n", "# Normalize X_data\n", "X_data = (Xn_data - np.mean(Xn_data)) / np.std(Xn_data)\n", "# y_data = np.log(np.array(df[\"mass\"]))\n", "from sklearn.preprocessing import StandardScaler" ] }, { "cell_type": "code", "execution_count": 6, "id": "d33ee3a8", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.501842Z", "iopub.status.busy": "2022-09-05T13:02:11.501512Z", "iopub.status.idle": "2022-09-05T13:02:11.576250Z", "shell.execute_reply": "2022-09-05T13:02:11.574558Z" }, "papermill": { "duration": 0.084845, "end_time": "2022-09-05T13:02:11.580949", "exception": false, "start_time": "2022-09-05T13:02:11.496104", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "X = df.drop('mass',axis=1)\n", "# from sklearn.preprocessing import StandardScaler\n", "# sc = StandardScaler()\n", "# X = sc.fit_transform(X)\n", "y = df['mass'].values\n", "\n", "X_train, X_test, y_train, y_test = train_test_split(X_data,y,test_size=0.2,random_state=33)\n", "ss = StandardScaler()\n", "X_train = ss.fit_transform(X_train)\n", "X_test = ss.fit_transform(X_test)" ] }, { "cell_type": "code", "execution_count": 7, "id": "0fea2318", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.598458Z", "iopub.status.busy": "2022-09-05T13:02:11.597860Z", "iopub.status.idle": "2022-09-05T13:02:11.612775Z", "shell.execute_reply": "2022-09-05T13:02:11.611552Z" }, "papermill": { "duration": 0.027089, "end_time": "2022-09-05T13:02:11.616455", "exception": false, "start_time": "2022-09-05T13:02:11.589366", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "array([[ 1.54406036e-03, 5.00046796e-02, 9.72291485e-01, ...,\n", " 3.46918585e-03, -4.15573889e-02, -7.97763559e-03],\n", " [ 1.94422910e-04, -3.33701351e-01, -1.21056344e+00, ...,\n", " 3.65737676e-03, -1.13711783e-01, 2.60815651e-03],\n", " [ 2.38266960e-03, 5.19004764e-01, 8.78117565e-01, ...,\n", " 2.62745940e-03, 8.97889389e-02, -2.15806071e-02],\n", " ...,\n", " [-1.40730483e-04, -1.79267428e-01, 1.03092574e+00, ...,\n", " 3.74511846e-03, -2.07740905e+00, 7.78566082e-03],\n", " [-8.58332036e-04, -7.98378259e-01, -1.12113137e+00, ...,\n", " 2.87497174e-03, 4.31631201e-01, 8.14307267e-04],\n", " [ 1.02554766e-03, -1.28674581e+00, -1.34946525e-01, ...,\n", " 3.44007559e-03, 2.95152031e-03, -5.08424031e-04]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X_train" ] }, { "cell_type": "code", "execution_count": 8, "id": "79f26373", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.633832Z", "iopub.status.busy": "2022-09-05T13:02:11.633551Z", "iopub.status.idle": "2022-09-05T13:02:11.638935Z", "shell.execute_reply": "2022-09-05T13:02:11.638026Z" }, "papermill": { "duration": 0.01656, "end_time": "2022-09-05T13:02:11.641678", "exception": false, "start_time": "2022-09-05T13:02:11.625118", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Location of categorical columns : ['q1', 'q2', 'Q12']\n" ] } ], "source": [ "#List of categorical columns\n", "# categoricalcolumns = X.select_dtypes(include=[\"object\"]).columns.tolist()\n", "# print(\"Names of categorical columns : \", categoricalcolumns)\n", "#Get location of categorical columns\n", "cat_features = ['q1','q2','Q12']\n", "print(\"Location of categorical columns : \",cat_features)\n" ] }, { "cell_type": "code", "execution_count": 9, "id": "255a87ee", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:11.651657Z", "iopub.status.busy": "2022-09-05T13:02:11.651374Z", "iopub.status.idle": "2022-09-05T13:02:12.403415Z", "shell.execute_reply": "2022-09-05T13:02:12.402465Z" }, "papermill": { "duration": 0.760088, "end_time": "2022-09-05T13:02:12.406197", "exception": false, "start_time": "2022-09-05T13:02:11.646109", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# importing Pool\n", "from catboost import Pool\n", "#Creating pool object for train dataset. we give information of categorical fetures to parameter cat_fetaures\n", "train_data = Pool(data=X_train,\n", " label=y_train,\n", "# cat_features=cat_features\n", " )\n", "#Creating pool object for test dataset\n", "test_data = Pool(data=X_test,\n", " label=y_test,\n", "# cat_features=cat_features\n", " )" ] }, { "cell_type": "code", "execution_count": 10, "id": "513ae7cc", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:12.420374Z", "iopub.status.busy": "2022-09-05T13:02:12.420051Z", "iopub.status.idle": "2022-09-05T13:02:12.423954Z", "shell.execute_reply": "2022-09-05T13:02:12.423122Z" }, "papermill": { "duration": 0.015038, "end_time": "2022-09-05T13:02:12.427807", "exception": false, "start_time": "2022-09-05T13:02:12.412769", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# print(np.sqrt(error))" ] }, { "cell_type": "code", "execution_count": 11, "id": "f6829920", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T13:02:12.441091Z", "iopub.status.busy": "2022-09-05T13:02:12.440796Z", "iopub.status.idle": "2022-09-05T14:45:06.059945Z", "shell.execute_reply": "2022-09-05T14:45:06.058899Z" }, "papermill": { "duration": 6173.62882, "end_time": "2022-09-05T14:45:06.062699", "exception": false, "start_time": "2022-09-05T13:02:12.433879", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Learning rate set to 0.011444\n", "0:\tlearn: 1.0109453\ttotal: 25.3ms\tremaining: 8m 25s\n", "5000:\tlearn: 0.2627569\ttotal: 1m 41s\tremaining: 5m 3s\n", "10000:\tlearn: 0.0976646\ttotal: 3m 22s\tremaining: 3m 22s\n", "15000:\tlearn: 0.0396183\ttotal: 5m 4s\tremaining: 1m 41s\n", "19999:\tlearn: 0.0169753\ttotal: 6m 44s\tremaining: 0us\n", "Learning rate set to 0.008715\n", "0:\tlearn: 1.0111765\ttotal: 32ms\tremaining: 10m 39s\n", "5000:\tlearn: 0.5784365\ttotal: 12m 45s\tremaining: 38m 15s\n", "10000:\tlearn: 0.5133532\ttotal: 25m 6s\tremaining: 25m 5s\n", "15000:\tlearn: 0.4772074\ttotal: 37m 26s\tremaining: 12m 28s\n", "19999:\tlearn: 0.4527199\ttotal: 49m 6s\tremaining: 0us\n", "Learning rate set to 0.008715\n", "0:\tlearn: 1.0070361\ttotal: 76.6ms\tremaining: 25m 31s\n", "5000:\tlearn: 0.5676638\ttotal: 12m 51s\tremaining: 38m 33s\n", "10000:\tlearn: 0.5046212\ttotal: 23m 32s\tremaining: 23m 32s\n", "15000:\tlearn: 0.4696909\ttotal: 34m 21s\tremaining: 11m 26s\n", "19999:\tlearn: 0.4463740\ttotal: 45m 11s\tremaining: 0us\n", "0.8447744377236096\n" ] } ], "source": [ "catbr = CatBoostRegressor(verbose=5000,task_type='GPU',loss_function='RMSE',iterations = 20000,depth = 12).fit(X_train,y_train)\n", "# R2CV = cross_val_score(catbr,X_test,y_test,cv=3,scoring=\"r2\").mean()\n", "error = -cross_val_score(catbr,X_test,y_test,cv=2,scoring=\"neg_mean_squared_error\").mean()\n", "# print(R2CV)\n", "print(np.sqrt(error))" ] }, { "cell_type": "code", "execution_count": 12, "id": "96a52e15", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.074785Z", "iopub.status.busy": "2022-09-05T14:45:06.074091Z", "iopub.status.idle": "2022-09-05T14:45:06.077959Z", "shell.execute_reply": "2022-09-05T14:45:06.077027Z" }, "papermill": { "duration": 0.011987, "end_time": "2022-09-05T14:45:06.080009", "exception": false, "start_time": "2022-09-05T14:45:06.068022", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# params = {\n", " \n", "# \"depth\": [2, 3, 4, 5, 6],\n", "# \"learning_rate\": [0.1, 0.01, 0.5]\n", "# }" ] }, { "cell_type": "code", "execution_count": 13, "id": "58836338", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.091493Z", "iopub.status.busy": "2022-09-05T14:45:06.091219Z", "iopub.status.idle": "2022-09-05T14:45:06.095298Z", "shell.execute_reply": "2022-09-05T14:45:06.094449Z" }, "papermill": { "duration": 0.012206, "end_time": "2022-09-05T14:45:06.097198", "exception": false, "start_time": "2022-09-05T14:45:06.084992", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# cv = GridSearchCV(catbr, params, cv=10, verbose=True).fit(X_train, y_train)\n", "# print(cv.best_params_)" ] }, { "cell_type": "code", "execution_count": 14, "id": "81fb1672", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.107939Z", "iopub.status.busy": "2022-09-05T14:45:06.107678Z", "iopub.status.idle": "2022-09-05T14:45:06.111581Z", "shell.execute_reply": "2022-09-05T14:45:06.110646Z" }, "papermill": { "duration": 0.011411, "end_time": "2022-09-05T14:45:06.113552", "exception": false, "start_time": "2022-09-05T14:45:06.102141", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# catbrtuned = CatBoostRegressor(depth=5,learning_rate=0.01,verbose=False,task_type='GPU').fit(X_train,y_train)\n", "\n", "# # R2CVtuned = cross_val_score(catbrtuned,X_test,y_test,cv=15,scoring=\"r2\").mean()\n", "# # print(R2CVtuned)\n", "# errortuned = -cross_val_score(catbrtuned,X_test,y_test,cv=20,scoring=\"neg_mean_squared_error\").mean()\n", "# print(np.sqrt(errortuned))" ] }, { "cell_type": "code", "execution_count": 15, "id": "9654095f", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.124164Z", "iopub.status.busy": "2022-09-05T14:45:06.123909Z", "iopub.status.idle": "2022-09-05T14:45:06.130345Z", "shell.execute_reply": "2022-09-05T14:45:06.129490Z" }, "papermill": { "duration": 0.013934, "end_time": "2022-09-05T14:45:06.132270", "exception": false, "start_time": "2022-09-05T14:45:06.118336", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "array([[ 1.01680714e-02, 6.52076470e-01, -1.71361082e+00, ...,\n", " 1.49118772e-03, 1.63726624e-01, 3.10255375e-03],\n", " [ 1.24653160e-02, 1.40030095e-01, 9.08963077e-01, ...,\n", " 6.54264303e-04, 1.87932998e+00, -2.37996666e-02],\n", " [ 1.56609992e+00, 3.08161424e-01, -3.38753181e-01, ...,\n", " -4.62755342e-02, 1.25592922e+00, -1.43120765e-02],\n", " ...,\n", " [ 8.24693308e-03, -1.65144148e-01, -1.91790940e+00, ...,\n", " 1.21247452e-04, 1.06549128e+00, 3.83478623e-03],\n", " [ 9.59390026e-05, -1.42118970e+00, -6.56800351e-01, ...,\n", " 5.07400206e-04, -1.61068698e+00, 1.05205829e-03],\n", " [ 2.32941353e-03, 1.13598956e-01, -1.35239977e-01, ...,\n", " 8.06554653e-04, -4.00680340e-01, -5.26439826e-03]])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X_test" ] }, { "cell_type": "code", "execution_count": 16, "id": "0bb3dd56", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.143546Z", "iopub.status.busy": "2022-09-05T14:45:06.143260Z", "iopub.status.idle": "2022-09-05T14:45:06.354494Z", "shell.execute_reply": "2022-09-05T14:45:06.353489Z" }, "papermill": { "duration": 0.219067, "end_time": "2022-09-05T14:45:06.356593", "exception": false, "start_time": "2022-09-05T14:45:06.137526", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
e1px1py1pz1pt1eta1phi1q1e2px2py2pz2pt2eta2phi2q2
03.90091024.920700-1.1026740.70262824.98810-42.967949-0.073422-10.7268540.715108-0.374241-1.351969-0.6547670.674536-0.987639-1
1-3.401169-7.0078700.5815110.3217418.03705-0.1626312.629960136.6039440.6982900.936158-0.7729300.8289640.647576-0.532239-1
20.804254-1.2195601.5571460.94916412.613100.337772-1.6676401-25.4012950.6153610.5509700.397435-0.5252760.7237040.4816151
31.073530-2.7210701.2586420.2683682.754033.670449-2.986720-1-42.1013330.7413270.236630-0.1510150.4720830.9747900.356768-1
40.70468916.0551001.471738-0.86355217.323902.4301940.385110-1-1.0486020.9580890.268982-0.264064-0.9694780.554407-0.101867-1
...................................................
29970-0.258829-10.658000-0.5071610.22892011.843300.2966082.690370-1-4.2514680.81393973.6675011.158823-0.1483240.9544420.3887981
29971-0.4056367.8549901.024085-0.86071817.05020-0.4563471.0920101-1.6167370.5500671.162549-0.311051-0.8979920.772986-0.5279321
299721.719597-3.2735001.3973460.5770563.28801-1.215898-3.04763010.6280210.5429460.143970-0.731390-0.3078510.734795-0.766423-1
299731.76420211.3526000.8150740.93053716.43280-0.1264480.808132-1-1.1113050.932663-0.063397-0.153664-0.9991930.5450500.1218831
299744.6017520.8861620.5560920.9944645.55010-2.0745471.4104401-3.5781460.628637-9.2848310.4251680.1476980.5551150.964454-1
\n", "

29975 rows × 16 columns

\n", "
" ], "text/plain": [ " e1 px1 py1 pz1 pt1 eta1 phi1 \\\n", "0 3.900910 24.920700 -1.102674 0.702628 24.98810 -42.967949 -0.073422 \n", "1 -3.401169 -7.007870 0.581511 0.321741 8.03705 -0.162631 2.629960 \n", "2 0.804254 -1.219560 1.557146 0.949164 12.61310 0.337772 -1.667640 \n", "3 1.073530 -2.721070 1.258642 0.268368 2.75403 3.670449 -2.986720 \n", "4 0.704689 16.055100 1.471738 -0.863552 17.32390 2.430194 0.385110 \n", "... ... ... ... ... ... ... ... \n", "29970 -0.258829 -10.658000 -0.507161 0.228920 11.84330 0.296608 2.690370 \n", "29971 -0.405636 7.854990 1.024085 -0.860718 17.05020 -0.456347 1.092010 \n", "29972 1.719597 -3.273500 1.397346 0.577056 3.28801 -1.215898 -3.047630 \n", "29973 1.764202 11.352600 0.815074 0.930537 16.43280 -0.126448 0.808132 \n", "29974 4.601752 0.886162 0.556092 0.994464 5.55010 -2.074547 1.410440 \n", "\n", " q1 e2 px2 py2 pz2 pt2 eta2 \\\n", "0 -1 0.726854 0.715108 -0.374241 -1.351969 -0.654767 0.674536 \n", "1 1 36.603944 0.698290 0.936158 -0.772930 0.828964 0.647576 \n", "2 1 -25.401295 0.615361 0.550970 0.397435 -0.525276 0.723704 \n", "3 -1 -42.101333 0.741327 0.236630 -0.151015 0.472083 0.974790 \n", "4 -1 -1.048602 0.958089 0.268982 -0.264064 -0.969478 0.554407 \n", "... .. ... ... ... ... ... ... \n", "29970 -1 -4.251468 0.813939 73.667501 1.158823 -0.148324 0.954442 \n", "29971 1 -1.616737 0.550067 1.162549 -0.311051 -0.897992 0.772986 \n", "29972 1 0.628021 0.542946 0.143970 -0.731390 -0.307851 0.734795 \n", "29973 -1 -1.111305 0.932663 -0.063397 -0.153664 -0.999193 0.545050 \n", "29974 1 -3.578146 0.628637 -9.284831 0.425168 0.147698 0.555115 \n", "\n", " phi2 q2 \n", "0 -0.987639 -1 \n", "1 -0.532239 -1 \n", "2 0.481615 1 \n", "3 0.356768 -1 \n", "4 -0.101867 -1 \n", "... ... .. \n", "29970 0.388798 1 \n", "29971 -0.527932 1 \n", "29972 -0.766423 -1 \n", "29973 0.121883 1 \n", "29974 0.964454 -1 \n", "\n", "[29975 rows x 16 columns]" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test=pd.read_csv(\"../input/nsutai/test.csv\")\n", "\n", "X_test=test.drop('id',axis=1)\n", "X_test = X_test.drop('event',axis=1)\n", "# X_test = X_test.drop('id',axis=1)\n", "\n", "X_test" ] }, { "cell_type": "code", "execution_count": 17, "id": "46a97231", "metadata": { "execution": { "iopub.execute_input": "2022-09-05T14:45:06.371027Z", "iopub.status.busy": "2022-09-05T14:45:06.369496Z", "iopub.status.idle": "2022-09-05T14:45:10.555987Z", "shell.execute_reply": "2022-09-05T14:45:10.554972Z" }, "papermill": { "duration": 4.195275, "end_time": "2022-09-05T14:45:10.558397", "exception": false, "start_time": "2022-09-05T14:45:06.363122", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "X_test['px12'] = X_test.px1 * X_test.px2\n", "X_test['Q12'] = X_test.q1 * X_test.q2\n", "X_test['phi12'] = X_test.phi1 * X_test.phi2\n", "X_test['eta12'] = X_test.eta1 * X_test.eta2\n", "X_test['pt12'] = X_test.pt1 * X_test.pt2\n", "X_test['E12'] = X_test.e1 * X_test.e2\n", "X_test['pz_diff'] = X_test.pz1 - X_test.pz2\n", "X_test['eta_diff'] = X_test.eta1 - X_test.eta2\n", "y_pred=catbr.predict(X_test)\n", "sample_submission=pd.read_csv(\"../input/nsutai/sample_submission.csv\")\n", "sample_submission['mass']=y_pred\n", "sample_submission.to_csv('submission.csv',index=False)" ] }, { "cell_type": "code", "execution_count": null, "id": "b5dfc088", "metadata": { "papermill": { "duration": 0.005294, "end_time": "2022-09-05T14:45:10.569668", "exception": false, "start_time": "2022-09-05T14:45:10.564374", "status": "completed" }, "tags": [] }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.12" }, "papermill": { "default_parameters": {}, "duration": 6189.341373, "end_time": "2022-09-05T14:45:11.404111", "environment_variables": {}, "exception": null, "input_path": "__notebook__.ipynb", "output_path": "__notebook__.ipynb", "parameters": {}, "start_time": "2022-09-05T13:02:02.062738", "version": "2.3.4" } }, "nbformat": 4, "nbformat_minor": 5 }