Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choosing kernel centers from test data #12

Open
krooner opened this issue Feb 23, 2021 · 1 comment · May be fixed by #21 or #23
Open

Choosing kernel centers from test data #12

krooner opened this issue Feb 23, 2021 · 1 comment · May be fixed by #21 or #23

Comments

@krooner
Copy link

krooner commented Feb 23, 2021

Hello. I'm trying to understand density-ratio estimation including RuLSIF for implementing transition detection w.r.t. smart home data. Thank you for making such useful module.

As written in the RuLSIF.py, I read one reference 'A Least-squares Approach to Direct Importance Estimation' about LOOCV to understand how sigma and lambda are determined.

In this reference, it says that it randomly chooses kernel centers from test data "without replacement".
But line 48 of RuLSIF.py,
centers = x[randint(nx, size=kernel_num)]
If we run the code, it chooses elements with replacement so there are duplicated data points.

So, I think the code should be changed into this.
from numpy.random import choice
centers = x[choice(nx, kernel_num, replace=False)]

Please check whether it is right and give some comments!
Thank you.

@mierzejk
Copy link
Contributor

mierzejk commented Aug 18, 2021

Hi @krooner,

you might be possibly interested in my branch, featuring unique numpy.random.choice (without replacement) that has superseded numpy.random.randint for kernel centers selection. Furthermore, by applying numpy.percentile the choice is stratified with respect to (possibly multivariate) x values. Please refer to the semi_stratified_sample function.

Best regards,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants