reinhardfechter / FlexPVCModel

1 stars 2 forks source link

use heapq.nlargest in get_top_models #4

Closed alchemyst closed 8 years ago

alchemyst commented 8 years ago

heapq in the standard library has an nlargest method which allows you to replace all the sorting and selecting code in get_top_models with

top_entries = heapq.nlargest(db.query(...), no_models, key=lambda e: e['kfold_scores'])