Kaggle competition: House Prices - Advanced Regression Techniques
def create_one_event_submission(event_id, hits, labels):
sub_data = np.column_stack(( [event_id]*len(hits), hits.hit_id.values, labels))
submission = pd.DataFrame(data=sub_data, columns=["event_id", "hit_id", "track_id"] ).astype(int)
 return submission 
<compute_test_metric>
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')
 train.head()
print(train.shape)
 print(test.shape )
submission = create_one_event_submission(0, hits, labels)
 score = score_event(truth, submission)
 print("Your score: ", score )<load_from_csv>
train.isnull().sum().sort_values(ascending=False)[0:20]
warnings.filterwarnings('ignore')
 train = pd.read_csv('.. /input/train.csv')
 test = pd.read_csv('.. /input/test.csv')
 cols = [c for c in train.columns if c not in ['id', 'target', 'wheezy-copper-turtle-magic']]
print(train.shape, test.shape)
 oof = np.zeros(len(train))
preds = np.zeros(len(test))
params = [{'reg_param': [0.1, 0.2, 0.3, 0.4, 0.5]}]
reg_params = np.zeros(512)
 for i in tqdm_notebook(range(512)) :
train2 = train[train['wheezy-copper-turtle-magic']==i]
test2 = test[test['wheezy-copper-turtle-magic']==i]
idx1 = train2.index; idx2 = test2.index
train2.reset_index(drop=True,inplace=True)
 data = pd.concat([pd.DataFrame(train2[cols]), pd.DataFrame(test2[cols])])
 pipe = Pipeline([('vt', VarianceThreshold(threshold=2)) ,('scaler', StandardScaler())])
 data2 = pipe.fit_transform(data[cols])
 train3 = data2[:train2.shape[0]]; test3 = data2[train2.shape[0]:]
skf = StratifiedKFold(n_splits=11, random_state=42)
 for train_index, test_index in skf.split(train2, train2['target']):
qda = QuadraticDiscriminantAnalysis()
clf = GridSearchCV(qda, params, cv=4)
 clf.fit(train3[train_index,:],train2.loc[train_index]['target'])
 reg_params[i] = clf.best_params_['reg_param']
oof[idx1[test_index]] = clf.predict_proba(train3[test_index,:])[:,1]
preds[idx2] += clf.predict_proba(test3)[:,1] / skf.n_splits
auc = roc_auc_score(train['target'], oof)
 print(f'AUC: {auc:.5}')
 for itr in range(10):
test['target'] = preds
test.loc[test['target'] > 0.955, 'target'] = 1
test.loc[test['target'] < 0.045, 'target'] = 0
usefull_test = test[(test['target'] == 1)|(test['target'] == 0)]
new_train = pd.concat([train, usefull_test] ).reset_index(drop=True)
 print(usefull_test.shape[0], "Test Records added for iteration : ", itr)
 new_train.loc[oof > 0.995, 'target'] = 1
new_train.loc[oof < 0.005, 'target'] = 0
oof2 = np.zeros(len(train))
preds = np.zeros(len(test))
for i in tqdm_notebook(range(512)) :
train2 = new_train[new_train['wheezy-copper-turtle-magic']==i]
test2 = test[test['wheezy-copper-turtle-magic']==i]
idx1 = train[train['wheezy-copper-turtle-magic']==i].index
idx2 = test2.index
train2.reset_index(drop=True,inplace=True)
 data = pd.concat([pd.DataFrame(train2[cols]), pd.DataFrame(test2[cols])])
 pipe = Pipeline([('vt', VarianceThreshold(threshold=2)) ,('scaler', StandardScaler())])
 data2 = pipe.fit_transform(data[cols])
 train3 = data2[:train2.shape[0]]
test3 = data2[train2.shape[0]:]
skf = StratifiedKFold(n_splits=11, random_state=time.time)
 for train_index, test_index in skf.split(train2, train2['target']):
oof_test_index = [t for t in test_index if t < len(idx1)]
clf = QuadraticDiscriminantAnalysis(reg_params[i])
 clf.fit(train3[train_index,:],train2.loc[train_index]['target'])
 if len(oof_test_index)> 0:
oof2[idx1[oof_test_index]] = clf.predict_proba(train3[oof_test_index,:])[:,1]
preds[idx2] += clf.predict_proba(test3)[:,1] / skf.n_splits
auc = roc_auc_score(train['target'], oof2)
 print(f'AUC: {auc:.5}')
