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

Warnings from KDE #7

Closed
LoryPack opened this issue Mar 14, 2021 · 2 comments
Closed

Warnings from KDE #7

LoryPack opened this issue Mar 14, 2021 · 2 comments

Comments

@LoryPack
Copy link

Hello,
as I mentioned in my PR #3, there seems to be some UserWarnings raised when KDE is fit with a small number of samples. I put here a small chunk of code which reproduces the warning; that is using my code from #3, so using the ABCpy inference scheme. I have not tried with the other algorithms yet.

I realize there is not much you can do about this as it is due to KDE, but maybe it can be helpful to provide a more explicit warning message saying that the number of samples for KDE are small? Not sure, I realize also this is not super important.

import sbibm

task_name = "two_moons"

task = sbibm.get_task(task_name)  # See sbibm.get_available_tasks() for all tasks
prior = task.get_prior()
simulator = task.get_simulator()
observation = task.get_observation(num_observation=1)  # 10 per task

from sbibm.algorithms.abcpy.rejection_abc import (
    run as rej_abc,
)  
num_simulations = 1000
num_samples = 10000
posterior_samples, _, _ = rej_abc(
    task=task,
    num_samples=num_samples,
    num_observation=1,
    num_simulations=num_simulations,
    num_top_samples=30,
    kde_bandwidth="cv",
)
@janfb
Copy link
Contributor

janfb commented Apr 14, 2021

Thanks for the issue @LoryPack.

#8 adds additional information to the logging message when using KDE. We give this additional general info instead of an actual UserWarning because it is not clear when exactly there too few samples, e.g., how it depends on the number of samples and the number of dimensions of the distribution.

@LoryPack
Copy link
Author

Thanks for that

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

No branches or pull requests

3 participants