Open chamwen opened 6 years ago
It seems (to me) the comment in densratio.densratio
is a bit confusing.
"""Estimate Density Ratio p(x)/q(y) Args: x: sample from p(x). y: sample from p(y).
Maybe the comment can be modified as follows:
"""Estimate Density Ratio p(x)/q(x). Args: x: sample from p(x). y: sample from q(x).
where p(x) and q(x) denote the test/train distributions on the same random variable X.
@chamwen
the x means a sample in train data? the y means a sample in test data?
I think x
is a sample from a test distribution p(x), while y
denotes a sample from a training distribution q(x).
how can we get a y that associated with x ?
Once the parameters are learned from samples using densratio.densratio(x, y)
, you can compute the density ratio on x_new
with uLSIF.compute_density_ratio(x_new)
. The uLSIF
object is returned from densratio.densratio(x, y)
.
See also: http://www.jmlr.org/papers/volume10/kanamori09a/kanamori09a.pdf.
This should be a lot clearer in the code now. To answer the above questions, suppose you have n
samples x1
from a distribution p(x)
, and n
samples x2
from a distribution q(x)
. Then, densratio estimates w(x) = p(x)/q(x)
. It can now even estimate the alpha-relative density ratio, as well as the alpha-relative PE-divergence and KL-divergence between p(x)
and q(x)
.
An excellent package for Density Ratio Estimation, but for a greener, how to get the x, y variables confused me. For example, with a train data and test data, the x means a sample in train data? the y means a sample in test data? If so, how can we get a y that associated with x ?