<feature_engineering>

 for i in list(train.columns):
dtype = train[i].dtype
values = 0
if(dtype == float or dtype == int):
method = 'mean'
else:
method = 'mode'
if(train[i].notnull().sum() / 1460 <=.5):
train.drop(i, axis = 1, inplace=True)
 elif method == 'mean':
train[i]=train[i].fillna(train[i].mean())
 else:
train[i]=train[i].fillna(train[i].mode() [0])
 print(train[i])
 for i in list(test.columns):
dtype = test[i].dtype
values = 0
if(dtype == float or dtype == int):
method = 'mean'
else:
method = 'mode'
if(test[i].notnull().sum() / 1460 <=.5):
test.drop(i, axis = 1, inplace=True)
 elif method == 'mean':
test[i]=test[i].fillna(test[i].mean())
 else:
test[i]=test[i].fillna(test[i].mode() [0])
 train.head()
test.shape
test['target'] = preds
test.loc[test['target'] > 0.9, 'target'] = 1
test.loc[test['target'] < 0.1, 'target'] = 0
usefull_test = test[(test['target'] == 1)|(test['target'] == 0)]
new_train = pd.concat([train, usefull_test] ).reset_index(drop=True)
 new_train.loc[oof > 0.999, 'target'] = 1
new_train.loc[oof < 0.001, 'target'] = 0<import_modules>
train.isnull().any().any()
train.head()
import numpy as np, pandas as pd, os
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis, LinearDiscriminantAnalysis
from sklearn.feature_selection import VarianceThreshold
from sklearn.model_selection import StratifiedKFold, KFold
from sklearn.metrics import roc_auc_score
from tqdm import tqdm
from sklearn.covariance import EmpiricalCovariance
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
import sympy 
<load_from_csv>
columns = ['MSZoning', 'Street',
'LotShape', 'LandContour', 'Utilities', 'LotConfig', 'LandSlope',
'Neighborhood', 'Condition1', 'Condition2', 'BldgType', 'HouseStyle', 'RoofStyle',
'RoofMatl', 'Exterior1st', 'Exterior2nd', 'MasVnrType',
'ExterQual', 'ExterCond', 'Foundation', 'BsmtQual', 'BsmtCond',
'BsmtExposure', 'BsmtFinType1', 'BsmtFinType2',
'Heating', 'HeatingQC', 'CentralAir', 'Electrical',
'KitchenQual', 'Functional', 'FireplaceQu', 'GarageType', 'GarageFinish',
'GarageQual', 'GarageCond', 'PavedDrive', 'SaleType', 'SaleCondition']
train = pd.read_csv('.. /input/train.csv')
 test = pd.read_csv('.. /input/test.csv')
<data_type_conversions>
train_test_data = pd.concat([train, test], axis = 0)
 print(test.shape)
 print(train.shape)
 train_test_data.head()
train_test_data.shape
def get_mean_cov(x,y):
model = OAS()
ones =(y==1 ).astype(bool)
 x2 = x[ones]
model.fit(x2)
 p1 = model.precision_
m1 = model.location_
onesb =(y==0 ).astype(bool)
 x2b = x[onesb]
model.fit(x2b)
 p2 = model.precision_
m2 = model.location_
ms = np.stack([m1,m2])
 ps = np.stack([p1,p2])
 return ms,ps 
<filter>
def One_hot_encoding(columns):
df_final=train_test_data
i=0
for fields in columns:
df1=pd.get_dummies(train_test_data[fields],drop_first=True)
 train_test_data.drop([fields],axis=1,inplace=True)
 if i==0:
df_final=df1.copy()
else:
df_final=pd.concat([df_final,df1],axis=1)
 i=i+1
df_final=pd.concat([train_test_data,df_final],axis=1)
 return df_final
cols = [c for c in train.columns if c not in ['id', 'target']]
cols.remove('wheezy-copper-turtle-magic')
 oof2 = np.zeros(len(train))
preds2 = np.zeros(len(test))
for i in tqdm(range(512)) :
train2 = new_train[new_train['wheezy-copper-turtle-magic']==i]
test2 = test[test['wheezy-copper-turtle-magic']==i]
idx1 = train[train['wheezy-copper-turtle-magic']==i].index
idx2 = test2.index
train2.reset_index(drop=True,inplace=True)
 sel = VarianceThreshold(threshold=1.5 ).fit(train2[cols])
 train3 = sel.transform(train2[cols])
 test3 = sel.transform(test2[cols])
 skf = StratifiedKFold(n_splits=11, random_state=42, shuffle=True)
 for train_index, test_index in skf.split(train3, train2['target']):
