Skip to content

Commit

Permalink
Save grid_search performance metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dhimmel committed Sep 21, 2016
1 parent a050db0 commit eb1b670
Show file tree
Hide file tree
Showing 2 changed files with 1,269 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cognoml/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def classify(sample_id, mutation_status, **kwargs):
obs_df['testing'] = obs_df.sample_id.isin(X_test.index).astype(int)

pipeline.fit(X=X_train, y=y_train)
#cv_score_df = grid_scores_to_df(clf_grid.grid_scores_)

predict_df = pd.DataFrame.from_items([
('sample_id', X_whole.index),
Expand Down Expand Up @@ -95,6 +94,12 @@ def classify(sample_id, mutation_status, **kwargs):
performance['cv'] = {'auroc': round(clf_grid.best_score_, 5)}
results['performance'] = performance

gs = collections.OrderedDict()
gs['mean_scores'] = utils.mean_grid_scores_to_df(clf_grid.grid_scores_)
gs['fold_scores'] = utils.grid_scores_to_df(clf_grid.grid_scores_)
gs = utils.value_map(gs, utils.df_to_datatables)
results['grid_search'] = gs

results['model'] = utils.model_info(clf_grid.best_estimator_)

feature_df = utils.get_feature_df(clf_grid.best_estimator_, X.columns)
Expand Down
Loading

0 comments on commit eb1b670

Please sign in to comment.