Learn R Programming

mildsvm (version 0.4.1)

kme: Calculate the kernel mean embedding matrix

Description

Function to calculate the kernel mean embedding for to distributional data sets. It uses the empirical approximation for the integral $$\int_{\mathcal X} \int_{\mathcal Y} K(x, y) d P_X d Q_Y $$ for a given kernel \(K(\cdot, \cdot)\). Currently only supports radial basis function kernel for fast computation.

Usage

# S3 method for default
kme(df, df2 = NULL, sigma = 0.05, ...)

# S3 method for mild_df kme(df, df2 = NULL, sigma = 0.05, ...)

Value

A matrix of kernel mean embedding at the instance level.

Arguments

df

A data.frame of mild_df object, must have column 'instance_name' which defines the instances.

df2

A data.frame, mild_df object, or NULL (default NULL).

sigma

The parameter for 'radial' kernel (default 0.05).

...

Additional arguments passed to methods.

Methods (by class)

  • kme(default): Default S3 method

  • kme(mild_df): S3 method for class mild_df

Author

Yifei Liu, Sean Kent

Details

If df2 = NULL, calculate the kernel mean embedding matrix of (df, df) otherwise calculate (df, df2)

Examples

Run this code
x = data.frame('instance_name' = c('inst_1', 'inst_2', 'inst_1'),
               'X1' = c(-0.4, 0.5, 2))
kme(x)

mild_df1 <- generate_mild_df(nbag = 10, positive_degree = 3)
kme(mild_df1)

Run the code above in your browser using DataLab