text_plain_output_5.png application_vnd.jupyter.stderr_output_2.png text_plain_output_9.png application_vnd.jupyter.stderr_output_4.png application_vnd.jupyter.stderr_output_6.png application_vnd.jupyter.stderr_output_8.png text_plain_output_3.png text_plain_output_7.png text_plain_output_1.png
from sklearn import ensemble

import matplotlib.pyplot as plt

import pandas as pd

import xgboost as xgb

train_data = train_data.sample(n=5000)
train_data.shape

train_data.corr()

train_data.TARGET.value_counts()

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

for i in features[0:5]:
    x = train_data[i].value_counts().head().index
    y = train_data[i].value_counts().head()
    plt.figure()
    plt.scatter(y, x)
    plt.xlabel(i)