{"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":"2022-07-05T00:28:26.609468Z","iopub.execute_input":"2022-07-05T00:28:26.610204Z","iopub.status.idle":"2022-07-05T00:28:26.628760Z","shell.execute_reply.started":"2022-07-05T00:28:26.610133Z","shell.execute_reply":"2022-07-05T00:28:26.627557Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom scipy.stats import shapiro\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.preprocessing import LabelEncoder\nfrom sklearn.preprocessing import OneHotEncoder\nfrom sklearn.model_selection import train_test_split\nfrom statsmodels.stats.outliers_influence import variance_inflation_factor","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:26.634377Z","iopub.execute_input":"2022-07-05T00:28:26.635114Z","iopub.status.idle":"2022-07-05T00:28:27.172180Z","shell.execute_reply.started":"2022-07-05T00:28:26.635079Z","shell.execute_reply":"2022-07-05T00:28:27.170922Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = pd.read_csv(\"../input/house-prices-advanced-regression-techniques/train.csv\")\ntest_data = pd.read_csv(\"../input/house-prices-advanced-regression-techniques/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.173899Z","iopub.execute_input":"2022-07-05T00:28:27.174360Z","iopub.status.idle":"2022-07-05T00:28:27.229586Z","shell.execute_reply.started":"2022-07-05T00:28:27.174315Z","shell.execute_reply":"2022-07-05T00:28:27.228553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.232305Z","iopub.execute_input":"2022-07-05T00:28:27.233158Z","iopub.status.idle":"2022-07-05T00:28:27.263319Z","shell.execute_reply.started":"2022-07-05T00:28:27.233113Z","shell.execute_reply":"2022-07-05T00:28:27.262157Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"null_values=data.isnull().sum().reset_index().rename(columns={0:'null_col'})\nnull_values[null_values['null_col']>0].sort_values(by=['null_col'],ascending=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.264394Z","iopub.execute_input":"2022-07-05T00:28:27.265108Z","iopub.status.idle":"2022-07-05T00:28:27.290320Z","shell.execute_reply.started":"2022-07-05T00:28:27.265072Z","shell.execute_reply":"2022-07-05T00:28:27.288736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"null_values=test_data.isnull().sum().reset_index().rename(columns={0:'null_col'})\nnull_values[null_values['null_col']>0].sort_values(by=['null_col'],ascending=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.291780Z","iopub.execute_input":"2022-07-05T00:28:27.292997Z","iopub.status.idle":"2022-07-05T00:28:27.319623Z","shell.execute_reply.started":"2022-07-05T00:28:27.292946Z","shell.execute_reply":"2022-07-05T00:28:27.318489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=data.drop(columns=['PoolQC','MiscFeature','Alley','Fence','FireplaceQu'])\ntest_data=test_data.drop(columns=['PoolQC','MiscFeature','Alley','Fence','FireplaceQu'])","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.321079Z","iopub.execute_input":"2022-07-05T00:28:27.322118Z","iopub.status.idle":"2022-07-05T00:28:27.331748Z","shell.execute_reply.started":"2022-07-05T00:28:27.322071Z","shell.execute_reply":"2022-07-05T00:28:27.330912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data['LotFrontage']= data['LotFrontage'].fillna(data['LotFrontage'].median())\ndata['GarageYrBlt']= data['GarageYrBlt'].fillna(data['GarageYrBlt'].median())\ndata['MasVnrArea']= data['MasVnrArea'].fillna(0)\ntest_data['LotFrontage']= test_data['LotFrontage'].fillna(test_data['LotFrontage'].median())\ntest_data['GarageYrBlt']= test_data['GarageYrBlt'].fillna(test_data['GarageYrBlt'].median())\ntest_data['MasVnrArea']= test_data['MasVnrArea'].fillna(0)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.332963Z","iopub.execute_input":"2022-07-05T00:28:27.333838Z","iopub.status.idle":"2022-07-05T00:28:27.349265Z","shell.execute_reply.started":"2022-07-05T00:28:27.333792Z","shell.execute_reply":"2022-07-05T00:28:27.348061Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# data= data.dropna(subset=['GarageType','GarageYrBlt','GarageFinish','GarageQual','GarageCond',\n#                                             'BsmtExposure','BsmtFinType2','BsmtFinType1','BsmtCond','BsmtQual',\n#                                             'MasVnrArea','MasVnrType','Electrical'],axis=0)\ncategoral_mode = ['MSZoning', 'MasVnrType' ,'Electrical', 'SaleType', 'Utilities', 'Exterior1st', 'Exterior2nd', 'KitchenQual', 'Functional']\nfor col in categoral_mode:\n    test_data[col].fillna(test_data[col].mode()[0], inplace=True)\n    data[col].fillna(data[col].mode()[0], inplace=True)\n\n# replace NA with NoB \nno_basement = ['BsmtQual', 'BsmtCond', 'BsmtExposure', 'BsmtFinType1', 'BsmtFinType2']\nfor col in no_basement:\n    test_data[col].fillna('NoB', inplace=True)\n    data[col].fillna('NoB', inplace=True)\n    \n\n# replace NA with NoG:\nno_garage = ['GarageType', 'GarageFinish', 'GarageQual', 'GarageCond']\nfor col in no_garage:\n    test_data[col].fillna('NoG', inplace=True)\n    data[col].fillna('NoG', inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.350799Z","iopub.execute_input":"2022-07-05T00:28:27.351499Z","iopub.status.idle":"2022-07-05T00:28:27.388510Z","shell.execute_reply.started":"2022-07-05T00:28:27.351455Z","shell.execute_reply":"2022-07-05T00:28:27.387183Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"null_values=data.isnull().sum().reset_index().rename(columns={0:'null_col'})\nnull_values[null_values['null_col']>0].sort_values(by=['null_col'],ascending=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.389632Z","iopub.execute_input":"2022-07-05T00:28:27.390448Z","iopub.status.idle":"2022-07-05T00:28:27.412963Z","shell.execute_reply.started":"2022-07-05T00:28:27.390412Z","shell.execute_reply":"2022-07-05T00:28:27.411566Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def drop_redandance(df,num_col):\n    first=df.columns[0]\n    dropped_col=[]\n    for col in num_col:\n        if df.groupby(col)['Id'].count().reset_index().sort_values(by=['Id'],ascending=False).iloc[0,1]>(df.shape[0]*0.8):\n                dropped_col.append(col)\n    return df.drop(columns=dropped_col),dropped_col","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.414380Z","iopub.execute_input":"2022-07-05T00:28:27.414735Z","iopub.status.idle":"2022-07-05T00:28:27.422057Z","shell.execute_reply.started":"2022-07-05T00:28:27.414702Z","shell.execute_reply":"2022-07-05T00:28:27.420918Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data,dropped= drop_redandance(data,list(set(data.describe().columns)-set(['Id','SalePrice'])))\ndropped","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.423184Z","iopub.execute_input":"2022-07-05T00:28:27.424002Z","iopub.status.idle":"2022-07-05T00:28:27.589255Z","shell.execute_reply.started":"2022-07-05T00:28:27.423966Z","shell.execute_reply":"2022-07-05T00:28:27.587947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data=test_data.drop(columns=dropped)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.594146Z","iopub.execute_input":"2022-07-05T00:28:27.594563Z","iopub.status.idle":"2022-07-05T00:28:27.602207Z","shell.execute_reply.started":"2022-07-05T00:28:27.594529Z","shell.execute_reply":"2022-07-05T00:28:27.600965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_cols=list(set(data.describe().columns)-set(['Id']))\nfeatures_to_drop=[]\nnum_cols_without_response=list(set(num_cols)-set(['SalePrice']))\ncorr_mat=data[set(num_cols)-set(['SalePrice'])].corr()\nfor row in range(corr_mat.shape[0]):\n    for col in range(row+1,corr_mat.shape[0]):\n        if np.abs(corr_mat.values[row,col])>0.7:\n            var_row_corr_wth_response = np.abs(np.corrcoef(data['SalePrice'], \n                                                        data[num_cols_without_response[row]])[0, 1])\n            var_col_corr_wth_response = np.abs(np.corrcoef(data['SalePrice'], \n                                                        data[num_cols_without_response[col]])[0, 1])\n            if var_row_corr_wth_response > var_col_corr_wth_response:\n                        features_to_drop.append(num_cols_without_response[col])\n            else:\n                        features_to_drop.append(num_cols_without_response[row])\ndata=data.drop(columns=features_to_drop)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.603638Z","iopub.execute_input":"2022-07-05T00:28:27.604522Z","iopub.status.idle":"2022-07-05T00:28:27.688970Z","shell.execute_reply.started":"2022-07-05T00:28:27.604471Z","shell.execute_reply":"2022-07-05T00:28:27.687654Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"features_to_drop","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.690301Z","iopub.execute_input":"2022-07-05T00:28:27.690672Z","iopub.status.idle":"2022-07-05T00:28:27.697526Z","shell.execute_reply.started":"2022-07-05T00:28:27.690634Z","shell.execute_reply":"2022-07-05T00:28:27.696684Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data= test_data.drop(columns=features_to_drop)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.698689Z","iopub.execute_input":"2022-07-05T00:28:27.699196Z","iopub.status.idle":"2022-07-05T00:28:27.710053Z","shell.execute_reply.started":"2022-07-05T00:28:27.699163Z","shell.execute_reply":"2022-07-05T00:28:27.709013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train=data['SalePrice']\ndata=data.drop(columns=['SalePrice'])","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.711793Z","iopub.execute_input":"2022-07-05T00:28:27.712211Z","iopub.status.idle":"2022-07-05T00:28:27.723280Z","shell.execute_reply.started":"2022-07-05T00:28:27.712174Z","shell.execute_reply":"2022-07-05T00:28:27.722069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_cols= list(set(data.describe().columns)-set(['Id','SalePrice']))\ndef skewness(df,num_cols):\n    N=df.shape[0]\n    Zs= (df[num_cols]-df[num_cols].mean())/df[num_cols].std()\n    skewness=(Zs**3).sum()/(N-1)\n    return skewness\ndef log_transformation(df,num_cols):\n    skewness_coff=skewness(df,num_cols)\n    i=0\n    for col in num_cols:\n        if abs(skewness_coff[i])>1:\n            df[col]=np.log(np.abs(df[col]+1))\n        i+=1\n    return df","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.724411Z","iopub.execute_input":"2022-07-05T00:28:27.725136Z","iopub.status.idle":"2022-07-05T00:28:27.786197Z","shell.execute_reply.started":"2022-07-05T00:28:27.725099Z","shell.execute_reply":"2022-07-05T00:28:27.785002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"skew=skewness(data,num_cols)\ndata=log_transformation(data,num_cols)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.787608Z","iopub.execute_input":"2022-07-05T00:28:27.787999Z","iopub.status.idle":"2022-07-05T00:28:27.825716Z","shell.execute_reply.started":"2022-07-05T00:28:27.787963Z","shell.execute_reply":"2022-07-05T00:28:27.824532Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def log_transformation_for_test(df,num_cols,skewness_coff):\n    i=0\n    for col in num_cols:\n        if abs(skewness_coff[i])>1:\n            df[col]=np.log(np.abs(df[col]+1))\n        i+=1\n    return df\nnumcols= list(set(test_data.describe().columns)-set(['Id']))\ntest_data=log_transformation_for_test(test_data,numcols,skew)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.827100Z","iopub.execute_input":"2022-07-05T00:28:27.828087Z","iopub.status.idle":"2022-07-05T00:28:27.893169Z","shell.execute_reply.started":"2022-07-05T00:28:27.828052Z","shell.execute_reply":"2022-07-05T00:28:27.892296Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def check_normal_dist_shapiro(df,num_cols,alpha = 0.01):\n    feats_std_scale = []\n    feats_min_max_scale = []\n    sample_data  = df.sample(replace = False, n= 500)\n    for col in num_cols:\n        stat, p = shapiro(sample_data[col])\n        if p>alpha:\n            feats_std_scale.append(col)\n        else:\n            feats_min_max_scale.append(col)\n    return feats_min_max_scale,feats_std_scale","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.894281Z","iopub.execute_input":"2022-07-05T00:28:27.895085Z","iopub.status.idle":"2022-07-05T00:28:27.902491Z","shell.execute_reply.started":"2022-07-05T00:28:27.895048Z","shell.execute_reply":"2022-07-05T00:28:27.901375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_cols= list(set(data.describe().columns)-set(['Id','SalePrice']))\nfeats_min_max_scale,feats_std_scale=check_normal_dist_shapiro(data,num_cols)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.904010Z","iopub.execute_input":"2022-07-05T00:28:27.905046Z","iopub.status.idle":"2022-07-05T00:28:27.966280Z","shell.execute_reply.started":"2022-07-05T00:28:27.905000Z","shell.execute_reply":"2022-07-05T00:28:27.965439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"min_max_scaler = MinMaxScaler()\ndata[feats_min_max_scale]=min_max_scaler.fit_transform(data[feats_min_max_scale])\ntest_data[feats_min_max_scale]=min_max_scaler.transform(test_data[feats_min_max_scale])","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.967790Z","iopub.execute_input":"2022-07-05T00:28:27.968533Z","iopub.status.idle":"2022-07-05T00:28:27.988730Z","shell.execute_reply.started":"2022-07-05T00:28:27.968487Z","shell.execute_reply":"2022-07-05T00:28:27.987808Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.preprocessing import LabelEncoder\ndata=data.apply(LabelEncoder().fit_transform)\ntest_data=test_data.apply(LabelEncoder().fit_transform)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:27.990255Z","iopub.execute_input":"2022-07-05T00:28:27.991004Z","iopub.status.idle":"2022-07-05T00:28:28.048348Z","shell.execute_reply.started":"2022-07-05T00:28:27.990956Z","shell.execute_reply":"2022-07-05T00:28:28.047220Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# one_hot = ['MSZoning', 'Street', 'LotShape', 'LandContour', 'Utilities', 'LotConfig', 'LandSlope', 'Neighborhood', 'Condition1', \\\n#            'Condition2', 'BldgType', 'HouseStyle', 'RoofStyle', 'RoofMatl', 'Exterior1st', 'Exterior2nd', 'MasVnrType', 'Foundation', \\\n#            'Heating', 'Functional', 'GarageType', 'SaleType', 'SaleCondition']\n# data = pd.get_dummies(data, columns=one_hot)\n# test_data = pd.get_dummies(test_data, columns=one_hot)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:28.050019Z","iopub.execute_input":"2022-07-05T00:28:28.050717Z","iopub.status.idle":"2022-07-05T00:28:28.055910Z","shell.execute_reply.started":"2022-07-05T00:28:28.050666Z","shell.execute_reply":"2022-07-05T00:28:28.054855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# ordinal = ['ExterQual', 'ExterCond', 'BsmtQual', 'BsmtCond', 'BsmtExposure', 'BsmtFinType1', 'BsmtFinType2', 'HeatingQC', \\\n#            'CentralAir', 'Electrical', 'KitchenQual', 'GarageFinish', 'GarageQual', 'GarageCond', 'PavedDrive']\n\n# ordinal_mapping  = {'ExterQual'     : {'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'ExterCond'     : {'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'BsmtQual'      : {'NoB': 0, 'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'BsmtCond'      : {'NoB': 0, 'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'BsmtExposure'  : {'NoB': 0, 'No': 1, 'Mn': 2, 'Av': 3, 'Gd': 4},\n#                     'BsmtFinType1'  : {'NoB': 0, 'Unf': 1, 'LwQ': 2, 'Rec': 3, 'BLQ': 4, 'ALQ': 5, 'GLQ': 6},\n#                     'BsmtFinType2'  : {'NoB': 0, 'Unf': 1, 'LwQ': 2, 'Rec': 3, 'BLQ': 4, 'ALQ': 5, 'GLQ': 6},\n#                     'HeatingQC'     : {'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},'CentralAir'    : {'N': 0, 'Y': 1},\n#                     'Electrical'    : {'Mix': 1, 'FuseP': 2, 'FuseF': 3, 'FuseA': 4, 'SBrkr': 5},\n#                     'KitchenQual'   : {'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'GarageFinish'  : {'NoG': 0, 'Unf': 1, 'RFn': 2, 'Fin': 3},\n#                     'GarageQual'    : {'NoG': 0, 'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'GarageCond'    : {'NoG': 0, 'Po': 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5},\n#                     'PavedDrive'    : {'N': 1, 'P': 2, 'Y': 3}\n#                     }\n# data.replace(ordinal_mapping, inplace=True)\n# test_data.replace(ordinal_mapping, inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:28.057022Z","iopub.execute_input":"2022-07-05T00:28:28.058108Z","iopub.status.idle":"2022-07-05T00:28:28.074010Z","shell.execute_reply.started":"2022-07-05T00:28:28.058069Z","shell.execute_reply":"2022-07-05T00:28:28.072789Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train= data.drop(['Id'],axis=1)\nX_train, X_valid, y_train, y_valid = train_test_split(X_train, y_train, train_size=0.8, test_size=0.2,random_state=0)\nX_test=test_data.drop('Id',axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:28.075459Z","iopub.execute_input":"2022-07-05T00:28:28.075933Z","iopub.status.idle":"2022-07-05T00:28:28.096302Z","shell.execute_reply.started":"2022-07-05T00:28:28.075899Z","shell.execute_reply":"2022-07-05T00:28:28.094963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import mean_squared_error\nfrom sklearn.ensemble import GradientBoostingRegressor\nGBR_model = GradientBoostingRegressor(learning_rate=0.01, n_estimators=1000, max_depth=4)\nGBR_model.fit(X_train, y_train)\nGBR_model.score(X_train, y_train)\npreds = GBR_model.predict(X_valid)\nprint(\"Rmse = \", mean_squared_error(np.log(y_valid), np.log(preds), squared=False))","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:28.098099Z","iopub.execute_input":"2022-07-05T00:28:28.098583Z","iopub.status.idle":"2022-07-05T00:28:34.642964Z","shell.execute_reply.started":"2022-07-05T00:28:28.098532Z","shell.execute_reply":"2022-07-05T00:28:34.641731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds_test = GBR_model.predict(X_test)\n\noutput = pd.DataFrame({'Id': test_data['Id'],\n                       'SalePrice': preds_test})\noutput.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-05T00:28:34.644534Z","iopub.execute_input":"2022-07-05T00:28:34.645475Z","iopub.status.idle":"2022-07-05T00:28:34.693705Z","shell.execute_reply.started":"2022-07-05T00:28:34.645440Z","shell.execute_reply":"2022-07-05T00:28:34.692446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}