Skip to content

Instantly share code, notes, and snippets.

@mxposed
Created December 29, 2016 18:53
Show Gist options
  • Save mxposed/836f388f7c103d632c92961a7764250d to your computer and use it in GitHub Desktop.
Save mxposed/836f388f7c103d632c92961a7764250d to your computer and use it in GitHub Desktop.
# таблица с результатами и параметрами
clf.grid_scores_
# отфильтровать из неё записи, где параметр p был 2, а параметр weights был distance и положить результат в переменную means
means = filter(lambda x: x[0]['p'] == 2 and x[0]['weights'] == 'distance', clf.grid_scores_)
# нарисовать график, в котором по оси абсцисс параметр n_neighbors, а по оси ординат score
plt.plot([x[0]['n_neighbors'] for x in means], [x[1] for x in means])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment