Kaggle competition: House Prices - Advanced Regression Techniques
tmp = install[['SK_ID_PREV','SK_ID_CURR','NUM_INSTALMENT_NUMBER','AMT_INSTALMENT']].drop_duplicates()<rename_columns>
train = pd.read_csv("/kaggle/input/house-prices-advanced-regression-techniques/train.csv")
 test = pd.read_csv("/kaggle/input/house-prices-advanced-regression-techniques/test.csv")
 data = pd.concat([train, test], ignore_index=True )
tmp = tmp.groupby(['SK_ID_PREV','SK_ID_CURR'])['AMT_INSTALMENT'].sum().reset_index()
tmp.columns = ['SK_ID_PREV','SK_ID_CURR','need_to_pay']<rename_columns>
percent_null = data.isnull().sum() /len(data)*100
percent_null = percent_null[percent_null>0]
print(percent_null.sort_values() )
tmp_1 = install.groupby(['SK_ID_PREV'])['AMT_PAYMENT'].sum().reset_index()
tmp_1.columns = ['SK_ID_PREV','paid']<merge>
def null_cols(dataframe):
for col in dataframe.columns:
null_count = dataframe[col].isnull().sum()
if null_count > 0:
percent_null = null_count/len(dataframe[col])*100
print(f"{col} percent null: {round(percent_null,3)}" )
tmp = tmp.merge(tmp_1, on=['SK_ID_PREV'], how='left' )<merge>
null_cols(num_data )
payment_history = tmp
payment_history['ratio'] = payment_history['paid']/payment_history['need_to_pay']
payment_history['delta'] = payment_history['need_to_pay'] - payment_history['paid']
payment_history = payment_history.merge(previous[['SK_ID_PREV','AMT_ANNUITY','CNT_PAYMENT','NAME_CONTRACT_TYPE']], \
on = ['SK_ID_PREV'], how='left')
 payment_history['all_credit'] = payment_history['AMT_ANNUITY'] * payment_history['CNT_PAYMENT']
payment_history['ratio'] = payment_history['paid']/payment_history['all_credit']
payment_history['delta'] = payment_history['all_credit'] - payment_history['paid']
tmp = install.groupby(['SK_ID_PREV'])['NUM_INSTALMENT_VERSION'].mean().reset_index()
tmp.columns = ['SK_ID_PREV','mean_version']
payment_history = payment_history.merge(tmp, on=['SK_ID_PREV'], how='left' )<merge>
data.LotFrontage.fillna(np.mean(data.LotFrontage), inplace=True)
 data.MasVnrArea.fillna(np.mean(data.MasVnrArea), inplace=True)
 data.BsmtFinSF1.fillna(np.mean(data.BsmtFinSF1), inplace=True)
 data.BsmtFinSF2.fillna(np.mean(data.BsmtFinSF2), inplace=True)
 data.BsmtUnfSF.fillna(np.mean(data.BsmtUnfSF), inplace=True)
 data.TotalBsmtSF.fillna(np.mean(data.TotalBsmtSF), inplace=True)
 data.BsmtFullBath.fillna(np.mean(data.BsmtFullBath), inplace=True)
 data.BsmtHalfBath.fillna(np.mean(data.BsmtHalfBath), inplace=True)
 data.GarageYrBlt.fillna(np.mean(data.GarageYrBlt), inplace=True)
 data.GarageCars.fillna(np.mean(data.GarageCars), inplace=True)
 data.GarageArea.fillna(np.mean(data.GarageArea), inplace=True )
tmp = payment_history[payment_history['mean_version'] > 0].groupby(['SK_ID_CURR'])['ratio'].agg({"returns": [np.min, np.max,np.mean, np.sum]})\ 
.reset_index()
tmp.columns = ['SK_ID_CURR','des1','des2','des3', 'des4']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['min_ratio_paid_install'] = tmp_merge['des1']
df['max_ratio_paid_install'] = tmp_merge['des2']
df['mean_ratio_paid_install'] = tmp_merge['des3']
df['sum_ratio_paid_install'] = tmp_merge['des4']<merge>
encoder = OneHotEncoder()
temp = pd.DataFrame(encoder.fit_transform(data[['MSSubClass']] ).toarray() , columns=['MS20','MS30','MS40','MS45','MS50','MS60','MS70','MS75','MS80','MS85','MS90','MS120','MS150','MS160','MS180','MS190'])
 data = data.join(temp)
 data.drop('MSSubClass', 1, inplace=True)
 temp = pd.DataFrame(encoder.fit_transform(data[['MoSold']] ).toarray() , columns=['SoldJan','SoldFeb','SoldMar','SoldApr','SoldMay','SoldJun','SoldJul','SoldAug','SoldSep','SoldOct','SoldNov','SoldDec'])
 data = data.join(temp)
 data.drop('MoSold', 1, inplace=True)
 temp = pd.DataFrame(encoder.fit_transform(data[['YrSold']] ).toarray() , columns=['Sold2006', 'Sold2007', 'Sold2008', 'Sold2009', 'Sold2010'])
 data = data.join(temp)
 data.drop('YrSold', 1, inplace=True )
