predict.ulsif: Obtain predicted density ratio values from a 'ulsif' object

View source: R/predict.R

predict.ulsifR Documentation

Obtain predicted density ratio values from a ulsif object

Description

Obtain predicted density ratio values from a ulsif object

Usage

## S3 method for class 'ulsif'
predict(
  object,
  newdata = NULL,
  sigma = c("sigmaopt", "all"),
  lambda = c("lambdaopt", "all"),
  ...
)

Arguments

object

A ulsif object

newdata

Optional matrix new data set to compute the density

sigma

A scalar with the Gaussian kernel width

lambda

A scalar with the regularization parameter

...

Additional arguments to be passed to the function

Value

An array with predicted density ratio values from possibly new data, but otherwise the numerator samples.

See Also

predict, ulsif

Examples

set.seed(123)
# Fit model
dr <- ulsif(numerator_small, denominator_small)
# Inspect model object
dr
# Obtain summary of model object
summary(dr)
# Plot model object
plot(dr)
# Plot density ratio for each variable individually
plot_univariate(dr)
# Plot density ratio for each pair of variables
plot_bivariate(dr)
# Predict density ratio and inspect first 6 predictions
head(predict(dr))
# Fit model with custom parameters
ulsif(numerator_small, denominator_small, sigma = 2, lambda = 2)

densityratio documentation built on June 8, 2025, 11:17 a.m.