machine learning in coding(python):使用交叉验证【选择模型超参数】

来源:互联网 发布:库管软件免费版 编辑:程序博客网 时间:2024/05/22 08:37



# Hyperparameter selection loopscore_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

1 0