gridSearch
- systemds.operator.algorithm.gridSearch(X: Matrix, y: Matrix, train: str, predict: str, params: List, paramValues: List, **kwargs: Dict[str, DAGNode | str | int | float | bool])
The gridSearch-function is used to find the optimal hyper-parameters of a model which results in the most accurate predictions. This function takes train and eval functions by name.
- Parameters:
X – Input feature matrix
y – Input Matrix of vectors.
train – Name ft of the train function to call via ft(trainArgs)
predict – Name fp of the loss function to call via fp((predictArgs,B))
numB – Maximum number of parameters in model B (pass the max because the size may vary with parameters like icpt or multi-class classification)
params – List of varied hyper-parameter names
dataArgs – List of data parameters (to identify data parameters by name i.e. list(“X”, “Y”))
paramValues – List of matrices providing the parameter values as columnvectors for position-aligned hyper-parameters in ‘params’
trainArgs – named List of arguments to pass to the ‘train’ function, where gridSearch replaces enumerated hyper-parameter by name, if not provided or an empty list, the lm parameters are used
predictArgs – List of arguments to pass to the ‘predict’ function, where gridSearch appends the trained models at the end, if not provided or an empty list, list(X, y) is used instead
cv – flag enabling k-fold cross validation, otherwise training loss
cvk – if cv=TRUE, specifies the the number of folds, otherwise ignored
verbose – flag for verbose debug output
- Returns:
Matrix[Double]the trained model with minimal loss (by the ‘predict’ function) Multi-column models are returned as a column-major linearized column vector
- Returns:
one-row frame w/ optimal hyper-parameters (by ‘params’ position)