
Kernel and RKHS methods
morie_kernel_methods.RdKernel matrices, reproducing-kernel Hilbert space regression, kernel BLUP, and the Nystrom and eigenvalue compressions used to make them scale.
Usage
morie_kernel_matrix(X, kernel = "linear", gamma = NULL, degree = 2, coef0 = 1, Z = NULL)
morie_rkhs_fit(K, y, lambda = 1)
morie_rkhs_predict(K_new, beta, eta0 = 0)
morie_rkhs_mixed_equations(C, K, y, lambda = 1, sigma2_e = 1, form = "direct")
morie_arccos_kernel(X, Z = NULL, depth = 1L, normalize_median = FALSE)
morie_bayesian_kernel_blup(y, K, sigma2_u = 1, sigma2_e = 1, mu = NULL)
morie_kernel_blup_gxe(Z_u1, K, Z_E, sigma2_u1 = 1, sigma2_u2 = 1)
morie_kernel_blup_replicated(Z, K, sigma2_u = 1)
morie_kernel_eigen_design(K, tol = 1e-10)
morie_nystrom(X, m_index, kernel = "linear", gamma = NULL)
morie_sparse_kernel_design(X, m_index, kernel = "linear", gamma = NULL, tol = 1e-10)Arguments
- X
numeric matrix of inputs, one row per observation
- y
numeric response vector
- kernel
kernel name, one of linear, gaussian, polynomial, exponential, sigmoid or arccos
- gamma
argument
gamma; not described in the source.- degree
argument
degree; not described in the source.- coef0
argument
coef0; not described in the source.- Z
argument
Z; not described in the source.- K
argument
K; not described in the source.- lambda
argument
lambda; not described in the source.- K_new
argument
K_new; not described in the source.- beta
argument
beta; not described in the source.- eta0
argument
eta0; not described in the source.- C
argument
C; not described in the source.- sigma2_e
argument
sigma2_e; not described in the source.- form
argument
form; not described in the source.- depth
argument
depth; not described in the source.- normalize_median
argument
normalize_median; not described in the source.- sigma2_u
argument
sigma2_u; not described in the source.- mu
argument
mu; not described in the source.- Z_u1
argument
Z_u1; not described in the source.- Z_E
argument
Z_E; not described in the source.- sigma2_u1
argument
sigma2_u1; not described in the source.- sigma2_u2
argument
sigma2_u2; not described in the source.- tol
argument
tol; not described in the source.- m_index
argument
m_index; not described in the source.
Value
A list holding the fitted quantities for the method called: point estimates, fitted values and any diagnostics it produces. See the individual method descriptions above for the components each returns.
Details
These functions mirror, in R, the implementations in the Python package
morie; the two are checked against each other by the parity
tests in tests/testthat/.
Examples
set.seed(1)
X <- matrix(rnorm(20), 10, 2)
morie_kernel_matrix(X, kernel = "gaussian", gamma = 0.5)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 1.000000e+00 0.38385091 0.1005834 8.178777e-05 0.587571210 0.292146095
#> [2,] 3.838509e-01 1.00000000 0.3567918 1.242329e-02 0.755167901 0.549560938
#> [3,] 1.005834e-01 0.35679179 1.0000000 1.463680e-02 0.110434925 0.846893967
#> [4,] 8.178777e-05 0.01242329 0.0146368 1.000000e+00 0.001699098 0.005134027
#> [5,] 5.875712e-01 0.75516790 0.1104349 1.699098e-03 1.000000000 0.260405803
#> [6,] 2.921461e-01 0.54956094 0.8468940 5.134027e-03 0.260405803 1.000000000
#> [7,] 1.673420e-01 0.87934806 0.3470509 4.829680e-02 0.515020620 0.424980947
#> [8,] 3.353465e-01 0.73543742 0.0851452 4.722759e-03 0.904870636 0.181999593
#> [9,] 3.824638e-01 0.84372422 0.1304994 5.927825e-03 0.926403739 0.259274292
#> [10,] 6.232589e-01 0.86901416 0.4152551 3.181533e-03 0.709962745 0.714116806
#> [,7] [,8] [,9] [,10]
#> [1,] 0.1673420 0.335346506 0.382463815 0.623258942
#> [2,] 0.8793481 0.735437422 0.843724223 0.869014161
#> [3,] 0.3470509 0.085145203 0.130499350 0.415255092
#> [4,] 0.0482968 0.004722759 0.005927825 0.003181533
#> [5,] 0.5150206 0.904870636 0.926403739 0.709962745
#> [6,] 0.4249809 0.181999593 0.259274292 0.714116806
#> [7,] 1.0000000 0.611219138 0.701501641 0.606296816
#> [8,] 0.6112191 1.000000000 0.979485944 0.545585514
#> [9,] 0.7015016 0.979485944 1.000000000 0.660956522
#> [10,] 0.6062968 0.545585514 0.660956522 1.000000000