{"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":"conda install -c conda-forge lightgbm","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:27:53.023154Z","iopub.execute_input":"2022-10-14T02:27:53.023658Z","iopub.status.idle":"2022-10-14T02:29:03.145332Z","shell.execute_reply.started":"2022-10-14T02:27:53.023564Z","shell.execute_reply":"2022-10-14T02:29:03.143330Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport seaborn as sns\nimport os\nfor dirname, _,filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname,filename))\n        \n\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:03.150550Z","iopub.execute_input":"2022-10-14T02:29:03.150980Z","iopub.status.idle":"2022-10-14T02:29:05.066517Z","shell.execute_reply.started":"2022-10-14T02:29:03.150925Z","shell.execute_reply":"2022-10-14T02:29:05.065417Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install --upgrade kaggle","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:05.067838Z","iopub.execute_input":"2022-10-14T02:29:05.068185Z","iopub.status.idle":"2022-10-14T02:29:17.251824Z","shell.execute_reply.started":"2022-10-14T02:29:05.068153Z","shell.execute_reply":"2022-10-14T02:29:17.250455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nos.listdir('/kaggle/input/')","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.254717Z","iopub.execute_input":"2022-10-14T02:29:17.255600Z","iopub.status.idle":"2022-10-14T02:29:17.265896Z","shell.execute_reply.started":"2022-10-14T02:29:17.255556Z","shell.execute_reply":"2022-10-14T02:29:17.264504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=pd.read_csv('../input/smartphone-decimeter-2022/sample_submission.csv')\n\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.267871Z","iopub.execute_input":"2022-10-14T02:29:17.268364Z","iopub.status.idle":"2022-10-14T02:29:17.405361Z","shell.execute_reply.started":"2022-10-14T02:29:17.268320Z","shell.execute_reply":"2022-10-14T02:29:17.404316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.409343Z","iopub.execute_input":"2022-10-14T02:29:17.410184Z","iopub.status.idle":"2022-10-14T02:29:17.431638Z","shell.execute_reply.started":"2022-10-14T02:29:17.410136Z","shell.execute_reply":"2022-10-14T02:29:17.430400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.DataFrame(data)\nprint(df)","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.433182Z","iopub.execute_input":"2022-10-14T02:29:17.434098Z","iopub.status.idle":"2022-10-14T02:29:17.446118Z","shell.execute_reply.started":"2022-10-14T02:29:17.434050Z","shell.execute_reply":"2022-10-14T02:29:17.444600Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":" X=df.iloc[:,[2,3]].values\nprint(X)","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.447779Z","iopub.execute_input":"2022-10-14T02:29:17.448278Z","iopub.status.idle":"2022-10-14T02:29:17.461747Z","shell.execute_reply.started":"2022-10-14T02:29:17.448232Z","shell.execute_reply":"2022-10-14T02:29:17.460641Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=df.iloc[:,0:4].values\nprint(y)","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.463689Z","iopub.execute_input":"2022-10-14T02:29:17.464786Z","iopub.status.idle":"2022-10-14T02:29:17.487590Z","shell.execute_reply.started":"2022-10-14T02:29:17.464739Z","shell.execute_reply":"2022-10-14T02:29:17.486767Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn import datasets,linear_model\nfrom sklearn.model_selection import train_test_split\nx_train,x_test,y_train,y_test=train_test_split(X,y,test_size=0.25,random_state=0)\n\nfrom sklearn.preprocessing import StandardScaler\nsc=StandardScaler()\nx_train=sc.fit_transform(x_train)\nx_test=sc.transform(x_test)\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.490577Z","iopub.execute_input":"2022-10-14T02:29:17.491070Z","iopub.status.idle":"2022-10-14T02:29:17.756318Z","shell.execute_reply.started":"2022-10-14T02:29:17.491029Z","shell.execute_reply":"2022-10-14T02:29:17.755137Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import lightgbm as lgb\nfrom lightgbm import LGBMClassifier\nd_train=lgb.Dataset(x_train,label=y_train)\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:17.757694Z","iopub.execute_input":"2022-10-14T02:29:17.758089Z","iopub.status.idle":"2022-10-14T02:29:18.555115Z","shell.execute_reply.started":"2022-10-14T02:29:17.758055Z","shell.execute_reply":"2022-10-14T02:29:18.554132Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"params={}\nparams['learning_rate']=0.003\nparams['boosting_type']='gbdt'\nparams['objective']='binary'\nparams['metric']='binary_logloss'\nparams['sub_feature']=0.5\nparams['num_leaves']=10\nparams['min_data']=50\nparams['max_depth']=10\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:29:18.556271Z","iopub.execute_input":"2022-10-14T02:29:18.556589Z","iopub.status.idle":"2022-10-14T02:29:18.562666Z","shell.execute_reply.started":"2022-10-14T02:29:18.556559Z","shell.execute_reply":"2022-10-14T02:29:18.561651Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"clf=lgb.train(params,d_train,100)","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:30:04.675954Z","iopub.execute_input":"2022-10-14T02:30:04.676484Z","iopub.status.idle":"2022-10-14T02:30:04.700949Z","shell.execute_reply.started":"2022-10-14T02:30:04.676444Z","shell.execute_reply":"2022-10-14T02:30:04.699332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred=clf.predict(x_test)\nfor i in range(0,100):\n    if(y_pred[i]>=0.5):\n        y_pred[i]=1\n    else:\n        y_pred[i]=0\nlen(y_pred)\n","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:30:11.402944Z","iopub.execute_input":"2022-10-14T02:30:11.404383Z","iopub.status.idle":"2022-10-14T02:30:11.416998Z","shell.execute_reply.started":"2022-10-14T02:30:11.404320Z","shell.execute_reply":"2022-10-14T02:30:11.415252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import accuracy_score\naccuracy=accuracy_score(y_pred,y_test)\nprint(accuracy)","metadata":{"execution":{"iopub.status.busy":"2022-10-14T02:30:14.424748Z","iopub.execute_input":"2022-10-14T02:30:14.425177Z","iopub.status.idle":"2022-10-14T02:30:14.479541Z","shell.execute_reply.started":"2022-10-14T02:30:14.425142Z","shell.execute_reply":"2022-10-14T02:30:14.477789Z"},"trusted":true},"execution_count":null,"outputs":[]}]}