text_plain_output_1.png
from sklearn import ensemble

from sklearn.metrics import roc_auc_score

import matplotlib.pyplot as plt

import pandas as pd

import xgboost as xgb

xgb = xgb.XGBRFRegressor()
tree = ensemble.RandomForestRegressor()
ada = ensemble.AdaBoostRegressor()
grad = ensemble.GradientBoostingRegressor()

clf = ensemble.AdaBoostRegressor(n_estimators=500, learning_rate=0.5)
selector = clf.fit(X_train, y_train)
feat_imp = pd.Series(clf.feature_importances_, index=X_train.columns.values).sort_values(ascending=False)

features = feat_imp[:40].index

X_train = X_train[features]
X_test = X_test[features]
X_valid = X_valid[features]

clf.fit(X_train, y_train)
preds = clf.predict(X_test)
val_pred = clf.predict(X_valid)
(roc_auc_score(y_test, preds), roc_auc_score(y_valid, val_pred))

pros = clf.predict(data_for_sub[features])

sub = pd.DataFrame()
sub['ID'] = test_data['ID']
sub['target'] = pros
sub.to_csv('submission.csv', index=False)
test = pd.read_csv('submission.csv')
test.head()