Skip to content

ENH method to index ParameterGrid points by parameter values#1842

Closed
jnothman wants to merge 4 commits intoscikit-learn:masterfrom
jnothman:parameter_dimensions
Closed

ENH method to index ParameterGrid points by parameter values#1842
jnothman wants to merge 4 commits intoscikit-learn:masterfrom
jnothman:parameter_dimensions

Conversation

@jnothman
Copy link
Copy Markdown
Member

@jnothman jnothman commented Apr 7, 2013

This extension intends to solve #1020 for regular grids: it provides an index into the grid points output by ParameterGrid, such that results from GridSearchCV (particularly when returned as an array as in #1787) can be accessed by parameter value.

For example, I could get the mean test_score for each 'max_depth' value:

grid_search = GridSearchCV(clf, {'max_depth': range(1, 5), 'max_features': range(1, 3)})
grid_search.fit(...)
grid = ParameterGrid(grid_search.param_grid) # should we make it easier to get the ParameterGrid?
keys, index = grid.build_index(['max_depth'], ravel=True)
indexed = np.array(candidate.mean_validation_score for candidate in [grid_search.cv_scores_])[index]
print(indexed.mean(axis=1))

This PR aims to account for most of the functionality of #1034 within the current parameter search framework. The examples from there should be adopted.

@jnothman
Copy link
Copy Markdown
Member Author

jnothman commented Apr 7, 2013

Accessing this functionality from GridSearchCV should probably be less verbose...

@jnothman
Copy link
Copy Markdown
Member Author

Closing due to lack of interest.

@jnothman jnothman closed this Aug 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant