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

Setup QuantEcon-wasm library #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Setup QuantEcon-wasm library #1

wants to merge 2 commits into from

Conversation

kp992
Copy link
Collaborator

@kp992 kp992 commented Jan 4, 2025

Setup QuantEcon-wasm library. This PR mirrors the original QuantEcon.py library and removes numba dependency for WASM environments.

@kp992
Copy link
Collaborator Author

kp992 commented Jan 5, 2025

Locally all the tests are passing:

% pytest -n auto
============================================================================ test session starts =============================================================================
platform darwin -- Python 3.10.15, pytest-8.1.0, pluggy-1.4.0
rootdir: /Users/kpl/repos/QuantEcon.py-wasm
configfile: pytest.ini
plugins: anyio-4.0.0, xdist-3.6.1
8 workers [532 items]   
....................................................................................................................................................................... [ 31%]
............................x......................................................................................................................................... [ 62%]
...................................................................................................................................................................... [ 93%]
.................................                                                                                                                                      [100%]
============================================================================== warnings summary ==============================================================================
quantecon_wasm/markov/tests/test_ddp.py::TestFiniteHorizon::test_backward_induction
quantecon_wasm/markov/tests/test_ddp.py::test_ddp_beta_1_not_implemented_error
  /Users/kpl/repos/QuantEcon.py-wasm/quantecon_wasm/markov/ddp.py:430: UserWarning: infinite horizon solution methods are disabled with beta=1
    warnings.warn(msg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================ 531 passed, 1 xfailed, 2 warnings in 57.99s =================================================================

One of the tests is failing and is known to me. It's marked with xfail.

@mmcky
Copy link
Contributor

mmcky commented Jan 7, 2025

@kp992 I will dive into this error on Thur/Fri this week.

@mmcky
Copy link
Contributor

mmcky commented Jan 10, 2025

@kp992 an fail is an expected fail so that isn't causing the failure

Looks like tolerances are different

=========================== short test summary info ============================
FAILED quantecon_wasm/tests/test_quad.py::TestQnwbeta::test_qnwbeta_nodes_3d - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 459 / 945 (48.6%)
Max absolute difference among violations: 0.92125805
Max relative difference among violations: 2.55069065
 ACTUAL: array([[0.022479, 0.236368, 0.022315],
       [0.26579 , 0.236368, 0.022315],
       [0.943737, 0.236368, 0.022315],...
 DESIRED: array([[0.022479, 0.236368, 0.022315],
       [0.114679, 0.236368, 0.022315],
       [0.26579 , 0.236368, 0.022315],...
FAILED quantecon_wasm/tests/test_quad.py::TestQnwbeta::test_qnwbeta_weights_3d - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 297 / 315 (94.3%)
Max absolute difference among violations: 0.02843322
Max relative difference among violations: 9.73330951
 ACTUAL: array([7.406938e-05, 1.685941e-04, 6.900889e-06, 6.900889e-06,
       1.685941e-04, 7.406938e-05, 7.406938e-05, 6.015995e-05,
       1.369339e-04, 5.604977e-06, 5.604977e-06, 1.369339e-04,...
 DESIRED: array([7.406938e-05, 1.462522e-04, 1.685941e-04, 1.417735e-04,
       8.785608e-05, 3.627328e-05, 6.900889e-06, 8.981213e-04,
       1.773368e-03, 2.044271e-03, 1.719061e-03, 1.065291e-03,...
====== 2 failed, 529 passed, 1 xfailed, 14 warnings in 106.61s (0:01:46) =======

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.

2 participants