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
| import numpy as np | |
| np.random.seed(1) | |
| def f(x): | |
| """The function to predict.""" | |
| return x *np.sin(x) | |
| #---------------------------------------------------------------------- | |
| # First the noiseless case | |
| X = np.atleast_2d(np.random.uniform(0, 10.0, size=100)).T |
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
| class XGBQuantile(XGBRegressor): | |
| def __init__(self,quant_alpha=0.95,quant_delta = 1.0,quant_thres=1.0,quant_var =1.0,base_score=0.5, booster='gbtree', colsample_bylevel=1, | |
| colsample_bytree=1, gamma=0, learning_rate=0.1, max_delta_step=0,max_depth=3, min_child_weight=1, missing=None, n_estimators=100, | |
| n_jobs=1, nthread=None, objective='reg:linear', random_state=0,reg_alpha=0, reg_lambda=1, scale_pos_weight=1, seed=None,silent=True, subsample=1): | |
| self.quant_alpha = quant_alpha | |
| self.quant_delta = quant_delta | |
| self.quant_thres = quant_thres | |
| self.quant_var = quant_var | |
| super().__init__(base_score=base_score, booster=booster, colsample_bylevel=colsample_bylevel, |