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

ReactiveNestedCalibrator dos not work well #145

Open
Lowerce opened this issue Aug 29, 2024 · 4 comments
Open

ReactiveNestedCalibrator dos not work well #145

Lowerce opened this issue Aug 29, 2024 · 4 comments

Comments

@Lowerce
Copy link

Lowerce commented Aug 29, 2024

  • UltraNest version: 4.3.2
  • Python version: 3.9
  • Operating System: macOS 14.6.1

Description

I follow the command recommended in ReactiveNestedCalibrator. But it seems nothing output.

What I Did

sampler = ReactiveNestedCalibrator(my_param_names, my_loglike, my_transform) 
sampler.stepsampler = SliceSampler(nsteps=10, generate_direction=region_oriented_direction)
sampler.run(min_num_livepoints=400)
@JohannesBuchner
Copy link
Owner

That is very strange! Is this in a python script or a notebook? Can you rerun it from scratch?

@Lowerce
Copy link
Author

Lowerce commented Aug 29, 2024

That is very strange! Is this in a python script or a notebook? Can you rerun it from scratch?

In a python script. The corresponding one could work well:

sampler = ReactiveNestedSampler(my_param_names, my_loglike, my_transform)
sampler.stepsampler = SliceSampler(nsteps=10, generate_direction=region_oriented_direction)
sampler.run(min_num_livepoints=400)

How could I "return it from scratch"? I would like to try.
ReactiveNestedCalibrator seems behavior different with ReactiveNestedSampler for I can't get the return value of sampler.run from ReactiveNestedCalibrator. It will return an <generator object ReactiveNestedCalibrator.run at 0x1467de3c0>.

By the way, the plot method implemented in ReactiveNestedCalibrator could not work well too. The following issue is raised:

self.sampler.stepsampler.plot(os.path.join(self.sampler.logs['plots'], 'stepsampler.pdf'))
AttributeError: 'ReactiveNestedCalibrator' object has no attribute 'sampler'

@JohannesBuchner
Copy link
Owner

I'm quite confused. if you call run() then you should at least get to the first print here: https://github.com/JohannesBuchner/UltraNest/blob/master/ultranest/calibrator.py#L97

@shiningsurya
Copy link

sorry for interjecting here, this is something i also faced.

ReactiveNestedCalibrator returns generator of list of [nstep, result].
Only when you access, the actual sampling is performed.

i am running it like

for nstep, results in sampler:
    print(f" {nstep:d}", results, sep='\n')

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

No branches or pull requests

3 participants