grid_search_1d {structToolbox} | R Documentation

## grid_search_1d class

### Description

Carries out a grid search for a single parameter to try and identify the 'best' value for the parameter based on the input metric.

### Usage

    grid_search_1d(
      param_to_optimise,
      search_values,
      model_index,
      factor_name,
      max_min = "min",
      ...
    )

### Arguments

`param_to_optimise` | The name of an input parameter of the model the optimise
`search_values` | A vector of values to search for the optimum
`model_index` | A number indicating which step of a model_seq is to be optimised
`factor_name` | The sample_meta column name to use
`max_min` | 'A string 'max' or 'min' to indicate whether to maximise or minimise the metric
`...` | additional slots and values passed to struct_class

### Value

struct object

### Examples

    D = MTBLS79_DatasetExperiment()
    # some preprocessing
    M = pqn_norm(qc_label='QC',factor_name='class') +
        knn_impute() +
        glog_transform(qc_label='QC',factor_name='class') +
        filter_smeta(factor_name='class',levels='QC',mode='exclude')
    M=model_apply(M,D)
    D=predicted(M)

    # reduce number of features for this example
    D=D[,1:10]

    # optmise number of components for PLS model
    I = grid_search_1d(param_to_optimise='number_components',search_values=1:5,
            model_index=2,factor_name='class') *
            (mean_centre()+PLSDA(factor_name='class'))
    I = run(I,D,balanced_accuracy())

[Package structToolbox version 1.0.1 Index]