{"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":"import pandas as pd","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.61369Z","iopub.execute_input":"2023-01-09T09:16:29.614212Z","iopub.status.idle":"2023-01-09T09:16:29.621037Z","shell.execute_reply.started":"2023-01-09T09:16:29.614164Z","shell.execute_reply":"2023-01-09T09:16:29.619633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv('emsi-5iir-ds/train.csv')\ntest = pd.read_csv('emsi-5iir-ds/test.csv')\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.623369Z","iopub.execute_input":"2023-01-09T09:16:29.623835Z","iopub.status.idle":"2023-01-09T09:16:29.717847Z","shell.execute_reply.started":"2023-01-09T09:16:29.623793Z","shell.execute_reply":"2023-01-09T09:16:29.714558Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.718676Z","iopub.status.idle":"2023-01-09T09:16:29.719069Z","shell.execute_reply.started":"2023-01-09T09:16:29.718877Z","shell.execute_reply":"2023-01-09T09:16:29.718895Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.tail()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.720253Z","iopub.status.idle":"2023-01-09T09:16:29.720702Z","shell.execute_reply.started":"2023-01-09T09:16:29.720455Z","shell.execute_reply":"2023-01-09T09:16:29.720474Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.corr()","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.721783Z","iopub.status.idle":"2023-01-09T09:16:29.722163Z","shell.execute_reply.started":"2023-01-09T09:16:29.721966Z","shell.execute_reply":"2023-01-09T09:16:29.721984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots(figsize=(15,15))\nsns.heatmap(train.corr(), vmin=-1, vmax=1, cmap='coolwarm', linewidths=4)","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.724795Z","iopub.status.idle":"2023-01-09T09:16:29.727048Z","shell.execute_reply.started":"2023-01-09T09:16:29.726808Z","shell.execute_reply":"2023-01-09T09:16:29.726833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = train.drop(['id','f_27'], axis=1)\ntest = test.drop(['f_27'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.728413Z","iopub.status.idle":"2023-01-09T09:16:29.728992Z","shell.execute_reply.started":"2023-01-09T09:16:29.728669Z","shell.execute_reply":"2023-01-09T09:16:29.72869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(train[100000:500000:2])","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.730621Z","iopub.status.idle":"2023-01-09T09:16:29.731023Z","shell.execute_reply.started":"2023-01-09T09:16:29.730816Z","shell.execute_reply":"2023-01-09T09:16:29.730835Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a, b, c, x = 1, 2, 3, 4\nprint(a)","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.732109Z","iopub.status.idle":"2023-01-09T09:16:29.73251Z","shell.execute_reply.started":"2023-01-09T09:16:29.732298Z","shell.execute_reply":"2023-01-09T09:16:29.732317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import MinMaxScaler\nscaler = MinMaxScaler()\n \nx = train.drop('target', axis=1)\ny = train['target']\n\nx = scaler.fit_transform(x)\nx_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.2, random_state = 40)","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.734549Z","iopub.status.idle":"2023-01-09T09:16:29.735348Z","shell.execute_reply.started":"2023-01-09T09:16:29.735091Z","shell.execute_reply":"2023-01-09T09:16:29.735127Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(x_train))\nprint(len(x_test))\n\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.737471Z","iopub.status.idle":"2023-01-09T09:16:29.73791Z","shell.execute_reply.started":"2023-01-09T09:16:29.737715Z","shell.execute_reply":"2023-01-09T09:16:29.737734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.naive_bayes import GaussianNB\n\nmodel= GaussianNB()\nmodel.fit(x_train, y_train)\n\nacc = model.score(x_test, y_test)\nprint(f'accuracy: {acc*100:.2f}%')\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.739808Z","iopub.status.idle":"2023-01-09T09:16:29.740191Z","shell.execute_reply.started":"2023-01-09T09:16:29.740002Z","shell.execute_reply":"2023-01-09T09:16:29.740021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression\nlr= LogisticRegression()\nlr.fit(x_train, y_train)\nacc = lr.score(x_test, y_test)\nprint(f'accuracy: {acc*100}%')","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:29.741834Z","iopub.status.idle":"2023-01-09T09:16:29.74229Z","shell.execute_reply.started":"2023-01-09T09:16:29.74204Z","shell.execute_reply":"2023-01-09T09:16:29.742058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import RandomForestClassifier\nrfc=RandomForestClassifier()\nrfc.fit(x_train, y_train)\nacc = rfc.score(x_test, y_test)\nprint(f'accuracy: {acc*100}%')\n","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:30.967941Z","iopub.execute_input":"2023-01-09T09:16:30.968706Z","iopub.status.idle":"2023-01-09T09:16:32.478536Z","shell.execute_reply.started":"2023-01-09T09:16:30.968668Z","shell.execute_reply":"2023-01-09T09:16:32.477077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from lightgbm import LGBMClassifier\n\nlgbm = LGBMClassifier(n_estimators=10000)\nlgbm.fit(x_train, y_train)\n\nacc = lgbm.score(x_test, y_test)\nprint(f'accuracy: {acc*100}%')\n\npredictions = lgbm.predict(scaler.transform(test.drop('id', axis=1)))\nsubmitions = pd.DataFrame()\nsubmitions['id'] = test.id\nsubmitions['target']=predictions.astype(int)\nsubmitions = submitions.reset_index(drop=True)\nsubmitions.to_csv('my submitions.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-01-09T09:16:32.479797Z","iopub.status.idle":"2023-01-09T09:16:32.480528Z","shell.execute_reply.started":"2023-01-09T09:16:32.480276Z","shell.execute_reply":"2023-01-09T09:16:32.480298Z"},"trusted":true},"execution_count":null,"outputs":[]}]}