DensityRatioEstimation.DensityRatioEstimator
— TypeDensityRatioEstimator
A method for density ratio estimation.
DensityRatioEstimation.EstimatorFitter
— TypeEstimatorFitter
A method to fit a density ratio estimator.
DensityRatioEstimation.KLIEP
— TypeKLIEP(σ=1.0, b=100)
Kullback-Leibler importance estimation procedure (KLIEP).
Parameters
σ
- Bandwidth of Gaussian kernel (default to2.0
)b
- Maximum number of radial basis functions (default to10
)
References
- Sugiyama et al. 2008. Direct importance estimation for covariate shift adaptation.
Author
- Júlio Hoffimann (julio.hoffimann@gmail.com)
DensityRatioEstimation.KMM
— TypeKMM(σ=1.0, B=Inf, ϵ=0.01, λ=0.001)
Kernel Mean Matching (KMM).
Parameters
σ
- Bandwidth of Gaussian kernel (default to2.0
)B
- Maximum discrepancy allowed (default toInf
)ϵ
- Tolerance for unit sum (default to0.01
)λ
- Regularization parameter (default to0.001
)
References
- Huang et al. 2006. Correcting sample selection bias by unlabeled data.
Author
- Júlio Hoffimann (julio.hoffimann@gmail.com)
- Kai Xu (xukai921110@gmail.com)
DensityRatioEstimation.LCV
— TypeLCV(ranges, nfolds=10)
Likelihood cross-validation with parameter ranges ranges
and number of folds nfolds
.
References
- Sugiyama et al. 2008. Direct importance estimation for covariate shift adaptation.
Author
- Júlio Hoffimann (julio.hoffimann@gmail.com)
DensityRatioEstimation.LSIF
— TypeLSIF(σ=2.0, b=100, λ=0.001)
Least squares importance fitting.
Parameters
σ
- Bandwidth of Gaussian kernel (default to2.0
)b
- Maximum number of radial basis functions (default to10
)λ
- Regularization parameter (default to0.001
)
References
- Kanamori et al. 2009. A Least-squares Approach to Direct
Importance Estimation
Author
- Júlio Hoffimann (julio.hoffimann@gmail.com)
DensityRatioEstimation.OptimizationLibrary
— TypeOptimizationLibrary
An optimization library (e.g. Optim.jl, Convex.jl, JuMP.jl).
DensityRatioEstimation.uKMM
— TypeuKMM(σ=1.0, B=Inf, ϵ=0.01, λ=0.001)
Unconstrained Kernel Mean Matching (KMM).
Parameters
σ
- Bandwidth of Gaussian kernel (default to2.0
)λ
- Regularization parameter (default to0.001
)
References
- Huang et al. 2006. Correcting sample selection bias by unlabeled data.
Author
- Júlio Hoffimann (julio.hoffimann@gmail.com)
- Kai Xu (xukai921110@gmail.com)
DensityRatioEstimation._kliep_coeffs
— Method_kliep_coeffs(K_nu, K_de, dre, optlib)
Return the coefficients of KLIEP basis expansion.
DensityRatioEstimation._lsif_coeffs
— Method_lsif_coeffs(x_nu, x_de, basis, dre, optlib)
Return the coefficients of LSIF basis expansion.
DensityRatioEstimation.available_optlib
— Methodavailable_optlib(dre)
Return list of implementations available via different optimization frameworks.
DensityRatioEstimation.default_optlib
— Methoddefault_optlib(dre)
Return default optimization library for density ratio estimator dre
. The function can also be called on the type typeof(dre)
.
DensityRatioEstimation.densratio
— Methoddensratio(x_nu, x_de, dre; [optlib])
Estimate density ratio p_nu(x_de) / p_de(x_de)
with estimator dre
and indexable collections of numerator and denominator samples, x_nu
and x_de
.
Optionally choose an optimization library optlib
from the list below:
JuliaLib
- Pure Julia implementationOptimLib
- Implementation with Optim.jlConvexLib
- Implementation with Convex.jlJuMPLib
- Implementation with JuMP.jl
See also densratiofunc
.
DensityRatioEstimation.densratiofunc
— MethodDensityRatioEstimation.euclidsq
— Methodeuclidsq(x, y)
Return the Euclidean distance between two indexable objects.
DensityRatioEstimation.euclidsq
— Methodeuclidsq(X::T) where {T<:AbstractMatrix}
Effective version of euclidsq(X, X)
.
DensityRatioEstimation.euclidsq
— Methodeuclidsq(X::T, Y::T) where {T<:AbstractMatrix}
Return the Euclidean distance between columns in two matrices.
DensityRatioEstimation.gaussian_gramian
— Methodgaussian_gramian(xs, ys, σ=1)
Gramian matrix for samples xs
and ys
using a Gaussian kernel kernel with bandwidth σ
.
DensityRatioEstimation.safe_diagm
— Methodsafe_diagm(mat, a)
Generate a squared matrix whose diagonal is a
that is compatible to perform addition on mat
. It behaves differently based on whether mat
is on a CPU or GPU.
It is compatible with
- CuArrays.jl (see lib/cuarrays.jl)
- Zygote.jl (see lib/zygote.jl)
StatsAPI.fit
— Methodfit(DRE, x_nu, x_de, ranges; [optlib])
Perform hyperparameter tuning of density ratio estimator dre
with numerator and denominator samples, x_nu
and x_de
and with hyperparameter ranges
. Optionally, specify the optimization library optlib
.
Notes
Hyperparameter tuning is not defined for all density ratio estimators. Therefore, this function may not work with some estimators.