Stock_Prediction_Model_Random_Forrest.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:StockRecommendSystem 作者: doncat99 项目源码 文件源码
def perform_CV(self, X_train, y_train, number_folds, n, m):
        model = RandomForestClassifier(n_estimators=n, max_features=m, n_jobs=8, verbose=self.paras.verbose)
        acc = np.mean(cross_val_score(model, X_train, y_train, cv=number_folds))
        #print 'Size of Forrest : number of trees : ' + str(n) + ', maximum of features : ' + str(m) + '. Accuracy : ' + str(acc)
        return acc

    # MODEL SELECTION : Find best parameters ######################################
    ## Inputs :  X_train, y_train, number of folds, range of number of trees, range of max of features
    ## Outputs : optimal number of trees, optimal max of features, accuracy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号