## models.grid_search()


Scores every candidate by [cross_validate](models.cross_validate.md#prospicio.models.cross_validate) on the same splits and


Usage

``` python
models.grid_search(
    candidates,
    make,
    design,
    y,
    splits,
    score,
    n_jobs=None,
)
```


picks the lowest mean score.


## Parameters


`candidates: list`  
Hyperparameter values, in any form `make` accepts.

`make: callable`  
`make(candidate) -> model`.

`design: Design`  

`y: list of float`  

`splits: list of (list of int, list of int)`  

`score: callable`  
As [cross_validate](models.cross_validate.md#prospicio.models.cross_validate).

`n_jobs: int = None`  


## Returns


`SearchResult`  


## Examples

``` python
>>> from prospicio.models import Design, ElasticNet, deviance_score, grid_search, k_fold
>>> x = [i / 10 for i in range(40)]
>>> d = Design([[1.0] * 40, x], ["(Intercept)", "x"])
>>> y = [1.0 + 2.0 * v for v in x]
>>> found = grid_search([0.0, 1.0, 10.0], lambda lam: ElasticNet("gaussian", lam=lam),
...                     d, y, k_fold(40, 4, 1), deviance_score("gaussian"))
>>> found.best_candidate
```

0.0
