Last active
July 27, 2020 02:55
-
-
Save stasSajin/63ee07ea18574e62244ea7be9c2084b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def estimate_rf(df): | |
X = df.income.values.reshape(-1,1) | |
y = df.minutes.values | |
rf_reg = RandomForestRegressor(100, n_jobs=8, oob_score=True) | |
rf_reg.fit(X,y) | |
# store residuals | |
y_new = df.minutes - reg.oob_prediction_ | |
return y_new[df[group == 1]].mean() - y_new[df[group == 0]].mean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment