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 SHXGBEstimator(SHBaseEstimator): | |
def __init__(self,model): | |
self.model = model | |
self.env = {'best_score':-np.infty,'best_iteration':-1,'earlier_stop':False} | |
def update(self,Xtrain,ytrain,Xval,yval,scoring,n_iterations): | |
dtrain = DMatrix(data=Xtrain,label=ytrain) | |
for i in range(n_iterations-self.model.n_estimators): | |
# note: | |
# this is a get, but the internal booster in XGBClassifier is also updated | |
# add unit test for controle if future updates |
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 SHBaseEstimator(ABC): | |
def __init__(self,model): | |
self.model = model | |
self.env = None | |
def fit(self,X,y): | |
self.model.fit(X,y) | |
def predict(self,X): | |
return self.model.predict(X) |
NewerOlder