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

The setter for rng seed of an instance of ProbInput is ineffective. #424

Closed
damar-wicaksono opened this issue Nov 28, 2024 · 1 comment
Closed
Labels
bug Something isn't working core Core functionality of the package
Milestone

Comments

@damar-wicaksono
Copy link
Owner

Consider the following test:

import uqtestfuns as uqtf
a = uqtf.HigdonSine()
b = a.prob_input

b.rng_seed = 42  # By intention, this should reset the RNG with a seed number of 42
x = b.get_sample(10)
b.rng_seed = 42  # Once again, this should reset the RNG with a seed number of 42
y = b.get_sample(10)

assert np.all(x == y)

the assertion will fail because in probabilistic_input.py l. 86:

    def rng_seed(self, value: Optional[int]):
        """Set/reset the seed for RNG."""
        self.reset_rng(self._rng_seed)

In other words, the value is never assigned.

@damar-wicaksono damar-wicaksono added bug Something isn't working core Core functionality of the package labels Nov 28, 2024
@damar-wicaksono damar-wicaksono added this to the 0.6.0 Release milestone Nov 28, 2024
damar-wicaksono added a commit that referenced this issue Dec 9, 2024
Assigning an integer value to `rng_seed`
property of `ProbInput` class will correctly reset
the RNG with the assigned seed value.

This commit should resolve Issue #424.
@damar-wicaksono
Copy link
Owner Author

This issue has been resolved by PR #443.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Core functionality of the package
Projects
None yet
Development

No branches or pull requests

1 participant