我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用sklearn.tree.ExtraTreeRegressor()。
def ext(X,y): X_train,X_validation,y_train,y_validation = train_test_split(X,y,random_state=0) ext = ExtraTreeRegressor(random_state=1) ext.fit(X_train,y_train.ravel()) print 'training error:',1.0 - ext.score(X_train,y_train) print 'validation error:',1.0 - ext.score(X_validation,y_validation) time_fit(ext,X_train,y_train.ravel())
def __init__(self, base_estimator=None, n_estimators=50, max_features=1.0, max_depth=6, learning_rate=1.0, loss='linear', random_state=None): if base_estimator and base_estimator == 'etr': base_estimator = ExtraTreeRegressor(max_depth=max_depth, max_features=max_features) else: base_estimator = DecisionTreeRegressor(max_depth=max_depth, max_features=max_features) self.model = sklearn.ensemble.AdaBoostRegressor( base_estimator=base_estimator, n_estimators=n_estimators, learning_rate=learning_rate, random_state=random_state, loss=loss)