oof_test_index2 = [t for t in test_index if t < len(idx1)]
x_train, y_train = train3[train_index,:], train2.loc[train_index]['target'].values
x_train_0 = x_train[y_train==0]
x_train_1 = x_train[y_train==1]
brc = Birch(branching_factor=50, n_clusters=3, threshold=0.6, compute_labels=True)
 labels_0 = brc.fit_predict(x_train_0)
 labels_1 = brc.fit_predict(x_train_1)
 zero_mean = []
zero_cov = []
for l in np.unique(labels_0):
model = OAS()
model.fit(x_train_0[labels_0==l])
 p = model.precision_
m = model.location_
zero_mean.append(m)
 zero_cov.append(p)
 one_mean = []
one_cov = []
for l in np.unique(labels_1):
model = OAS()
model.fit(x_train_1[labels_1==l])
 p = model.precision_
m = model.location_
one_mean.append(m)
 one_cov.append(p)
 ms = np.stack(zero_mean + one_mean)
 ps = np.stack(zero_cov + one_cov)
 gm = GaussianMixture(n_components=6, init_params='kmeans',
covariance_type='full', tol=0.001,reg_covar=0.001, max_iter=100, n_init=1,
means_init=ms, precisions_init=ps, random_state=666)
 gm.fit(np.concatenate([train3[train_index,:],test3],axis = 0))
if len(oof_test_index2)> 0:
oof2[idx1[oof_test_index2]] = gm.predict_proba(train3[oof_test_index2,:])[:, 0:3].mean(axis=1)
 preds2[idx2] += gm.predict_proba(test3)[:, 0:3].mean(axis=1)/ skf.n_splits
auc = roc_auc_score(1 - train['target'],oof2)
 print('QDA scores CV =',round(auc,5))<compute_test_metric>
train_test_data = One_hot_encoding(columns)
 print(train_test_data.shape)
 train_test_data.head()
auc = roc_auc_score(1-train['target'],oof2)
 print('QDA scores CV =',round(auc,5))<save_to_csv>
train_test_data.columns.duplicated()
sub = pd.read_csv('.. /input/sample_submission.csv')
 sub['target'] = preds2
sub.to_csv('submission.csv',index=False)
 plt.hist(preds2,bins=100)
 plt.title('Final Test.csv predictions')
 plt.show()<set_options>
train_test_data =train_test_data.loc[:,~train_test_data.columns.duplicated() ]
train_test_data.shape
%matplotlib inline
warnings.filterwarnings("ignore")
 pd.set_option("display.max_columns", None)
 scaler_type = "no"
N_SPLITS = 10<load_from_csv>
from scipy.stats import norm, skew
from scipy import stats
test = pd.read_csv(".. /input/test.csv")
 train = pd.read_csv(".. /input/train.csv")
 sample_submission = pd.read_csv(".. /input/sample_submission.csv")
 train.head()<count_values>
train["SalePrice"] = np.log(train["SalePrice"])
train['target'].value_counts() 
<filter>
df_Test.drop(['SalePrice'],axis=1,inplace=True)
 X_train_final=df_Train.drop(['SalePrice'],axis=1)
 y_train_final=df_Train['SalePrice']
X_train_final.shape
display(t_des.loc['mean'][t_des.loc['mean'] > 250] )<filter>
X_std = StandardScaler().fit_transform(X_train_final)
 my_columns = X_train_final.columns
new_df = pd.DataFrame(X_std, columns=my_columns )
display(t_des.loc['std'][t_des.loc['std'] > 140] )<normalization>
pca = PCA(n_components = 2)
 df_pca = pca.fit_transform(new_df)
 print(df_pca )
def scale(train,test):
traintest = pd.concat([train,test],axis=0,ignore_index=True ).reset_index(drop=True)
 cols = [c for c in train.columns if c not in ['id','target','wheezy-copper-turtle-magic']]
scaler = StandardScaler()
traintest[cols] = scaler.fit_transform(traintest[cols])
 train['wheezy-copper-turtle-magic'] = train['wheezy-copper-turtle-magic'].astype('category')
 train = traintest[:train.shape[0]].reset_index(drop=True)
 test = traintest[train.shape[0]:].reset_index(drop=True)
 return train,test
