How to graph grid scores from GridSearchCV?

前端 未结 10 1007
旧时难觅i
旧时难觅i 2021-01-30 03:19

I am looking for a way to graph grid_scores_ from GridSearchCV in sklearn. In this example I am trying to grid search for best gamma and C parameters for an SVR algorithm. My c

10条回答
  •  离开以前
    2021-01-30 04:13

    The order that the parameter grid is traversed is deterministic, such that it can be reshaped and plotted straightforwardly. Something like this:

    scores = [entry.mean_validation_score for entry in grid.grid_scores_]
    # the shape is according to the alphabetical order of the parameters in the grid
    scores = np.array(scores).reshape(len(C_range), len(gamma_range))
    for c_scores in scores:
        plt.plot(gamma_range, c_scores, '-')
    

提交回复
热议问题