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
Stock_Prediction_Model_Random_Forrest.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录