from sklearn.base import BaseEstimator
class random(BaseEstimator):
def __init__(self):
self.model=xgboost.XGBClassifier()
def fit(self,x,y):
self.model.fit(x,y)
return self.model
def predict(self,x):
return self.model.predict(x)
rfc=random()
val=cross_val_score(rfc,train_x_array[:,x.astype(bool)],train_y_array,scoring='accuracy',cv=10,n_jobs=-1)
val.mean()
0.7609086695594499
得分下降?
val=cross_val_score(xgboost.XGBClassifier(),train_x_array[:,x.astype(bool)],train_y_array,scoring='accuracy',cv=10,n_jobs=-1)
val.mean()
0.8668378762815749
是BaseEstimator的问题吗?