grid_search
Builtin index · Statistics & ML
result = grid_search(fit, X, y, grid, [folds=5], [shuffle=true], [seed=], [metric="auto"])
Input: fit, X, y, grid, folds, shuffle, seed, metric · Output: result
What it is
Cross-validates fit(X, y, params) over every combination of grid, a record of lists such as {k = [1, 3, 5], tag = [10, 20]} (a single value counts as a one-point list; the last name varies fastest; at most 10000 combinations). params is the record of one combination. Every combination is scored on the SAME folds, and error metrics (rmse, mae, mse, brier) are minimized while the others are maximized.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = grid_search(fit, X, y, grid, [folds=5], [shuffle=true], [seed=], [metric="auto"]) | fit —Cross-validates fit(X, y, params) over every combination of grid, a record of lists such as {k = [1, 3, 5], tag = [10, 20]} (a single value counts as a one-point list.X —Cross-validates fit(X, y, params) over every combination of grid, a record of lists such as {k = [1, 3, 5], tag = [10, 20]} (a single value counts as a one-point list.y —Cross-validates fit(X, y, params) over every combination of grid, a record of lists such as {k = [1, 3, 5], tag = [10, 20]} (a single value counts as a one-point list.grid —Cross-validates fit(X, y, params) over every combination of grid, a record of lists such as {k = [1, 3, 5], tag = [10, 20]} (a single value counts as a one-point list.folds optional (default 5)Every combination is scored on the SAME folds, and error metrics (rmse, mae, mse, brier) are minimized while the others are maximized.shuffle optional (default true)not documented yetseed optionalnot documented yetmetric optional (default "auto")Returns {best_params, best_score, best_index, scores, results, folds, metric}, where results is a list of {params, mean, std}. | result — | Returns {best_params, best_score, best_index, scores, results, folds, metric}, where results is a list of {params, mean, std}. |
Examples
No documentation example calls this form yet. The Statistics & ML chapter is where one belongs.
How it works
grid_search(fit, X, y, grid, [folds=5], [shuffle=true], [seed=], [metric=]) -- cross-validate fit(X, y, params) over every combination of a record of lists, e.g. {k = [1, 3, 5], p = [1, 2]}, all on the same folds, and report the best.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.