tmp = payment_history[payment_history['mean_version'] > 0].groupby(['SK_ID_CURR'])['delta'].agg({"returns": [np.min, np.max,np.mean, np.sum]})\ 
.reset_index()
tmp.columns = ['SK_ID_CURR','des1','des2','des3', 'des4']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['min_delta_paid_install'] = tmp_merge['des1']
df['max_delta_paid_install'] = tmp_merge['des2']
df['mean_delta_paid_install'] = tmp_merge['des3']
df['sum_delta_paid_install'] = tmp_merge['des4']<merge>
data['LotShape'].replace({"IR3": 1, 'IR2': 2, 'IR1': 3, 'Reg': 4}, inplace=True)
 data['Utilities'] = data['Utilities'].fillna('AllPub')
 data['Utilities'].replace({'NoSeWa': 1, 'AllPub': 2}, inplace=True)
 data['BldgType'].replace({"Twnhs": 1, 'TwnhsE': 2, 'Duplex': 3, '2fmCon': 4, '1Fam': 5}, inplace=True)
 data['ExterQual'].replace({"Fa": 1, 'TA': 2, 'Gd': 3, 'Ex': 4}, inplace=True)
 data['ExterCond'].replace({"Po": 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['BsmtQual'] = data['BsmtQual'].fillna(0)
 data['BsmtQual'].replace({'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['BsmtCond'] = data['BsmtCond'].fillna(0)
 data['BsmtCond'].replace({'Po': 1,'Fa': 2, 'TA': 3, 'Gd': 4}, inplace=True)
 data['BsmtExposure'] = data['BsmtExposure'].fillna(0)
 data['BsmtExposure'].replace({"No": 1, 'Mn': 2, 'Av': 3, 'Gd': 4}, inplace=True)
 data['BsmtFinType1'] = data['BsmtFinType1'].fillna(0)
 data['BsmtFinType1'].replace({"Unf": 1, 'LwQ': 2, 'Rec': 3, 'BLQ': 4, 'ALQ': 5, 'GLQ': 6}, inplace=True)
 data['BsmtFinType2'] = data['BsmtFinType2'].fillna(0)
 data['BsmtFinType2'].replace({"Unf": 1, 'LwQ': 2, 'Rec': 3, 'BLQ': 4, 'ALQ': 5, 'GLQ': 6}, inplace=True)
 data['HeatingQC'].replace({"Po": 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['CentralAir'].replace({"Y": 1, 'N': 0}, inplace=True)
 data['Electrical'] = data['Electrical'].fillna(0)
 data['Electrical'].replace({"Mix": 1, 'FuseP': 2, 'FuseF': 3, 'FuseA': 4, 'SBrkr': 5}, inplace=True)
 data['KitchenQual'] = data['KitchenQual'].fillna(0)
 data['KitchenQual'].replace({'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['Functional'] = data['Functional'].fillna(7)
 data['Functional'].replace({"Sev": 1, 'Maj2': 2, 'Maj1': 3, 'Mod': 4, 'Min2': 5, 'Min1': 6, 'Typ': 7}, inplace=True)
 data['FireplaceQu'] = data['FireplaceQu'].fillna(0)
 data['FireplaceQu'].replace({"Po": 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['GarageType'] = data['GarageType'].fillna(0)
 data['GarageType'].replace({"Detchd": 1, 'CarPort': 2, 'BuiltIn': 3, 'Basment': 4, 'Attchd': 5, '2Types': 6}, inplace=True)
 data['GarageFinish'] = data['GarageFinish'].fillna(0)
 data['GarageFinish'].replace({"Unf": 1, 'RFn': 2, 'Fin': 3}, inplace=True)
 data['GarageQual'] = data['GarageQual'].fillna('TA')
 data['GarageQual'].replace({"Po": 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['GarageCond'] = data['GarageCond'].fillna('TA')
 data['GarageCond'].replace({"Po": 1, 'Fa': 2, 'TA': 3, 'Gd': 4, 'Ex': 5}, inplace=True)
 data['PavedDrive'].replace({"N": 1, 'P': 2, 'Y': 3}, inplace=True)
 data['PoolQC'] = data['PoolQC'].fillna(0)
 data['PoolQC'].replace({"Fa": 1, 'Gd': 2, 'Ex': 3}, inplace=True)
 data['Fence'] = data['Fence'].fillna(0)
 data['Fence'].replace({"MnWw": 1, 'GdWo': 2, 'MnPrv': 3, 'GdPrv': 4}, inplace=True )
tmp = install.groupby(['SK_ID_PREV','SK_ID_CURR'] ).agg({'NUM_INSTALMENT_NUMBER':["count","max"]} ).reset_index()
tmp.columns = ['SK_ID_PREV','SK_ID_CURR','count','max']
tmp['delta'] = tmp['count']/tmp['max']
tmp = tmp.merge(previous[['SK_ID_PREV','CNT_PAYMENT','DAYS_LAST_DUE','NAME_CONTRACT_TYPE']], on=['SK_ID_PREV'], how='left')
 tmp_1 = tmp.groupby(['SK_ID_CURR'])['max'].agg({"returns": [np.min, np.max,np.mean, np.sum]})\ 
.reset_index()
tmp_1.columns = ['SK_ID_CURR','des1','des2','des3', 'des4']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp_1, on=['SK_ID_CURR'], how='left')
 df['min_max_num_install'] = tmp_merge['des1']
df['max_max_num_install'] = tmp_merge['des2']
df['mean_max_num_install'] = tmp_merge['des3']
df['sum_max_num_install'] = tmp_merge['des4']<merge>
data['MSZoning'] = data['MSZoning'].fillna('RL')
 temp = pd.DataFrame(encoder.fit_transform(data[['MSZoning']] ).toarray() , columns=['RLZone', 'RMZone', 'CZone', 'FVZone', 'RHZone'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Street']] ).toarray() , columns=['Pave','Grvl'])
 data = data.join(temp)
 data['Alley'] = data['Alley'].fillna('No alley access')
 temp = pd.DataFrame(encoder.fit_transform(data[['Alley']] ).toarray() , columns=['NoAlley','GrvlAlley','PvdAlley'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['LandContour']] ).toarray() , columns=['Lvl','Bnk','Low','HLS'])
 data = data.join(temp)
 data['NotLvl'] = data.Bnk + data.Low + data.HLS
data.drop(['Bnk', 'Low', 'HLS'], 1, inplace=True)
 temp = pd.DataFrame(encoder.fit_transform(data[['LotConfig']] ).toarray() , columns=['Inside','FR2','Corner','CulDSac','FR3'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['LandSlope']] ).toarray() , columns=['Gtl','Mod','Sev'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Neighborhood']] ).toarray() , columns=data.Neighborhood.unique())
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Condition1']] ).toarray() , columns=data.Condition1.unique())
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Condition2']] ).toarray() , columns=['Norm2', 'Artery2', 'RRNn2', 'Feedr2', 'PosN2', 'PosA2', 'RRAn2', 'RRAe2'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['HouseStyle']] ).toarray() , columns=['2Story','1Story','1.5Fin','1.5Unf','SFoyer','SLvl','2.5Unf','2.5Fin'])
 data = data.join(temp)
 data['Split'] = data.SLvl + data.SFoyer
data.drop(['SLvl', 'SFoyer'], 1, inplace=True)
 temp = pd.DataFrame(encoder.fit_transform(data[['RoofStyle']] ).toarray() , columns=['Gable','Hip','Gambrel','Mansard','Flat','Shed'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['RoofMatl']] ).toarray() , columns=['CompShg','WdShngl','Metal','WdShake','Membran','Tar&Grv','Roll','ClyTile'])
 data = data.join(temp)
 data['Exterior1st'] = data['Exterior1st'].fillna('Other')
 temp = pd.DataFrame(encoder.fit_transform(data[['Exterior1st']] ).toarray() , columns=['VinylSd1','MetalSd1','Wd Sdng1','HdBoard1','BrkFace1','WdShing1','CemntBd1','Plywood1','AsbShng1','Stucco1','BrkComm1','AsphShn1','Stone1','ImStucc1','CBlock1','Other1'])
 data = data.join(temp)
 data['Exterior2nd'] = data['Exterior2nd'].fillna('Other')
 temp = pd.DataFrame(encoder.fit_transform(data[['Exterior2nd']] ).toarray() , columns=['VinylSd2','MetalSd2','Wd Shng2','HdBoard2','Plywood2','Wd Sdng2','CmentBd2','BrkFace2','Stucco2','AsbShng2', 'Brk Cmn2','ImStucc2','AsphShn2','Stone2','Other2','CBlock2'])
 data['MasVnrType'] = data['MasVnrType'].fillna('None')
 temp = pd.DataFrame(encoder.fit_transform(data[['MasVnrType']] ).toarray() , columns=['BrkFace','NoMasVnr','StoneMasVnr','BrkCmn'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Foundation']] ).toarray() , columns=['PConc', 'CBlock', 'BrkTil', 'Wood', 'Slab', 'StoneFound'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['Heating']] ).toarray() , columns=['GasA', 'GasW', 'GravF', 'WallF', 'OthW', 'FloorF'])
 data = data.join(temp)
 data['SaleType'] = data['SaleType'].fillna('WD')
 temp = pd.DataFrame(encoder.fit_transform(data[['SaleType']] ).toarray() , columns=['WDSale', 'NewSale', 'CODSale', 'ConLDSale', 'ConLISale', 'CWDSale', 'ConLwSale', 'ConSale', 'OthSale'])
 data = data.join(temp)
 temp = pd.DataFrame(encoder.fit_transform(data[['SaleCondition']] ).toarray() , columns=['NormalCond', 'AbnormlCond', 'PartialCond', 'AdjLandCond', 'AllocaCond', 'FamilyCond'])
 data = data.join(temp)
 data.drop(['MiscFeature','MSZoning', 'Street', 'Alley', 'LandContour', 'LotConfig', 'LandSlope',
'Neighborhood', 'Condition1', 'Condition2', 'HouseStyle', 'RoofStyle',
'RoofMatl', 'Exterior1st', 'Exterior2nd', 'MasVnrType', 'Foundation',
'Heating', 'SaleType', 'SaleCondition'], 1, inplace=True)
tmp = install.groupby(['SK_ID_PREV'])['AMT_PAYMENT'].max().reset_index()
tmp.columns = ['SK_ID_PREV','max_install']
payment_history = payment_history.merge(tmp, on=['SK_ID_PREV'], how='left' )<groupby>
data['TotalBaths'] = data['FullBath'] + 0.5 * data['HalfBath'] + data['BsmtFullBath'] + 0.5 * data['BsmtHalfBath']
data['TotalSF'] = data['1stFlrSF'] + data['2ndFlrSF'] + data['TotalBsmtSF']
data['TotalPorchSF'] = data['OpenPorchSF'] + data['EnclosedPorch'] + data['3SsnPorch'] + data['ScreenPorch']
data['BsmtFinType'] = data['BsmtFinType1'] + data['BsmtFinType2']
data['BsmtFinSF'] = data['BsmtFinSF1'] + data['BsmtFinSF2']
data['GarageRating'] = data['GarageQual'] + data['GarageCond']
data['ExterRating'] = data['ExterQual'] + data['ExterCond']
data['OvrRating'] = data['OverallQual'] + data['OverallCond']
data.drop(['FullBath','HalfBath','BsmtFullBath','BsmtHalfBath','1stFlrSF','2ndFlrSF','TotalBsmtSF','OpenPorchSF','EnclosedPorch','3SsnPorch','ScreenPorch','BsmtFinType1','BsmtFinType2','BsmtFinSF1','BsmtFinSF2','GarageQual','GarageCond','ExterQual','ExterCond','OverallQual','OverallCond'], 1, inplace=True )
payment_history['tmp'] = payment_history['max_install']/payment_history['AMT_ANNUITY']
tmp = payment_history[payment_history['mean_version'] > 0].groupby(['SK_ID_CURR'])['tmp']<merge>
feature_cols = []
for col in data.columns:
feature_cols.append(col)
 feature_cols.remove('Id' )
tmp = install.groupby(['SK_ID_PREV'])['NUM_INSTALMENT_NUMBER'].max().reset_index()
tmp.columns = ['SK_ID_PREV','max_num_install']
payment_history = payment_history.merge(tmp, on=['SK_ID_PREV'], how='left' )<merge>
test_index = data[data['SalePrice'].isnull() ].index.tolist()
test_index
tmp = install[install['AMT_INSTALMENT'] > install['AMT_PAYMENT']]
tmp = tmp.groupby(['SK_ID_CURR'])['SK_ID_PREV'].count().reset_index()
tmp.columns = ['SK_ID_CURR','des']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['count_small_payment'] = tmp_merge['des'].fillna(0)
 for i in [0, 5, 10, 15, 20, 25, 30, 40, 50, 60]:
print(i)
 tmp = install[(install['DAYS_ENTRY_PAYMENT'] - install['DAYS_INSTALMENT'])> i]
tmp = tmp.groupby(['SK_ID_CURR'])['SK_ID_PREV'].count().reset_index()
tmp.columns = ['SK_ID_CURR','des']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['count_late_payment_' + str(i)] = tmp_merge['des'].fillna(0)
<merge>
train_data = data[:1460]
test_data = data[1460:].drop(['SalePrice'], 1)
 x = train_data.drop(['SalePrice'], 1)
 y = np.log1p(train_data['SalePrice'])
install['tmp'] = install['AMT_PAYMENT']/install['AMT_INSTALMENT']
for i in range(10):
print(i)
 tmp = install[(install['tmp'] > i/10)&(install['tmp'] <(( i+1)/10)) ]
tmp = tmp.groupby(['SK_ID_CURR'])['SK_ID_PREV'].count().reset_index()
tmp.columns = ['SK_ID_CURR','des']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['count_ratio_payment_' + str(i)] = tmp_merge['des'].fillna(0)
<merge>
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor, AdaBoostRegressor, BaggingRegressor
from sklearn.linear_model import Ridge, RidgeCV, ElasticNet, ElasticNetCV
from sklearn.kernel_ridge import KernelRidge
from xgboost import XGBRegressor
from lightgbm import LGBMRegressor
from sklearn.svm import SVR
from mlxtend.regressor import StackingCVRegressor
from sklearn import model_selection
from sklearn.model_selection import cross_val_score, KFold, RandomizedSearchCV, GridSearchCV
from sklearn.metrics import mean_squared_error
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import RobustScaler
from scipy.stats import uniform as sp_randFloat
from scipy.stats import randint as sp_randInt
tmp = install.groupby(['SK_ID_PREV','NUM_INSTALMENT_NUMBER'])['DAYS_INSTALMENT'].count().reset_index()
tmp = tmp[tmp['DAYS_INSTALMENT'] > 1]
tmp.columns = ['SK_ID_PREV','NUM_INSTALMENT_NUMBER','count_dup']
install = install.merge(tmp, on = ['SK_ID_PREV','NUM_INSTALMENT_NUMBER'], how='left')
 dup_install = install[install['count_dup'] > 1]
dup_install.reset_index(drop=True, inplace = True)
<groupby>
tmp = install[(install['AMT_PAYMENT'] < install['AMT_INSTALMENT'])&(install['DAYS_ENTRY_PAYMENT'] < install['DAYS_INSTALMENT'])]
tmp['ratio'] = tmp['AMT_PAYMENT']/tmp['AMT_INSTALMENT']
tmp = dup_install.groupby(['SK_ID_CURR'])['AMT_PAYMENT'].agg({"returns": [np.min, np.max,np.mean, np.sum]})\ 
.reset_index()
tmp_1.columns = ['SK_ID_CURR','des1','des2','des3', 'des4']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp_1, on=['SK_ID_CURR'], how='left')
 df['min_special_install'] = tmp_merge['des1']
df['max_special_install'] = tmp_merge['des2']
df['mean_special_install'] = tmp_merge['des3']
df['sum_special_install'] = tmp_merge['des4']<sort_values>
dup_install.sort_values(by=['SK_ID_PREV','NUM_INSTALMENT_NUMBER','DAYS_ENTRY_PAYMENT'] )<load_from_csv>
credit = pd.read_csv(".. /input/credit_card_balance.csv" )<merge>
credit['tmp'] = credit['AMT_BALANCE']/credit['AMT_CREDIT_LIMIT_ACTUAL']
tmp = credit.groupby(["SK_ID_CURR","SK_ID_PREV"])['tmp'].max().reset_index()
tmp = tmp.groupby(['SK_ID_CURR'])['tmp'].agg({"returns": [np.min, np.max,np.mean, np.sum]})\ 
.reset_index()
tmp.columns = ['SK_ID_CURR','des1','des2','des3', 'des4']
for df in [train,test]:
tmp_merge = df[['SK_ID_CURR']]
tmp_merge = tmp_merge.merge(tmp, on=['SK_ID_CURR'], how='left')
 df['min_max_ratio_balance_limit_credit'] = tmp_merge['des1']
df['max_max_ratio_balance_limit_credit'] = tmp_merge['des2']
df['mean_max_ratio_balance_limit_credit'] = tmp_merge['des3']
df['sum_max_ratio_balance_limit_credit'] = tmp_merge['des4'] 
<merge>
<categorify><EOS> 
clf = LGBMRegressor().fit(x,y)
 pred = np.expm1(clf.predict(test_data))
pred = pd.DataFrame({"id": test.Id, "SalePrice": pred})
 pred.to_csv('sample_submission.csv',index=False )