kme: Calculate the kernel mean embedding matrix

View source: R/kme.R

kmeR Documentation

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

## Default S3 method:
kme(df, df2 = NULL, sigma = 0.05, ...)

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

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.

Details

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

Value

A matrix of kernel mean embedding at the instance level.

Methods (by class)

  • default: Default S3 method

  • mild_df: S3 method for class mild_df

Author(s)

Yifei Liu, Sean Kent

Examples

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)


mildsvm documentation built on July 14, 2022, 9:08 a.m.