Skip to contents

Parameter Selection via Cross-Validation

Usage

smooth_cv(
  input,
  lambda,
  k,
  test_size,
  seed = 1,
  epsilon = 0.001,
  maxiter = 1000
)

Arguments

input

SummarizedExperiment object containing counts assay and row/col coordinates.

lambda

positive numeric; penalization parameter.

k

integer; indicates desired rank of singular value decomposition.

test_size

The number of pixels to use in the test set.

seed

A random seed to produce consistent pixel samples across parameter values for cross-validation.

epsilon

positive numeric; convergence criterion.

maxiter

positive integer; maximum desired iterations

Value

A list containing the penalized likelihood from the model and the cross-validated likelihood from the test set.

Examples

sce <- example_sce()
smooth_cv(sce, 1, 10, 100, maxiter = 10)
#> [1] "Initializing components..."
#> [1] "Running smoothLRC on training set..."
#> iteration: 1 | convergence: 0.109983 | 0.0353055 | 1
#> iteration: 2 | convergence: 0.0878038 | 0.0276444 | 0.00521925
#> iteration: 3 | convergence: 0.0809419 | 0.0335208 | 0.00531674
#> iteration: 4 | convergence: 0.0788443 | 0.0370668 | 0.00565751
#> iteration: 5 | convergence: 0.0804564 | 0.0382317 | 0.00620999
#> iteration: 6 | convergence: 0.0828163 | 0.0387269 | 0.00693214
#> iteration: 7 | convergence: 0.0840712 | 0.0391454 | 0.00779395
#> iteration: 8 | convergence: 0.0845036 | 0.0395961 | 0.00878049
#> iteration: 9 | convergence: 0.0842482 | 0.0400416 | 0.00988202
#> iteration: 10 | convergence: 0.0832994 | 0.0404311 | 0.0110892
#> [1] "Compute neighborhood likelihood..."
#> [1] "Done!"
#> $penal_like
#> [1] -78940.2
#> 
#> $cv_like
#> [1] -968.7851
#>