if scaler_type == "standard":
train,test = scale(train,test )<define_variables>
X_train, X_test, y_train, y_test = train_test_split(X_train_final, y_train_final)
 linreg = LinearRegression()
linreg.fit(X_train, y_train)
 print("R-Squared Value for Training Set: ",linreg.score(X_train, y_train))
print("R-Squared Value for Test Set: ",linreg.score(X_test, y_test))
<define_variables>
knnreg = KNeighborsRegressor(n_neighbors = 2)
 knnreg.fit(X_train, y_train)
 print('R-squared train score:',knnreg.score(X_train, y_train))
print('R-squared test score: ',knnreg.score(X_test, y_test))
<compute_test_metric>
ridge = Ridge()
ridge.fit(X_train, y_train)
 print('R-squared train score:',ridge.score(X_train, y_train))
print('R-squared test score: ',ridge.score(X_test, y_test))
<save_to_csv>
scaler = MinMaxScaler()
X_train_scaled = scaler.fit_transform(X_train)
 X_test_scaled = scaler.transform(X_test)
 ridge = Ridge(alpha=20)
 ridge.fit(X_train_scaled, y_train)
 print('R-squared score(training): {:.3f}'.format(ridge.score(X_train_scaled, y_train)))
 print('R-squared score(test): {:.3f}'.format(ridge.score(X_test_scaled, y_test)) )
<define_variables>
lasso = Lasso(max_iter = 10000)
 lasso.fit(X_train, y_train)
 print('R-squared score(training): {:.3f}'.format(lasso.score(X_train, y_train)))
 print('R-squared score(test): {:.3f}'.format(lasso.score(X_test, y_test)))
 lasso = Lasso(alpha=100, max_iter = 10000)
 lasso.fit(X_train_scaled, y_train)
 print('R-squared score(training): {:.3f}'.format(lasso.score(X_train_scaled, y_train)))
 print('R-squared score(test): {:.3f}'.format(lasso.score(X_test_scaled, y_test)))
<define_variables>
lasso = make_pipeline(RobustScaler() , Lasso(alpha =0.0005, random_state=1))
lasso.fit(X_train_scaled, y_train)
 print('R-squared score(training): {:.3f}'.format(lasso.score(X_train_scaled, y_train)))
 print('R-squared score(test): {:.3f}'.format(lasso.score(X_test_scaled, y_test)))
%%time
cols = [c for c in train.columns if c not in ['id', 'target']]
cols.remove('wheezy-copper-turtle-magic')
 oof = np.zeros(len(train))
preds = np.zeros(len(test))
for i in range(512):
train2 = train[train['wheezy-copper-turtle-magic']==i]
test2 = test[test['wheezy-copper-turtle-magic']==i]
idx1 = train2.index; idx2 = test2.index
train2.reset_index(drop=True,inplace=True)
 sel = VarianceThreshold(threshold=1.5 ).fit(train2[cols])
 train3 = sel.transform(train2[cols])
 test3 = sel.transform(test2[cols])
 skf = StratifiedKFold(n_splits=11, random_state=42, shuffle=True)
 for train_index, test_index in skf.split(train3, train2['target']):
clf = QuadraticDiscriminantAnalysis(reg_param=0.5)
 clf.fit(train3[train_index,:],train2.loc[train_index]['target'])
 oof[idx1[test_index]] = clf.predict_proba(train3[test_index,:])[:,1]
preds[idx2] += clf.predict_proba(test3)[:,1] / skf.n_splits
auc = roc_auc_score(train['target'],oof)
 print('QDA scores CV =',round(auc,5))<feature_engineering>
GBoost = GradientBoostingRegressor(n_estimators=3000, learning_rate=0.05,
max_depth=4, max_features='sqrt',
min_samples_leaf=15, min_samples_split=10,
loss='huber', random_state =5)
 GBoost.fit(X_train_final, y_train_final)
 y_pred = GBoost.predict(df_Test)
 y_pred
test['target'] = preds
oof = np.zeros(len(train))
preds = np.zeros(len(test))
for k in range(512):
train2 = train[train['wheezy-copper-turtle-magic']==k]
train2p = train2.copy() ; idx1 = train2.index
test2 = test[test['wheezy-copper-turtle-magic']==k]
test2p = test2[(test2['target']<=0.01)|(test2['target']>=0.99)].copy()
test2p.loc[ test2p['target']>=0.5, 'target' ] = 1
test2p.loc[ test2p['target']<0.5, 'target' ] = 0
train2p = pd.concat([train2p,test2p],axis=0)
 train2p.reset_index(drop=True,inplace=True)
 sel = VarianceThreshold(threshold=1.5 ).fit(train2p[cols])
 train3p = sel.transform(train2p[cols])
 train3 = sel.transform(train2[cols])
 test3 = sel.transform(test2[cols])
 skf = StratifiedKFold(n_splits=11, random_state=42, shuffle=True)
 for train_index, test_index in skf.split(train3p, train2p['target']):
test_index3 = test_index[ test_index<len(train3)]
clf = QuadraticDiscriminantAnalysis(reg_param=0.5)
 clf.fit(train3p[train_index,:],train2p.loc[train_index]['target'])
 oof[idx1[test_index3]] = clf.predict_proba(train3[test_index3,:])[:,1]
preds[test2.index] += clf.predict_proba(test3)[:,1] / skf.n_splits
auc = roc_auc_score(train['target'],oof)
 print('Pseudo Labeled QDA scores CV =',round(auc,5))<save_to_csv>
regressor = RandomForestClassifier()
regressor.fit(X_train_scaled, y_train)
 print('R-squared score(training): {:.3f}'.format(regressor.score(X_train_scaled, y_train)))
 print('R-squared score(test): {:.3f}'.format(regressor.score(X_test_scaled, y_test)))
sub = pd.read_csv('.. /input/sample_submission.csv')
 sub['target'] = preds
sub.to_csv('submission.csv',index=False)
 plt.hist(preds,bins=100)
 plt.title('Final Test.csv predictions')
 plt.show()<set_options>
warnings.filterwarnings('ignore')
<load_from_csv>
regressor = RandomForestClassifier(bootstrap='False', max_depth=15, min_samples_leaf=4,n_estimators=900, verbose=5)
train = pd.read_csv('.. /input/train.csv')
 test = pd.read_csv('.. /input/test.csv')
 train['wheezy-copper-turtle-magic'] = train['wheezy-copper-turtle-magic'].astype('category')
 test['wheezy-copper-turtle-magic'] = test['wheezy-copper-turtle-magic'].astype('category' )<save_to_csv>
magicNum = 131073
default_cols = [c for c in train.columns if c not in ['id', 'target','target_pred', 'wheezy-copper-turtle-magic']]
cols = [c for c in default_cols]
sub = pd.read_csv('.. /input/sample_submission.csv')
 sub.to_csv('submission.csv',index=False )<define_search_space>
regressor=xgboost.XGBRegressor()
y_perfect = [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]
y_flliped = [1,0,0,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1]<define_variables>
y_preds = [0.33,0.33,0.33,0.5,0.5,0,0,0,0,0,1,1,0.5,0.5,1,1,1,0.66,0.66,0.66]<prepare_x_and_y>
regressor = xgboost.XGBRegressor(base_score=0.25, booster='gbtree', colsample_bylevel=1,
colsample_bynode=1, colsample_bytree=1, gamma=0, gpu_id=-1,
importance_type='gain', interaction_constraints='',
learning_rate=0.1, max_delta_step=0, max_depth=2,
min_child_weight=1, missing=None, monotone_constraints='() ',
n_estimators=900, n_jobs=0, num_parallel_tree=1, random_state=0,
reg_alpha=0, reg_lambda=1, scale_pos_weight=1, subsample=1,
tree_method='exact', validate_parameters=1, verbosity=None )
preds=np.zeros(len(test))
train_err=np.zeros(512)
 test_err=np.zeros(512)
 for i in range(512):
X = train[train['wheezy-copper-turtle-magic']==i].copy()
Y = X.pop('target' ).values
X_test = test[test['wheezy-copper-turtle-magic']==i].copy()
idx_train = X.index
idx_test = X_test.index
X.reset_index(drop=True,inplace=True)
 X = X[cols].values
X_test = X_test[cols].values
vt = VarianceThreshold(threshold=2 ).fit(X)
 X = vt.transform(X)
 X_test = vt.transform(X_test)
 X_all = np.concatenate([X,X_test])
 train_size = len(X)
 test1_size = test[:131073][test[:131073]['wheezy-copper-turtle-magic']==i].shape[0]
compo_cnt = 6
for ii in range(30):
gmm = GaussianMixture(n_components=compo_cnt,init_params='random',covariance_type='full',max_iter=100,tol=1e-10,reg_covar=0.0001 ).fit(X_all)
 labels = gmm.predict(X_all)
 cntStd = np.std([len(labels[labels==j])for j in range(compo_cnt)])
 if round(cntStd,4)== 0.4714:
check_labels = labels[:train_size]
cvt_labels=np.zeros(len(labels))
for iii in range(compo_cnt):
mean_val = Y[check_labels==iii].mean()
mean_val = 1 if mean_val > 0.5 else 0
cvt_labels[labels==iii] = mean_val
train_err[i] = len(Y[Y != cvt_labels[:train_size]])
 if(train_err[i] >= 10)and(train_err[i] <= 15):
train_err[i] = 12.5
exp_err = max(0,(25 - train_err[i])/(train_size + test1_size))
for iii in range(compo_cnt):
mean_val = Y[check_labels==iii].mean()
mean_val =(1-exp_err)if mean_val > 0.5 else exp_err
cvt_labels[labels==iii] = mean_val
preds[idx_test] = cvt_labels[train_size:]
break
sub['target'] = preds
sub.to_csv('submission.csv',index=False )<set_options>
regressor.fit(X_train_final,y_train_final )
_MKL_ = 'mkl'
_OPENBLAS_ = 'openblas'
class BLAS:
def __init__(self, cdll, kind):
if kind not in(_MKL_, _OPENBLAS_):
raise ValueError(f'kind must be {MKL} or {OPENBLAS}, got {kind} instead.')
 self.kind = kind
self.cdll = cdll
if kind == _MKL_:
self.get_n_threads = cdll.MKL_Get_Max_Threads
self.set_n_threads = cdll.MKL_Set_Num_Threads
else:
self.get_n_threads = cdll.openblas_get_num_threads
self.set_n_threads = cdll.openblas_set_num_threads
def get_blas(numpy_module):
LDD = 'ldd'
LDD_PATTERN = r'^\t(?P<lib>.*{}.*)=>(?P<path>.*)\(0x.*$'
NUMPY_PATH = os.path.join(numpy_module.__path__[0], 'core')
 MULTIARRAY_PATH = glob.glob(os.path.join(NUMPY_PATH, '_multiarray_umath.*so')) [0]
ldd_result = subprocess.run(
 args=[LDD, MULTIARRAY_PATH],
check=True,
stdout=subprocess.PIPE,
universal_newlines=True 
)
 output = ldd_result.stdout
if _MKL_ in output:
kind = _MKL_
elif _OPENBLAS_ in output:
kind = _OPENBLAS_
else:
return
pattern = LDD_PATTERN.format(kind)
 match = re.search(pattern, output, flags=re.MULTILINE)
 if match:
lib = ctypes.CDLL(match.groupdict() ['path'])
 return BLAS(lib, kind)
 class single_threaded:
def __init__(self, numpy_module=None):
if numpy_module is not None:
self.blas = get_blas(numpy_module)
 else:
self.blas = get_blas(numpy)
 def __enter__(self):
if self.blas is not None:
self.old_n_threads = self.blas.get_n_threads()
self.blas.set_n_threads(1)
 else:
warnings.warn(
 'No MKL/OpenBLAS found, assuming NumPy is single-threaded.' 
)
 def __exit__(self, *args):
if self.blas is not None:
self.blas.set_n_threads(self.old_n_threads)
 if self.blas.get_n_threads() != self.old_n_threads:
message =(
 f'Failed to reset {self.blas.kind} '
f'to {self.old_n_threads} threads(previous value ).' 
)
 raise RuntimeError(message)
 def __call__(self, func):
def _func(*args, **kwargs):
self.__enter__()
func_result = func(*args, **kwargs)
 self.__exit__()
return func_result
return _func 
<set_options>
pred=pd.DataFrame(y_pred)
 samp = pd.read_csv('.. /input/house-prices-advanced-regression-techniques/test.csv')
 sub = pd.concat([samp['Id'],pred], axis=1)
 sub.columns=['Id','SalePrice']
warnings.filterwarnings('ignore')
 %matplotlib inline<load_from_csv>
sub.to_csv('My_sub1.csv',index=False )