spectral | R Documentation |
Spectral series based density ratio estimation
spectral(
df_numerator,
df_denominator,
m = NULL,
scale = "numerator",
nsigma = 10,
sigma_quantile = NULL,
sigma = NULL,
ncenters = NULL,
cv = TRUE,
nfold = 10,
parallel = FALSE,
nthreads = NULL,
progressbar = TRUE
)
df_numerator |
|
df_denominator |
|
m |
Integer vector indicating the number of eigenvectors to use in the spectral series expansion. Defaults to 50 evenly spaced values between 1 and the number of denominator samples (or the largest number of samples that can be used as centers in the cross-validation scheme). |
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 |
|
ncenters |
integer If smaller than the number of denominator observations,
an approximation to the eigenvector expansion based on only ncenters samples
is performed, instead of the full expansion. This can be useful for large
datasets. Defaults to |
cv |
logical indicating whether to use cross-validation to determine the optimal sigma value and the optimal number of eigenvectors. |
nfold |
Integer indicating the number of folds to use in the
cross-validation scheme. If |
parallel |
logical indicating whether to use parallel processing in the cross-validation scheme. |
nthreads |
|
progressbar |
Logical indicating whether or not to display a progressbar. |
spectral
-object, containing all information to calculate the
density ratio using optimal sigma and optimal spectral series expansion.
Izbicki, R., Lee, A. & Schafer, C. (2014). High-Dimensional Density Ratio Estimation with Extensions to Approximate Likelihood Computation. Proceedings of Machine Learning Research 33, 420-429. Available from https://proceedings.mlr.press/v33/izbicki14.html.
set.seed(123)
# Fit model
dr <- spectral(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
spectral(numerator_small, denominator_small, sigma = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.