Skip to content

ENH method to index ParameterGrid points by parameter values #1842

Closed
wants to merge 4 commits into from

1 participant

@jnothman
scikit-learn member
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
scikit-learn member
jnothman commented Apr 7, 2013

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

@jnothman
scikit-learn member

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
Something went wrong with that request. Please try again.