Skip to contents

How cross-validation runs, shared by fineMappingPipeline and twasWeightsPipeline.

folds, numThreads, samplePartition and fitFullData mean the same thing in both. maxVariants and weightMethods are honoured by twasWeightsPipeline only and are ignored by fineMappingPipeline, so one bundle can be handed to either pipeline unchanged.

Usage

CrossValidationParam(
  folds = 0,
  numThreads = 1,
  samplePartition = NULL,
  maxVariants = NULL,
  weightMethods = NULL,
  fitFullData = TRUE
)

Arguments

folds

Integer. Number of folds; 0 (the default) or 1 skips cross-validation. The same value in both pipelines — twasWeightsPipeline used to default to 5, which made an unspecified setting mean two different things.

numThreads

Integer. Parallel workers for the per-fold refits. 1 (default) is serial; -1 uses all cores. Only consulted when folds > 1.

samplePartition

Optional pre-defined partition data.frame with columns Sample and Fold. When supplied, every method reuses this exact partition instead of generating a fresh one.

maxVariants

Integer. Cap on the number of variants used for CV; unset means no limit. twasWeightsPipeline only — fineMappingPipeline ignores it, because it does not use the twasWeightsCv engine this configures.

weightMethods

Optional override of which methods are cross-validated, as a character vector of tokens or a named method list. Unset cross-validates every method that produced non-zero weights. twasWeightsPipeline only — fineMappingPipeline ignores it, because its methods= are fine-mapping methods and its CV refits all of them.

fitFullData

Logical. TRUE (default) fits the final model on the full data as well as cross-validating it; FALSE keeps only the cross-validation results, and requires folds >= 2. A row from such a run carries its cvResult and nothing else, so it cannot be exported and cannot supply full-data weights or fits downstream.

Value

A CrossValidationParam object, a MethodParam.

Examples

CrossValidationParam(folds = 10, numThreads = 4)
#> <CrossValidationParam>
#>   folds                    10
#>   numThreads               4
#>   fitFullData              TRUE
#>   unset: samplePartition, maxVariants, weightMethods
CrossValidationParam(folds = 5, fitFullData = FALSE)
#> <CrossValidationParam>
#>   folds                    5
#>   numThreads               1
#>   fitFullData              FALSE
#>   unset: samplePartition, maxVariants, weightMethods