Learn R Programming

mildsvm (version 0.4.1)

kfm_nystrom: Fit a Nyström kernel feature map approximation

Description

Use the Nyström method to fit a feature map that approximates a given kernel.

Usage

kfm_nystrom(df, m, r, kernel, sampling, ...)

# S3 method for default kfm_nystrom( df, m = nrow(df), r = m, kernel = "radial", sampling = "random", ... )

# S3 method for mild_df kfm_nystrom( df, m = nrow(df), r = m, kernel = "radial", sampling = "random", ... )

Value

an object of class kfm_nystrom with the following components:

  • df_sub the sub-sampled version of df

  • dv pre-multiplication matrix which contains information on the eigenvalues and eigenvectors of df_sub

  • method 'nystrom'

  • kernel the input parameter kernel

  • kernel_params parameters passed to ...

Arguments

df

An object containing covariates for training. Usually a data.frame or matrix.

m

The number of examples from df to sample in fitting.

r

The rank of matrix approximation to use. Must be less than or equal to m, the default.

kernel

A character determining the kernel to use. Currently, only 'radial' is implemented.

sampling

A character determining how to sample instances. Default is 'random'. For kfm_nystrom.mild_df(), one can specify sampling = 'stratified' to ensure that samples are chosen evenly from bags and instances. sampling can also be a numeric vector of length m of pre-determined samples.

...

additional parameters needed for the kernels. See details.

Methods (by class)

  • kfm_nystrom(default): For use on objects of class data.frame or matrix.

  • kfm_nystrom(mild_df): Ignore the information columns 'bag_label', 'bag_name', and 'instance_name' when calculating kernel approximation.

Author

Sean Kent

Details

For the ... argument, the additional parameters depend on which kernel is used:

  • For kernel = 'radial', specify sigma to define kernel bandwidth.

References

Williams, C., & Seeger, M. (2001). Using the Nyström Method to Speed Up Kernel Machines. Advances in Neural Information Processing Systems, 13, 682–688.

Kent, S., & Yu, M. (2022). Non-convex SVM for cancer diagnosis based on morphologic features of tumor microenvironment arXiv preprint arXiv:2206.14704

See Also

Other kernel feature map functions: kfm_exact()

Examples

Run this code
df <- data.frame(
  X1 = c(2,   3,   4,   5,   6, 7, 8),
  X2 = c(1, 1.2, 1.3, 1.4, 1.1, 7, 1),
  X3 = rnorm(7)
)

fit <- kfm_nystrom(df, m = 7, r = 6, kernel = "radial", sigma = 0.05)
fm <- build_fm(fit, df)

Run the code above in your browser using DataLab