Skip to content

Conversation

jeremy-myers
Copy link
Contributor

@jeremy-myers jeremy-myers commented Aug 31, 2025

Closes #311

The tutorial is a minimal port of Listing 2 from (https://academic.oup.com/imaiai/article/12/3/1573/7159150#417226967).


📚 Documentation preview 📚: https://pyttb--450.org.readthedocs.build/en/450/

* Tutorial: minimal port of ZTP paper setup and run.
* Adds tutorial: minimal port of ZTP paper setup and run
@dmdunla
Copy link
Collaborator

dmdunla commented Aug 31, 2025

@jeremy-myers Looks like this is failing regressions due to some slight numerical differences in the expected test output. Can you take a look and see if Nick's example of using np.allclose() shown here could work for the ZTP tests you provided?

@jeremy-myers
Copy link
Contributor Author

@jeremy-myers Looks like this is failing regressions due to some slight numerical differences in the expected test output. Can you take a look and see if Nick's example of using np.allclose() shown here could work for the ZTP tests you provided?

@dmdunla This is failing on tests/gcp/test_optimizers.py::test_sgd which doesn't make sense to me - this PR doesn't touch that test. I don't have a debugger set up at the moment - can you take a look?

@dmdunla
Copy link
Collaborator

dmdunla commented Aug 31, 2025

@dmdunla This is failing on tests/gcp/test_optimizers.py::test_sgd which doesn't make sense to me - this PR doesn't touch that test. I don't have a debugger set up at the moment - can you take a look?

Ugh! This is ugly. It may be that this failing part relied on a certain state of the RNG, as I can reproduce the result, then run just this failing test, and it will work most but not all of the times I run it:

$ pytest tests -k "test_optimizers"
=============================================================================================================== test session starts ===============================================================================================================
platform darwin -- Python 3.12.9, pytest-8.4.0, pluggy-1.6.0
rootdir: <nope>
configfile: pyproject.toml
plugins: cov-6.1.1
collected 610 items / 605 deselected / 5 selected                                                                                                                                                                                                 

tests/gcp/test_optimizers.py .....                                                                                                                                                                                                          [100%]

======================================================================================================== 5 passed, 605 deselected in 0.16s ========================================================================================================

... then again ...

(pyttb_312) s1075069:pyttb dmdunla$ pytest tests -k "test_optimizers"
=============================================================================================================== test session starts ===============================================================================================================
platform darwin -- Python 3.12.9, pytest-8.4.0, pluggy-1.6.0
rootdir: <nope>
configfile: pyproject.toml
plugins: cov-6.1.1
collected 610 items / 605 deselected / 5 selected                                                                                                                                                                                                 

tests/gcp/test_optimizers.py ..F..                                                                                                                                                                                                          [100%]

==================================================================================================================== FAILURES =====================================================================================================================
...
tests/gcp/test_optimizers.py:94: AssertionError

And you can see that the error shows up in a different location. Hence, my thought about the RNG.

I increased max_iters on all the solvers to see if the failures go away. But this should be addressed more systematically moving forward.

@dmdunla
Copy link
Collaborator

dmdunla commented Aug 31, 2025

Looks like we were getting lucky with gcp_opt converging to a solution in just 1-2 iterations before I increased all of the max_iters=3 in all solver instantiations in tests/gcp/test_optimizers.py. With the introduction of the new gcp_opt tests, this may have been enough to change the state of the RNG propagating changes to the tests that filed, even though no direct change impacting any functions called in the failing tests.

I'll this PR now, then add an issue describing this behavior that needs to be addressed.

@dmdunla dmdunla merged commit 573dcd9 into sandialabs:main Aug 31, 2025
10 checks passed
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

Successfully merging this pull request may close these issues.

Implement zero-truncated Poisson algorithm

2 participants