ulsif | R Documentation |
Unconstrained least-squares importance fitting
ulsif(
df_numerator,
df_denominator,
intercept = TRUE,
scale = "numerator",
nsigma = 10,
sigma_quantile = NULL,
sigma = NULL,
nlambda = 20,
lambda = NULL,
ncenters = 200,
centers = NULL,
parallel = FALSE,
nthreads = NULL,
progressbar = TRUE
)
df_numerator |
|
df_denominator |
|
intercept |
|
scale |
|
nsigma |
Integer indicating the number of sigma values (bandwidth parameter of the Gaussian kernel gram matrix) to use in cross-validation. |
sigma_quantile |
|
sigma |
|
nlambda |
Integer indicating the number of |
lambda |
|
ncenters |
Maximum number of Gaussian centers in the kernel gram matrix. Defaults to all numerator samples. |
centers |
|
parallel |
logical indicating whether to use parallel processing in the cross-validation scheme. |
nthreads |
|
progressbar |
Logical indicating whether or not to display a progressbar. |
ulsif
-object, containing all information to calculate the
density ratio using optimal sigma and optimal weights.
Kanamori, T., Hido, S., & Sugiyama, M. (2009). A least-squares approach to direct importance estimation. Journal of Machine Learning Research, 10, 1391-1445. Available from https://jmlr.org/papers/v10/kanamori09a.html
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.