Skip to content

Instantly share code, notes, and snippets.

@prratek
Created September 23, 2018 19:47
Show Gist options
  • Save prratek/406b67cf34e6fca96f311ce28d07691e to your computer and use it in GitHub Desktop.
Save prratek/406b67cf34e6fca96f311ce28d07691e to your computer and use it in GitHub Desktop.
Increase in R^2 as we increase n_estimators
import numpy as np
import matplotlib.pyplot as plt
from sklearn import metrics
preds = np.stack([t.predict(X_valid) for t in m.estimators_])
preds[:,0], np.mean(preds[:,0])
plt.plot([metrics.r2_score(y_valid, np.mean(preds[:i+1], axis=0)) for i in range(10)]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment