Created
December 8, 2017 03:23
-
-
Save groverpr/e2dade6b244b3ad7a3d650b7f0ebec74 to your computer and use it in GitHub Desktop.
residual and update target variable
This file contains hidden or 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
# predictions by ith decisision tree | |
predi = np.zeros(n) | |
np.put(predi, left_idx, np.repeat(np.mean(yi[left_idx]), r)) # replace left side mean y | |
np.put(predi, right_idx, np.repeat(np.mean(yi[right_idx]), n-r)) # right side mean y | |
predi = predi[:,None] # make long vector (nx1) in compatible with y | |
predf = predf + predi # final prediction will be previous prediction value + new prediction of residual | |
ei = y - predf # needed originl y here as residual always from original y | |
yi = ei # update yi as residual to reloop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment