Kaggle competition: Zillow Prize: Zillow’s Home Value Prediction (Zestimate)
<SOS> metric: ZillowMAE Kaggle data source: zillow-prize:-zillow’s-home-value-prediction-(zestimate)<data_type_conversions>
ACTUALLY_DO_SOMETHING = True
CORRECT_FOR_BUG = True
new_test_data['Age_binned']= new_test_data['Age_binned'].astype('int16')
 new_test_data['Fare_binned']= new_test_data['Fare_binned'].astype('int16')
 new_test_data.dtypes<find_best_model_class>
from tqdm import tqdm
Dt = DecisionTreeClassifier()
Dt.fit(x_data,y_data)
 y_pred = Dt.predict(x_data)
 accuracy_score(y_data,y_pred)*100<compute_train_metric>
import gzip
rto = RandomForestClassifier(n_estimators=28)
 rto.fit(x_data,y_data.values.ravel())
 y_pred = rto.predict(x_data)
 accuracy_score(y_data,y_pred)*100<categorify>
ff = 1.08
weights = [ 0.27, 0.18,
0.20, 0.35 ]
new_test_data['Embarked'] = lb1.fit_transform(new_test_data['Embarked'])
 new_test_data<drop_column>
print(sum(weights))
x_data1 = x_data.drop('Fare_binned',axis= 1,inplace= False)
 x_data1<drop_column>
if CORRECT_FOR_BUG:
weights[1] /= 10
new_test_data1 = new_test_data.drop('Fare_binned',axis= 1,inplace= False)
 new_test_data1<choose_model_class>
fnames =('output_dataset2017a.csv',
'finalXgbApril20171017_011204.csv',
'2017Q4.csv',
'catboost_opt4.csv')
 output="withReoptimizedXGB.csv"
model_names = {
'svm' : {
'model': SVC(gamma='auto'),
'params': {
'C': [1,5,10,15,20,25,26,28,29,30],
'kernel' : ['rbf','linear']
}
},
'logistic_regression': {
'model': LogisticRegression(solver='liblinear',multi_class='auto'),
'params' : {
'C': [1,5,10,15,20,25,26,28,29,30],
}
},
'random_forest' : {
'model' : RandomForestClassifier() ,
'params' : {
'n_estimators' : [1,5,10,15,20,25,26,28,29,30]
}
},
'xgboost' : {
'model' : xgb.XGBClassifier(objective ='reg:logistic', colsample_bytree = 0.3, learning_rate = 0.1,
max_depth = 5),
'params' : {
'alpha' : [0.1,1,10,100,1.1],
'n_estimators' : [1,5,10,15,20,25,26,28,29,30]
}
},
'bagging_classifier' : {
'model' : BaggingClassifier(DecisionTreeClassifier() , max_samples= 0.5,max_features=1.0),
'params' : {
'n_estimators' : [1,5,10,15,20,25,26,28,29,30]
}
},
'adbboost_classifier' : {
'model' : AdaBoostClassifier(DecisionTreeClassifier() ,learning_rate=1),
'params' : {
'n_estimators' : [1,5,10,15,20,25,26,28,29,30]
}
}
}<import_modules>
if ACTUALLY_DO_SOMETHING:
for id, r in zip(ids,result):
fs.write(id)
 for j in range(6):
fs.write("," +str(round(r[j],6)))
 fs.write("
" )
from sklearn.model_selection import GridSearchCV<import_modules>
if ACTUALLY_DO_SOMETHING:
fs.close()
from sklearn.model_selection import GridSearchCV<train_on_grid>
if ACTUALLY_DO_SOMETHING:
f_in = open(output, 'rb')
 f_out = gzip.open(output+'.gz', 'wb')
 f_out.writelines(f_in)
 f_out.close()
f_in.close()
<create_dataframe><EOS> 
2+2