Python sklearn.tree 模块,ExtraTreeRegressor() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用sklearn.tree.ExtraTreeRegressor()

项目:groot    作者:zhpmatrix    | 项目源码 | 文件源码
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())
项目:Kaggle_HomeDepot    作者:ChenglongChen    | 项目源码 | 文件源码
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)