{"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":"2023-01-26T14:32:33.733325Z","iopub.execute_input":"2023-01-26T14:32:33.734009Z","iopub.status.idle":"2023-01-26T14:32:33.764527Z","shell.execute_reply.started":"2023-01-26T14:32:33.733903Z","shell.execute_reply":"2023-01-26T14:32:33.763469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!nvidia-smi","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:32:44.554148Z","iopub.execute_input":"2023-01-26T14:32:44.554517Z","iopub.status.idle":"2023-01-26T14:32:45.712408Z","shell.execute_reply.started":"2023-01-26T14:32:44.554484Z","shell.execute_reply":"2023-01-26T14:32:45.711127Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip3 install rapids\n!pip3 install cuml\n","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:32:58.557517Z","iopub.execute_input":"2023-01-26T14:32:58.558261Z","iopub.status.idle":"2023-01-26T14:33:21.726409Z","shell.execute_reply.started":"2023-01-26T14:32:58.558222Z","shell.execute_reply":"2023-01-26T14:33:21.72514Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# from cuml import LinearRegression\nimport cudf, cupy, cuml\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport matplotlib\nimport re","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:00:40.477303Z","iopub.execute_input":"2023-01-26T15:00:40.477699Z","iopub.status.idle":"2023-01-26T15:00:40.485204Z","shell.execute_reply.started":"2023-01-26T15:00:40.477665Z","shell.execute_reply":"2023-01-26T15:00:40.484213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### EDA","metadata":{}},{"cell_type":"code","source":"df_train=cudf.read_csv(\"/kaggle/input/2023-ucs654-hack-1/train.csv\")\ndf_test=cudf.read_csv(\"/kaggle/input/2023-ucs654-hack-1/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:36:20.807898Z","iopub.execute_input":"2023-01-26T14:36:20.80841Z","iopub.status.idle":"2023-01-26T14:36:27.528558Z","shell.execute_reply.started":"2023-01-26T14:36:20.808377Z","shell.execute_reply":"2023-01-26T14:36:27.527621Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:36:35.476034Z","iopub.execute_input":"2023-01-26T14:36:35.476399Z","iopub.status.idle":"2023-01-26T14:36:35.500415Z","shell.execute_reply.started":"2023-01-26T14:36:35.476367Z","shell.execute_reply":"2023-01-26T14:36:35.499379Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.describe()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:36:50.264603Z","iopub.execute_input":"2023-01-26T14:36:50.265213Z","iopub.status.idle":"2023-01-26T14:37:00.971435Z","shell.execute_reply.started":"2023-01-26T14:36:50.265179Z","shell.execute_reply":"2023-01-26T14:37:00.970428Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.target.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:17:05.456469Z","iopub.execute_input":"2023-01-26T16:17:05.457187Z","iopub.status.idle":"2023-01-26T16:17:05.487192Z","shell.execute_reply.started":"2023-01-26T16:17:05.457152Z","shell.execute_reply":"2023-01-26T16:17:05.486153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"(df_train.isnull().sum().values)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:40:21.34215Z","iopub.execute_input":"2023-01-26T14:40:21.342521Z","iopub.status.idle":"2023-01-26T14:40:21.715494Z","shell.execute_reply.started":"2023-01-26T14:40:21.34249Z","shell.execute_reply":"2023-01-26T14:40:21.714593Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:53:02.033757Z","iopub.execute_input":"2023-01-26T17:53:02.034118Z","iopub.status.idle":"2023-01-26T17:53:02.740198Z","shell.execute_reply.started":"2023-01-26T17:53:02.034086Z","shell.execute_reply":"2023-01-26T17:53:02.739093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* 1.OUTLIER DETECTION\n* 2.Feature importance\n* 3.Feature reduction-PCA,LDA\n* 4.correlation \n* 5.multicollinearity\n* 6.data-imbalance\n* 7.scaling","metadata":{}},{"cell_type":"code","source":"dir(cuml)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:43:25.665715Z","iopub.execute_input":"2023-01-26T14:43:25.666751Z","iopub.status.idle":"2023-01-26T14:43:25.674213Z","shell.execute_reply.started":"2023-01-26T14:43:25.666699Z","shell.execute_reply":"2023-01-26T14:43:25.673217Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Recursive feature elimination\n# 1.13.4. Feature selection using SelectFromModel\n#  Sequential Feature Selection","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.corr()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T14:50:54.212704Z","iopub.execute_input":"2023-01-26T14:50:54.213664Z","iopub.status.idle":"2023-01-26T14:50:57.616552Z","shell.execute_reply.started":"2023-01-26T14:50:54.213626Z","shell.execute_reply":"2023-01-26T14:50:57.615515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# df_train.corr(method='spearman')","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:50:29.624622Z","iopub.execute_input":"2023-01-26T15:50:29.625018Z","iopub.status.idle":"2023-01-26T15:50:29.630022Z","shell.execute_reply.started":"2023-01-26T15:50:29.624985Z","shell.execute_reply":"2023-01-26T15:50:29.628883Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cuml","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:01:09.579296Z","iopub.execute_input":"2023-01-26T15:01:09.579691Z","iopub.status.idle":"2023-01-26T15:01:09.586336Z","shell.execute_reply.started":"2023-01-26T15:01:09.579658Z","shell.execute_reply":"2023-01-26T15:01:09.585362Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":" from cuml.decomposition import PCA","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:01:49.334676Z","iopub.execute_input":"2023-01-26T15:01:49.335062Z","iopub.status.idle":"2023-01-26T15:01:49.342025Z","shell.execute_reply.started":"2023-01-26T15:01:49.335027Z","shell.execute_reply":"2023-01-26T15:01:49.340987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_new=df_train.drop(['target'],axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:04:41.639245Z","iopub.execute_input":"2023-01-26T15:04:41.639867Z","iopub.status.idle":"2023-01-26T15:04:41.792709Z","shell.execute_reply.started":"2023-01-26T15:04:41.639815Z","shell.execute_reply":"2023-01-26T15:04:41.791731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test_new=df_test.drop(['id'],axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:04:28.750858Z","iopub.execute_input":"2023-01-26T18:04:28.751223Z","iopub.status.idle":"2023-01-26T18:04:28.83588Z","shell.execute_reply.started":"2023-01-26T18:04:28.751192Z","shell.execute_reply":"2023-01-26T18:04:28.834982Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test_new","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:04:32.763621Z","iopub.execute_input":"2023-01-26T18:04:32.764009Z","iopub.status.idle":"2023-01-26T18:04:33.621016Z","shell.execute_reply.started":"2023-01-26T18:04:32.763976Z","shell.execute_reply":"2023-01-26T18:04:33.619996Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# df_train_new","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:04:52.209515Z","iopub.execute_input":"2023-01-26T15:04:52.210364Z","iopub.status.idle":"2023-01-26T15:04:52.216489Z","shell.execute_reply.started":"2023-01-26T15:04:52.210329Z","shell.execute_reply":"2023-01-26T15:04:52.215251Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train_new=df_train_new.astype('float32')","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:10:27.035322Z","iopub.execute_input":"2023-01-26T15:10:27.035722Z","iopub.status.idle":"2023-01-26T15:10:27.165363Z","shell.execute_reply.started":"2023-01-26T15:10:27.035687Z","shell.execute_reply":"2023-01-26T15:10:27.16436Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test_new=df_test_new.astype('float32')","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:04:59.860632Z","iopub.execute_input":"2023-01-26T18:04:59.860999Z","iopub.status.idle":"2023-01-26T18:04:59.99398Z","shell.execute_reply.started":"2023-01-26T18:04:59.860968Z","shell.execute_reply":"2023-01-26T18:04:59.993151Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test_new","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:05:10.536436Z","iopub.execute_input":"2023-01-26T18:05:10.537125Z","iopub.status.idle":"2023-01-26T18:05:11.227447Z","shell.execute_reply.started":"2023-01-26T18:05:10.537088Z","shell.execute_reply":"2023-01-26T18:05:11.226535Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pca1=PCA(n_components=500)\ntrans_df_test=pca1.fit_transform(df_test_new)\n# print(pca.components_)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:05:23.13076Z","iopub.execute_input":"2023-01-26T18:05:23.131125Z","iopub.status.idle":"2023-01-26T18:05:23.376773Z","shell.execute_reply.started":"2023-01-26T18:05:23.131093Z","shell.execute_reply":"2023-01-26T18:05:23.375829Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pca=PCA(n_components=500)\ntrans_df=pca.fit_transform(df_train_new)\n# print(pca.components_)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:56:16.231009Z","iopub.execute_input":"2023-01-26T15:56:16.231385Z","iopub.status.idle":"2023-01-26T15:56:16.46736Z","shell.execute_reply.started":"2023-01-26T15:56:16.23135Z","shell.execute_reply":"2023-01-26T15:56:16.466415Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(pca.explained_variance_ratio_)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:56:19.845193Z","iopub.execute_input":"2023-01-26T15:56:19.845568Z","iopub.status.idle":"2023-01-26T15:56:19.858317Z","shell.execute_reply.started":"2023-01-26T15:56:19.845536Z","shell.execute_reply":"2023-01-26T15:56:19.85717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pca1.explained_variance_ratio_","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:05:28.952128Z","iopub.execute_input":"2023-01-26T18:05:28.952486Z","iopub.status.idle":"2023-01-26T18:05:28.964904Z","shell.execute_reply.started":"2023-01-26T18:05:28.952455Z","shell.execute_reply":"2023-01-26T18:05:28.963893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df_test","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:04:17.174371Z","iopub.execute_input":"2023-01-26T17:04:17.174757Z","iopub.status.idle":"2023-01-26T17:04:17.558419Z","shell.execute_reply.started":"2023-01-26T17:04:17.174724Z","shell.execute_reply":"2023-01-26T17:04:17.557483Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:56:36.43999Z","iopub.execute_input":"2023-01-26T15:56:36.440357Z","iopub.status.idle":"2023-01-26T15:56:36.446606Z","shell.execute_reply.started":"2023-01-26T15:56:36.440325Z","shell.execute_reply":"2023-01-26T15:56:36.445498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:33:38.959967Z","iopub.execute_input":"2023-01-26T16:33:38.960355Z","iopub.status.idle":"2023-01-26T16:33:39.333276Z","shell.execute_reply.started":"2023-01-26T16:33:38.960325Z","shell.execute_reply":"2023-01-26T16:33:39.332286Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# import matplotlib.pyplot as plt\n# plt.style.use(\"ggplot\") \n# plt.plot(pca.explained_variance_, marker='o')\n# plt.xlabel(\"Eigenvalue number\")\n# plt.ylabel(\"Eigenvalue size\")\n# plt.title(\"Scree Plot\")","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:55:04.08205Z","iopub.execute_input":"2023-01-26T15:55:04.082653Z","iopub.status.idle":"2023-01-26T15:55:04.086514Z","shell.execute_reply.started":"2023-01-26T15:55:04.082615Z","shell.execute_reply":"2023-01-26T15:55:04.08561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\n# pca.explained_variance_ratio_.cumsum().values\n# plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:05:51.402706Z","iopub.execute_input":"2023-01-26T17:05:51.403094Z","iopub.status.idle":"2023-01-26T17:05:51.408638Z","shell.execute_reply.started":"2023-01-26T17:05:51.403062Z","shell.execute_reply":"2023-01-26T17:05:51.407646Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# pca1.explained_variance_ratio_.cumsum().values","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:05:39.357764Z","iopub.execute_input":"2023-01-26T18:05:39.358471Z","iopub.status.idle":"2023-01-26T18:05:39.372393Z","shell.execute_reply.started":"2023-01-26T18:05:39.358432Z","shell.execute_reply":"2023-01-26T18:05:39.371394Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### we have retained 98% variance of original data","metadata":{"execution":{"iopub.status.busy":"2023-01-26T15:57:49.134474Z","iopub.execute_input":"2023-01-26T15:57:49.135175Z","iopub.status.idle":"2023-01-26T15:57:49.139897Z","shell.execute_reply.started":"2023-01-26T15:57:49.135138Z","shell.execute_reply":"2023-01-26T15:57:49.138641Z"}}},{"cell_type":"code","source":"\nimport matplotlib.pyplot as plt\n\n\nplt.figure(figsize=(15,10))\nplt.ylim(0.0,1.1)\nplt.plot(np.cumsum(pca.explained_variance_ratio_.values.get()), linewidth=3)\n\nplt.xlabel('number of components', fontsize=21)\nplt.ylabel('cumulative explained variance', fontsize=21)\nplt.title('Scree Plot using PCA', fontsize=24)\n\nplt.rc('font', size=16)\n\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:07:05.735118Z","iopub.execute_input":"2023-01-26T16:07:05.735482Z","iopub.status.idle":"2023-01-26T16:07:05.957399Z","shell.execute_reply.started":"2023-01-26T16:07:05.735448Z","shell.execute_reply":"2023-01-26T16:07:05.956483Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n# import matplotlib.pyplot as plt\n\n\nplt.figure(figsize=(15,10))\nplt.ylim(0.0,1.1)\nplt.plot(np.cumsum(pca1.explained_variance_ratio_.values.get()), linewidth=3)\n\nplt.xlabel('number of components', fontsize=21)\nplt.ylabel('cumulative explained variance', fontsize=21)\nplt.title('Scree Plot using PCA', fontsize=24)\n\nplt.rc('font', size=16)\n\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:04:56.87009Z","iopub.execute_input":"2023-01-26T17:04:56.870454Z","iopub.status.idle":"2023-01-26T17:04:57.099389Z","shell.execute_reply.started":"2023-01-26T17:04:56.870421Z","shell.execute_reply":"2023-01-26T17:04:57.098484Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# to-do hyperparameter tuning of n_components\n","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Model Building","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:08:24.314807Z","iopub.execute_input":"2023-01-26T16:08:24.315199Z","iopub.status.idle":"2023-01-26T16:08:24.322212Z","shell.execute_reply.started":"2023-01-26T16:08:24.315167Z","shell.execute_reply":"2023-01-26T16:08:24.321257Z"}}},{"cell_type":"code","source":"!pip install pycaret==2.3.1\n","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:09:53.327183Z","iopub.execute_input":"2023-01-26T16:09:53.327596Z","iopub.status.idle":"2023-01-26T16:11:00.118337Z","shell.execute_reply.started":"2023-01-26T16:09:53.327546Z","shell.execute_reply":"2023-01-26T16:11:00.11716Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from pycaret.utils import version\nversion()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:11:07.883263Z","iopub.execute_input":"2023-01-26T16:11:07.883665Z","iopub.status.idle":"2023-01-26T16:11:07.899642Z","shell.execute_reply.started":"2023-01-26T16:11:07.883628Z","shell.execute_reply":"2023-01-26T16:11:07.898694Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pycaret\nprint('Using PyCaret Version', pycaret.__version__)\nprint('Path to PyCaret: ', pycaret.__file__)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:11:16.609933Z","iopub.execute_input":"2023-01-26T16:11:16.610366Z","iopub.status.idle":"2023-01-26T16:11:16.616655Z","shell.execute_reply.started":"2023-01-26T16:11:16.610333Z","shell.execute_reply":"2023-01-26T16:11:16.615524Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# from pycaret.classification import *\n","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:12:19.165344Z","iopub.execute_input":"2023-01-26T16:12:19.165798Z","iopub.status.idle":"2023-01-26T16:12:19.286878Z","shell.execute_reply.started":"2023-01-26T16:12:19.165761Z","shell.execute_reply":"2023-01-26T16:12:19.285244Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import StratifiedKFold,train_test_split\n# skf=StratifiedKFold(n_splits=4,shuffle=True,random_state=2000)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:38:34.281905Z","iopub.execute_input":"2023-01-26T16:38:34.28227Z","iopub.status.idle":"2023-01-26T16:38:34.291002Z","shell.execute_reply.started":"2023-01-26T16:38:34.282238Z","shell.execute_reply":"2023-01-26T16:38:34.289619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=df_train['target']","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:29:52.209984Z","iopub.execute_input":"2023-01-26T16:29:52.210357Z","iopub.status.idle":"2023-01-26T16:29:52.215254Z","shell.execute_reply.started":"2023-01-26T16:29:52.210326Z","shell.execute_reply":"2023-01-26T16:29:52.214071Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y.to_array()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:30:59.033762Z","iopub.execute_input":"2023-01-26T16:30:59.03413Z","iopub.status.idle":"2023-01-26T16:30:59.043145Z","shell.execute_reply.started":"2023-01-26T16:30:59.034098Z","shell.execute_reply":"2023-01-26T16:30:59.042072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# skf.split(trans_df,y.to_array())","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:31:11.596939Z","iopub.execute_input":"2023-01-26T16:31:11.59786Z","iopub.status.idle":"2023-01-26T16:31:11.607503Z","shell.execute_reply.started":"2023-01-26T16:31:11.597823Z","shell.execute_reply":"2023-01-26T16:31:11.606284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from cuml.ensemble import RandomForestClassifier as rf","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:06:23.697399Z","iopub.execute_input":"2023-01-26T18:06:23.697773Z","iopub.status.idle":"2023-01-26T18:06:23.705446Z","shell.execute_reply.started":"2023-01-26T18:06:23.697742Z","shell.execute_reply":"2023-01-26T18:06:23.70443Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_model=rf(n_estimators=100)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:08:37.18112Z","iopub.execute_input":"2023-01-26T18:08:37.181502Z","iopub.status.idle":"2023-01-26T18:08:37.189307Z","shell.execute_reply.started":"2023-01-26T18:08:37.181471Z","shell.execute_reply":"2023-01-26T18:08:37.18841Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# accu_stratified=[]\n# for train_index, test_index in skf.split(trans_df,y.to_array()):\n# #     print(train_index,test_index)\n#     x_train_fold, x_test_fold = trans_df[train_index], trans_df[test_index]\n#     y_train_fold, y_test_fold = y[train_index], y[test_index]\n#     print(x_train_fold)\n# #     rf_model.fit(x_train_fold, y_train_fold)\n# #     accu_stratified.append(rf_model.score(x_test_fold, y_test_fold))\n\n  ","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:38:15.112801Z","iopub.execute_input":"2023-01-26T16:38:15.113198Z","iopub.status.idle":"2023-01-26T16:38:15.11856Z","shell.execute_reply.started":"2023-01-26T16:38:15.113166Z","shell.execute_reply":"2023-01-26T16:38:15.117533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# trans_df.values","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:40:44.174719Z","iopub.execute_input":"2023-01-26T16:40:44.17533Z","iopub.status.idle":"2023-01-26T16:40:44.471779Z","shell.execute_reply.started":"2023-01-26T16:40:44.175291Z","shell.execute_reply":"2023-01-26T16:40:44.470792Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train,X_test,y_train,y_test=train_test_split(trans_df.values,y.to_array(),stratify=y.to_array())","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:08:41.801375Z","iopub.execute_input":"2023-01-26T18:08:41.801752Z","iopub.status.idle":"2023-01-26T18:08:41.861224Z","shell.execute_reply.started":"2023-01-26T18:08:41.801719Z","shell.execute_reply":"2023-01-26T18:08:41.860341Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_model.fit(X_train,y_train)\n# y_pred=rf_model.predict(X_test)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:09:35.183217Z","iopub.execute_input":"2023-01-26T18:09:35.183604Z","iopub.status.idle":"2023-01-26T18:09:36.608265Z","shell.execute_reply.started":"2023-01-26T18:09:35.183555Z","shell.execute_reply":"2023-01-26T18:09:36.607543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred_new=y_pred.astype('int')","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:44:18.679232Z","iopub.execute_input":"2023-01-26T17:44:18.67963Z","iopub.status.idle":"2023-01-26T17:44:18.684728Z","shell.execute_reply.started":"2023-01-26T17:44:18.679587Z","shell.execute_reply":"2023-01-26T17:44:18.683639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred_new.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:44:20.872172Z","iopub.execute_input":"2023-01-26T17:44:20.872869Z","iopub.status.idle":"2023-01-26T17:44:20.878748Z","shell.execute_reply.started":"2023-01-26T17:44:20.872832Z","shell.execute_reply":"2023-01-26T17:44:20.877782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(y_pred_new.get()).value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:44:23.852104Z","iopub.execute_input":"2023-01-26T17:44:23.852458Z","iopub.status.idle":"2023-01-26T17:44:23.862202Z","shell.execute_reply.started":"2023-01-26T17:44:23.852426Z","shell.execute_reply":"2023-01-26T17:44:23.861159Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(y_train).value_counts()\n","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:53:00.616704Z","iopub.execute_input":"2023-01-26T16:53:00.617091Z","iopub.status.idle":"2023-01-26T16:53:00.626723Z","shell.execute_reply.started":"2023-01-26T16:53:00.617058Z","shell.execute_reply":"2023-01-26T16:53:00.625686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(y_test).value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:51:45.491921Z","iopub.execute_input":"2023-01-26T16:51:45.492306Z","iopub.status.idle":"2023-01-26T16:51:45.500629Z","shell.execute_reply.started":"2023-01-26T16:51:45.492276Z","shell.execute_reply":"2023-01-26T16:51:45.499538Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_test.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-26T16:43:51.017173Z","iopub.execute_input":"2023-01-26T16:43:51.017876Z","iopub.status.idle":"2023-01-26T16:43:51.025309Z","shell.execute_reply.started":"2023-01-26T16:43:51.01784Z","shell.execute_reply":"2023-01-26T16:43:51.024229Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf_model.score(X_test,y_test)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:09:51.418181Z","iopub.execute_input":"2023-01-26T18:09:51.418547Z","iopub.status.idle":"2023-01-26T18:09:51.912154Z","shell.execute_reply.started":"2023-01-26T18:09:51.418516Z","shell.execute_reply":"2023-01-26T18:09:51.910815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df_test.values","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:44:35.572978Z","iopub.execute_input":"2023-01-26T17:44:35.573983Z","iopub.status.idle":"2023-01-26T17:44:35.64548Z","shell.execute_reply.started":"2023-01-26T17:44:35.573946Z","shell.execute_reply":"2023-01-26T17:44:35.644431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:18:12.077325Z","iopub.execute_input":"2023-01-26T17:18:12.077723Z","iopub.status.idle":"2023-01-26T17:18:12.098157Z","shell.execute_reply.started":"2023-01-26T17:18:12.07769Z","shell.execute_reply":"2023-01-26T17:18:12.097265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_test_pred=rf_model.predict(trans_df_test)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:10:49.16017Z","iopub.execute_input":"2023-01-26T18:10:49.160532Z","iopub.status.idle":"2023-01-26T18:10:49.71639Z","shell.execute_reply.started":"2023-01-26T18:10:49.160498Z","shell.execute_reply":"2023-01-26T18:10:49.715403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"type(y_test_pred)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:46:34.662472Z","iopub.execute_input":"2023-01-26T17:46:34.662863Z","iopub.status.idle":"2023-01-26T17:46:34.669088Z","shell.execute_reply.started":"2023-01-26T17:46:34.66283Z","shell.execute_reply":"2023-01-26T17:46:34.668064Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_test_pred.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:10:56.206429Z","iopub.execute_input":"2023-01-26T18:10:56.207495Z","iopub.status.idle":"2023-01-26T18:10:56.233158Z","shell.execute_reply.started":"2023-01-26T18:10:56.20745Z","shell.execute_reply":"2023-01-26T18:10:56.232137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub1=pd.DataFrame()","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:11:14.709669Z","iopub.execute_input":"2023-01-26T18:11:14.710031Z","iopub.status.idle":"2023-01-26T18:11:14.717258Z","shell.execute_reply.started":"2023-01-26T18:11:14.710002Z","shell.execute_reply":"2023-01-26T18:11:14.716244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"'ucs654-'+str(1)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:32:09.573144Z","iopub.execute_input":"2023-01-26T17:32:09.573507Z","iopub.status.idle":"2023-01-26T17:32:09.579554Z","shell.execute_reply.started":"2023-01-26T17:32:09.573475Z","shell.execute_reply":"2023-01-26T17:32:09.578365Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"id=[]\nfor i in range(1,50001):\n    id.append('ucs654-'+str(i))","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:33:24.756559Z","iopub.execute_input":"2023-01-26T17:33:24.75694Z","iopub.status.idle":"2023-01-26T17:33:24.783123Z","shell.execute_reply.started":"2023-01-26T17:33:24.75691Z","shell.execute_reply":"2023-01-26T17:33:24.782266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"id","metadata":{"execution":{"iopub.status.busy":"2023-01-26T17:33:28.120391Z","iopub.execute_input":"2023-01-26T17:33:28.120769Z","iopub.status.idle":"2023-01-26T17:33:28.144112Z","shell.execute_reply.started":"2023-01-26T17:33:28.120737Z","shell.execute_reply":"2023-01-26T17:33:28.143062Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub1['id']=id","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:11:21.580141Z","iopub.execute_input":"2023-01-26T18:11:21.58049Z","iopub.status.idle":"2023-01-26T18:11:21.594717Z","shell.execute_reply.started":"2023-01-26T18:11:21.58046Z","shell.execute_reply":"2023-01-26T18:11:21.593839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub1['target']=y_test_pred.to_array().astype('int')","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:11:22.867688Z","iopub.execute_input":"2023-01-26T18:11:22.86801Z","iopub.status.idle":"2023-01-26T18:11:22.875999Z","shell.execute_reply.started":"2023-01-26T18:11:22.867982Z","shell.execute_reply":"2023-01-26T18:11:22.875108Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub1","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:11:24.524365Z","iopub.execute_input":"2023-01-26T18:11:24.524748Z","iopub.status.idle":"2023-01-26T18:11:24.538258Z","shell.execute_reply.started":"2023-01-26T18:11:24.524714Z","shell.execute_reply":"2023-01-26T18:11:24.537232Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub1.to_csv(\"submission1.csv\",index=False)","metadata":{"execution":{"iopub.status.busy":"2023-01-26T18:11:33.014117Z","iopub.execute_input":"2023-01-26T18:11:33.014488Z","iopub.status.idle":"2023-01-26T18:11:33.07128Z","shell.execute_reply.started":"2023-01-26T18:11:33.014457Z","shell.execute_reply":"2023-01-26T18:11:33.070348Z"},"trusted":true},"execution_count":null,"outputs":[]}]}