python类ExtraTreeRegressor()的实例源码

comparision-tree-based-methods.py 文件源码 项目:groot 作者: zhpmatrix 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
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())
skl_utils.py 文件源码 项目:Kaggle_HomeDepot 作者: ChenglongChen 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号