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.01741803
#>
#> $quantiles_criterion
#> 90% 50% 10%
#> 0.003503285 0.008025082 0.021982630
#>
K <- RBF(data, g = gamma$scale_criterion)
K[1:5,1:5]
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1.00000000 0.14223781 0.07334868 0.03569634 0.5918622
#> [2,] 0.14223781 1.00000000 0.15892850 0.02099132 0.1941606
#> [3,] 0.07334868 0.15892850 1.00000000 0.56999694 0.2103567
#> [4,] 0.03569634 0.02099132 0.56999694 1.00000000 0.1326039
#> [5,] 0.59186218 0.19416062 0.21035672 0.13260392 1.0000000