EL之RF(RFC):利用RF对二分类问题进行建模并评估

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_41185868/article/details/86419543

EL之RF(RFC):利用RF对二分类问题进行建模并评估

输出结果

设计思路

核心代码

auc = []
nTreeList = range(50, 2000, 50)
for iTrees in nTreeList:
    depth = None
    maxFeat  = 8 
    rocksVMinesRFModel = ensemble.RandomForestClassifier(n_estimators=iTrees, max_depth=depth, max_features=maxFeat,
                                                 oob_score=False, random_state=531)

    rocksVMinesRFModel.fit(xTrain,yTrain)

    prediction = rocksVMinesRFModel.predict_proba(xTest) 
    aucCalc = roc_auc_score(yTest, prediction[:,1:2])
    auc.append(aucCalc)

猜你喜欢

转载自blog.csdn.net/qq_41185868/article/details/86419543
RF