天天看點

python 模型交叉驗證法_machine learning in coding(python):使用交叉驗證【選擇模型超參數】...

# Hyperparameter selection loop

score_hist = []

Cvals = [0.001, 0.003, 0.006, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.1]

for C in Cvals:

model.C = C

score = cv_loop(Xt, y, model, N)

score_hist.append((score,C))

print "C: %f Mean AUC: %f" %(C, score)

bestC = sorted(score_hist)[-1][1]

print "Best C value: %f" % (bestC)

from kaggle

版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。