{"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\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:09.245464Z","iopub.execute_input":"2022-08-01T12:19:09.245862Z","iopub.status.idle":"2022-08-01T12:19:09.251243Z","shell.execute_reply.started":"2022-08-01T12:19:09.245830Z","shell.execute_reply":"2022-08-01T12:19:09.250003Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.read_csv(\"../input/house-prices-advanced-regression-techniques/train.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:09.461307Z","iopub.execute_input":"2022-08-01T12:19:09.461667Z","iopub.status.idle":"2022-08-01T12:19:09.493729Z","shell.execute_reply.started":"2022-08-01T12:19:09.461638Z","shell.execute_reply":"2022-08-01T12:19:09.492612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:09.678464Z","iopub.execute_input":"2022-08-01T12:19:09.678848Z","iopub.status.idle":"2022-08-01T12:19:09.685436Z","shell.execute_reply.started":"2022-08-01T12:19:09.678814Z","shell.execute_reply":"2022-08-01T12:19:09.684278Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:09.866219Z","iopub.execute_input":"2022-08-01T12:19:09.866614Z","iopub.status.idle":"2022-08-01T12:19:09.891963Z","shell.execute_reply.started":"2022-08-01T12:19:09.866582Z","shell.execute_reply":"2022-08-01T12:19:09.890861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric = df.select_dtypes(include=['int64','float64'])","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:10.153258Z","iopub.execute_input":"2022-08-01T12:19:10.153648Z","iopub.status.idle":"2022-08-01T12:19:10.160639Z","shell.execute_reply.started":"2022-08-01T12:19:10.153615Z","shell.execute_reply":"2022-08-01T12:19:10.159500Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:10.420264Z","iopub.execute_input":"2022-08-01T12:19:10.420639Z","iopub.status.idle":"2022-08-01T12:19:10.427561Z","shell.execute_reply.started":"2022-08-01T12:19:10.420611Z","shell.execute_reply":"2022-08-01T12:19:10.426535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:10.593230Z","iopub.execute_input":"2022-08-01T12:19:10.594151Z","iopub.status.idle":"2022-08-01T12:19:10.610242Z","shell.execute_reply.started":"2022-08-01T12:19:10.594117Z","shell.execute_reply":"2022-08-01T12:19:10.609415Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:10.767282Z","iopub.execute_input":"2022-08-01T12:19:10.767855Z","iopub.status.idle":"2022-08-01T12:19:10.777599Z","shell.execute_reply.started":"2022-08-01T12:19:10.767825Z","shell.execute_reply":"2022-08-01T12:19:10.776402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.isnull().sum().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:10.935224Z","iopub.execute_input":"2022-08-01T12:19:10.935633Z","iopub.status.idle":"2022-08-01T12:19:10.943994Z","shell.execute_reply.started":"2022-08-01T12:19:10.935601Z","shell.execute_reply":"2022-08-01T12:19:10.942866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.dropna(inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:11.183574Z","iopub.execute_input":"2022-08-01T12:19:11.184385Z","iopub.status.idle":"2022-08-01T12:19:11.193343Z","shell.execute_reply.started":"2022-08-01T12:19:11.184349Z","shell.execute_reply":"2022-08-01T12:19:11.192160Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:11.421890Z","iopub.execute_input":"2022-08-01T12:19:11.422563Z","iopub.status.idle":"2022-08-01T12:19:11.437424Z","shell.execute_reply.started":"2022-08-01T12:19:11.422525Z","shell.execute_reply":"2022-08-01T12:19:11.436621Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.drop(columns=[\"Id\"],axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:11.627151Z","iopub.execute_input":"2022-08-01T12:19:11.627561Z","iopub.status.idle":"2022-08-01T12:19:11.658428Z","shell.execute_reply.started":"2022-08-01T12:19:11.627528Z","shell.execute_reply":"2022-08-01T12:19:11.657512Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_numeric.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:11.858748Z","iopub.execute_input":"2022-08-01T12:19:11.859344Z","iopub.status.idle":"2022-08-01T12:19:11.865356Z","shell.execute_reply.started":"2022-08-01T12:19:11.859311Z","shell.execute_reply":"2022-08-01T12:19:11.864409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x = df_numeric.iloc[:,0:-1].values\n\n\ny = df_numeric.iloc[:,-1:].values","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.005883Z","iopub.execute_input":"2022-08-01T12:19:12.006304Z","iopub.status.idle":"2022-08-01T12:19:12.013244Z","shell.execute_reply.started":"2022-08-01T12:19:12.006268Z","shell.execute_reply":"2022-08-01T12:19:12.011956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.183779Z","iopub.execute_input":"2022-08-01T12:19:12.184172Z","iopub.status.idle":"2022-08-01T12:19:12.190833Z","shell.execute_reply.started":"2022-08-01T12:19:12.184139Z","shell.execute_reply":"2022-08-01T12:19:12.189836Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import SGDRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.datasets import make_regression\n","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.349054Z","iopub.execute_input":"2022-08-01T12:19:12.350217Z","iopub.status.idle":"2022-08-01T12:19:12.355132Z","shell.execute_reply.started":"2022-08-01T12:19:12.350163Z","shell.execute_reply":"2022-08-01T12:19:12.354154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"scaler = StandardScaler()\nX_norm = scaler.fit_transform(x)\n","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.512623Z","iopub.execute_input":"2022-08-01T12:19:12.513692Z","iopub.status.idle":"2022-08-01T12:19:12.520183Z","shell.execute_reply.started":"2022-08-01T12:19:12.513639Z","shell.execute_reply":"2022-08-01T12:19:12.519377Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf=RandomForestRegressor()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.676909Z","iopub.execute_input":"2022-08-01T12:19:12.677314Z","iopub.status.idle":"2022-08-01T12:19:12.682342Z","shell.execute_reply.started":"2022-08-01T12:19:12.677280Z","shell.execute_reply":"2022-08-01T12:19:12.681143Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rf.fit(X_norm,y)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:12.880818Z","iopub.execute_input":"2022-08-01T12:19:12.881815Z","iopub.status.idle":"2022-08-01T12:19:14.125837Z","shell.execute_reply.started":"2022-08-01T12:19:12.881768Z","shell.execute_reply":"2022-08-01T12:19:14.124678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test=pd.read_csv(\"../input/house-prices-advanced-regression-techniques/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.128088Z","iopub.execute_input":"2022-08-01T12:19:14.128781Z","iopub.status.idle":"2022-08-01T12:19:14.158103Z","shell.execute_reply.started":"2022-08-01T12:19:14.128739Z","shell.execute_reply":"2022-08-01T12:19:14.157182Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_numeric = df_test.select_dtypes(include=['int64','float64'])","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.159333Z","iopub.execute_input":"2022-08-01T12:19:14.159632Z","iopub.status.idle":"2022-08-01T12:19:14.166495Z","shell.execute_reply.started":"2022-08-01T12:19:14.159605Z","shell.execute_reply":"2022-08-01T12:19:14.165264Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_numeric.dropna(inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.169414Z","iopub.execute_input":"2022-08-01T12:19:14.170526Z","iopub.status.idle":"2022-08-01T12:19:14.182143Z","shell.execute_reply.started":"2022-08-01T12:19:14.170362Z","shell.execute_reply":"2022-08-01T12:19:14.180600Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_numeric.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:41:02.030588Z","iopub.execute_input":"2022-08-01T12:41:02.030957Z","iopub.status.idle":"2022-08-01T12:41:02.037108Z","shell.execute_reply.started":"2022-08-01T12:41:02.030928Z","shell.execute_reply":"2022-08-01T12:41:02.036344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i=test_numeric[\"Id\"]","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:41:29.547703Z","iopub.execute_input":"2022-08-01T12:41:29.548734Z","iopub.status.idle":"2022-08-01T12:41:29.552994Z","shell.execute_reply.started":"2022-08-01T12:41:29.548698Z","shell.execute_reply":"2022-08-01T12:41:29.552149Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:41:37.445275Z","iopub.execute_input":"2022-08-01T12:41:37.446022Z","iopub.status.idle":"2022-08-01T12:41:37.452079Z","shell.execute_reply.started":"2022-08-01T12:41:37.445985Z","shell.execute_reply":"2022-08-01T12:41:37.451260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_numeric.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.183785Z","iopub.execute_input":"2022-08-01T12:19:14.184364Z","iopub.status.idle":"2022-08-01T12:19:14.199952Z","shell.execute_reply.started":"2022-08-01T12:19:14.184331Z","shell.execute_reply":"2022-08-01T12:19:14.199006Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_numeric[\"Id\"]","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.201347Z","iopub.execute_input":"2022-08-01T12:19:14.201874Z","iopub.status.idle":"2022-08-01T12:19:14.209957Z","shell.execute_reply.started":"2022-08-01T12:19:14.201840Z","shell.execute_reply":"2022-08-01T12:19:14.208859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_test = test_numeric.iloc[:].values","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.211151Z","iopub.execute_input":"2022-08-01T12:19:14.211700Z","iopub.status.idle":"2022-08-01T12:19:14.220191Z","shell.execute_reply.started":"2022-08-01T12:19:14.211667Z","shell.execute_reply":"2022-08-01T12:19:14.219083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_test.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:20:57.550063Z","iopub.execute_input":"2022-08-01T12:20:57.550451Z","iopub.status.idle":"2022-08-01T12:20:57.556823Z","shell.execute_reply.started":"2022-08-01T12:20:57.550420Z","shell.execute_reply":"2022-08-01T12:20:57.555888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"scaler = StandardScaler()\nXt_norm = scaler.fit_transform(x_test)\n","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:19:14.221383Z","iopub.execute_input":"2022-08-01T12:19:14.222338Z","iopub.status.idle":"2022-08-01T12:19:14.232708Z","shell.execute_reply.started":"2022-08-01T12:19:14.222302Z","shell.execute_reply":"2022-08-01T12:19:14.231673Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Xt_norm.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:21:13.255293Z","iopub.execute_input":"2022-08-01T12:21:13.256091Z","iopub.status.idle":"2022-08-01T12:21:13.262302Z","shell.execute_reply.started":"2022-08-01T12:21:13.256059Z","shell.execute_reply":"2022-08-01T12:21:13.261174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred = rf.predict(Xt_norm)","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:51:40.283595Z","iopub.execute_input":"2022-08-01T12:51:40.284313Z","iopub.status.idle":"2022-08-01T12:51:40.322000Z","shell.execute_reply.started":"2022-08-01T12:51:40.284279Z","shell.execute_reply":"2022-08-01T12:51:40.321217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:51:48.267785Z","iopub.execute_input":"2022-08-01T12:51:48.268569Z","iopub.status.idle":"2022-08-01T12:51:48.274347Z","shell.execute_reply.started":"2022-08-01T12:51:48.268537Z","shell.execute_reply":"2022-08-01T12:51:48.273534Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"i.shape","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:51:57.694516Z","iopub.execute_input":"2022-08-01T12:51:57.695694Z","iopub.status.idle":"2022-08-01T12:51:57.701650Z","shell.execute_reply.started":"2022-08-01T12:51:57.695654Z","shell.execute_reply":"2022-08-01T12:51:57.700679Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_new = pd.DataFrame({'ID':i,'Predicted Output':y_pred}) ","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:52:25.714747Z","iopub.execute_input":"2022-08-01T12:52:25.715771Z","iopub.status.idle":"2022-08-01T12:52:25.721559Z","shell.execute_reply.started":"2022-08-01T12:52:25.715725Z","shell.execute_reply":"2022-08-01T12:52:25.720828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_new","metadata":{"execution":{"iopub.status.busy":"2022-08-01T12:52:34.009868Z","iopub.execute_input":"2022-08-01T12:52:34.010270Z","iopub.status.idle":"2022-08-01T12:52:34.024387Z","shell.execute_reply.started":"2022-08-01T12:52:34.010236Z","shell.execute_reply":"2022-08-01T12:52:34.023063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_new.to_csv('C:\\DL codes\\submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-01T13:00:19.002308Z","iopub.execute_input":"2022-08-01T13:00:19.003079Z","iopub.status.idle":"2022-08-01T13:00:19.014974Z","shell.execute_reply.started":"2022-08-01T13:00:19.003025Z","shell.execute_reply":"2022-08-01T13:00:19.013543Z"},"trusted":true},"execution_count":null,"outputs":[]}]}