This function returns an estimation of the optimum value for the gamma hyperparameter (required by the RBF kernel function) using different heuristics:
- D criterion
It returns the inverse of the number of features in X.
- Scale criterion
It returns the inverse of the number of features, normalized by the total variance of X.
- Quantiles criterion
A range of values, computed with the function `kernlab::sigest()`.
Examples
data <- matrix(rnorm(150),ncol=50,nrow=30)
gamma <- estimate_gamma(data)
gamma
#> $d_criterion
#> [1] 0.02
#>
#> $scale_criterion
#> [1] 0.02081624
#>
#> $quantiles_criterion
#> 90% 50% 10%
#> 0.006118612 0.011947701 0.029490575
#>
K <- RBF(data, g = gamma$scale_criterion)
K[1:5,1:5]
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1.00000000 0.05736523 0.42652586 0.06450117 0.1484147
#> [2,] 0.05736523 1.00000000 0.06112368 0.01671617 0.2770090
#> [3,] 0.42652586 0.06112368 1.00000000 0.46120814 0.2436350
#> [4,] 0.06450117 0.01671617 0.46120814 1.00000000 0.1809315
#> [5,] 0.14841470 0.27700897 0.24363504 0.18093149 1.0000000