From 91798f04dd29652843d3bd92b87ac447fe372c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lafage?= Date: Tue, 28 May 2024 16:15:34 +0200 Subject: [PATCH] Prepare release 2.6.1 (#578) * Bump version 2.6.1 * Add Nick Thompson as a contributor * Move special tests under surrogate_models/tests * Add Nicolas Gonel as a contributor * Doc: add info about energy_weight and regularization_weight options for RMT[BC] * Doc: improve build-the-doc section * Update doc * Bump egobox version --- AUTHORS.md | 2 + doc/_src_docs/dev_docs.rst | 9 +++-- doc/_src_docs/dev_docs.rstx | 9 +++-- doc/_src_docs/surrogate_models/rmts.rst | 40 +++++++++++-------- doc/_src_docs/surrogate_models/rmts.rstx | 10 ++++- requirements.txt | 2 +- setup.py | 2 +- smt/__init__.py | 2 +- .../tests/test_kpls_auto.py | 0 .../tests/test_rmtb_issue_573.py} | 0 10 files changed, 46 insertions(+), 30 deletions(-) rename smt/{ => surrogate_models}/tests/test_kpls_auto.py (100%) rename smt/{tests/test_issue_573.py => surrogate_models/tests/test_rmtb_issue_573.py} (100%) diff --git a/AUTHORS.md b/AUTHORS.md index a0749d106..d0e6cb474 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -25,6 +25,8 @@ SMT has been developed thanks to contributions from: * Laurent Wilkens * Lucas Alber * Mostafa Meliani +* Nick Thompson +* Nicolas Gonel * Nina Moƫllo * Paul Saves * Raul Carreira Rufato diff --git a/doc/_src_docs/dev_docs.rst b/doc/_src_docs/dev_docs.rst index 778117860..4514f7812 100644 --- a/doc/_src_docs/dev_docs.rst +++ b/doc/_src_docs/dev_docs.rst @@ -39,12 +39,13 @@ Install the test runner: ``pip install pytest`` then run: ``pytest`` Building the documentation -------------------------- -Users can read the docs online at ``smt.readthedocs.io``, but developers who contribute to the docs should build the docs locally to view the output. +Users can read the docs online at `smt.readthedocs.io `_, but developers who contribute to the docs should build the docs locally to view the output. This is especially necessary because most of the docs in SMT contain code, code print output, and plots that are dynamically generated and embedded during the doc building process. The docs are written using reStructuredText, and there are a few custom directives we have added for this embedding of dynamically-generated content. -First, install *sphinx_auto_embed* by running ``pip install git+https://github.com/hwangjt/sphinx_auto_embed.git``. +First, install the required dependencies to build the doc with: ``pip install -r doc/requirements.txt`` + +Then to generate the doc, the developer should go to the ``doc`` directory and run ``sphinx_auto_embed``, then ``make html``. -To build the docs, the developer should go to the ``doc`` directory and run ``sphinx_auto_embed`` and ``make html`` to build the html docs. This is a 2-step process because ``sphinx_auto_embed`` converts rstx files to rst files and ``make html`` generates the html docs from the rst files. -The landing page for the built docs can then be found at ``doc/_build/html/index.html``, and this is the same page that readers first see when they load ``smt.readthedocs.io``. +The landing page for the built docs can then be found at ``doc/_build/html/index.html``. diff --git a/doc/_src_docs/dev_docs.rstx b/doc/_src_docs/dev_docs.rstx index 778117860..4514f7812 100644 --- a/doc/_src_docs/dev_docs.rstx +++ b/doc/_src_docs/dev_docs.rstx @@ -39,12 +39,13 @@ Install the test runner: ``pip install pytest`` then run: ``pytest`` Building the documentation -------------------------- -Users can read the docs online at ``smt.readthedocs.io``, but developers who contribute to the docs should build the docs locally to view the output. +Users can read the docs online at `smt.readthedocs.io `_, but developers who contribute to the docs should build the docs locally to view the output. This is especially necessary because most of the docs in SMT contain code, code print output, and plots that are dynamically generated and embedded during the doc building process. The docs are written using reStructuredText, and there are a few custom directives we have added for this embedding of dynamically-generated content. -First, install *sphinx_auto_embed* by running ``pip install git+https://github.com/hwangjt/sphinx_auto_embed.git``. +First, install the required dependencies to build the doc with: ``pip install -r doc/requirements.txt`` + +Then to generate the doc, the developer should go to the ``doc`` directory and run ``sphinx_auto_embed``, then ``make html``. -To build the docs, the developer should go to the ``doc`` directory and run ``sphinx_auto_embed`` and ``make html`` to build the html docs. This is a 2-step process because ``sphinx_auto_embed`` converts rstx files to rst files and ``make html`` generates the html docs from the rst files. -The landing page for the built docs can then be found at ``doc/_build/html/index.html``, and this is the same page that readers first see when they load ``smt.readthedocs.io``. +The landing page for the built docs can then be found at ``doc/_build/html/index.html``. diff --git a/doc/_src_docs/surrogate_models/rmts.rst b/doc/_src_docs/surrogate_models/rmts.rst index 3cafa2b82..21cc0e471 100644 --- a/doc/_src_docs/surrogate_models/rmts.rst +++ b/doc/_src_docs/surrogate_models/rmts.rst @@ -50,7 +50,7 @@ and :math:`\alpha` and :math:`\beta` are regularization coefficients. In problems with a large number of training points relative to the number of spline coefficients, the energy minimization term is not necessary; -this term can be zero-ed by setting the reg_cons option to zero. +this term can be zero-ed by setting the ``energy_weight`` option to zero. In problems with a small dataset, the energy minimization is necessary. When the true function has high curvature, the energy minimization can be counterproductive in the regions of high curvature. @@ -85,7 +85,13 @@ The number of elements in each dimension is an option that trades off efficiency In general, RMTB is the better choice when training time is the most important, while RMTC is the better choice when accuracy of the interpolant is the most important. -More details of these methods are given in [1]_. + +More details of these methods are given in [1]_. + +Specially with regard to the implementation, the above functions to minimize are multiplied by :math:`\alpha` +which does not change the minimum result. +Then the ``energy_weight`` and ``regularization_weight`` controlling options used below are respectively defined +as :math:`\alpha'=\alpha` and :math:`\beta'=\alpha\beta`. See the section `3.5 - Summary and implementation` in [1]_ for further details. .. [1] Hwang, J. T., & Martins, J. R. (2018). A fast-prediction surrogate model for large datasets. Aerospace Science and Technology, 75, 74-87. @@ -147,24 +153,24 @@ Usage (RMTB) Initializing Hessian ... Initializing Hessian - done. Time (sec): 0.0000000 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0080621 + Computing energy terms - done. Time (sec): 0.0000000 Computing approximation terms ... Computing approximation terms - done. Time (sec): 0.0000000 - Pre-computing matrices - done. Time (sec): 0.0080621 + Pre-computing matrices - done. Time (sec): 0.0000000 Solving for degrees of freedom ... Solving initial startup problem (n=20) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 1.549745600e+00 2.530000000e+00 - Iteration (num., iy, grad. norm, func.) : 0 0 1.246458141e-15 4.463939441e-16 - Solving for output 0 - done. Time (sec): 0.0100861 - Solving initial startup problem (n=20) - done. Time (sec): 0.0100861 + Iteration (num., iy, grad. norm, func.) : 0 0 1.462445337e-15 4.462575191e-16 + Solving for output 0 - done. Time (sec): 0.0051222 + Solving initial startup problem (n=20) - done. Time (sec): 0.0051222 Solving nonlinear problem (n=20) ... Solving for output 0 ... - Iteration (num., iy, grad. norm, func.) : 0 0 1.530702323e-15 4.463939441e-16 + Iteration (num., iy, grad. norm, func.) : 0 0 1.535878390e-15 4.462575191e-16 Solving for output 0 - done. Time (sec): 0.0000000 Solving nonlinear problem (n=20) - done. Time (sec): 0.0000000 - Solving for degrees of freedom - done. Time (sec): 0.0100861 - Training - done. Time (sec): 0.0181482 + Solving for degrees of freedom - done. Time (sec): 0.0051222 + Training - done. Time (sec): 0.0051222 ___________________________________________________________________________ Evaluation @@ -238,24 +244,24 @@ Usage (RMTC) Initializing Hessian ... Initializing Hessian - done. Time (sec): 0.0000000 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0080643 + Computing energy terms - done. Time (sec): 0.0000000 Computing approximation terms ... Computing approximation terms - done. Time (sec): 0.0000000 - Pre-computing matrices - done. Time (sec): 0.0080643 + Pre-computing matrices - done. Time (sec): 0.0000000 Solving for degrees of freedom ... Solving initial startup problem (n=42) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 2.249444376e+00 2.530000000e+00 - Iteration (num., iy, grad. norm, func.) : 0 0 1.953264763e-15 4.346868680e-16 - Solving for output 0 - done. Time (sec): 0.0020618 - Solving initial startup problem (n=42) - done. Time (sec): 0.0020618 + Iteration (num., iy, grad. norm, func.) : 0 0 1.998691182e-15 4.346868680e-16 + Solving for output 0 - done. Time (sec): 0.0000000 + Solving initial startup problem (n=42) - done. Time (sec): 0.0000000 Solving nonlinear problem (n=42) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 2.956393318e-15 4.346868680e-16 Solving for output 0 - done. Time (sec): 0.0000000 Solving nonlinear problem (n=42) - done. Time (sec): 0.0000000 - Solving for degrees of freedom - done. Time (sec): 0.0020618 - Training - done. Time (sec): 0.0101261 + Solving for degrees of freedom - done. Time (sec): 0.0000000 + Training - done. Time (sec): 0.0051217 ___________________________________________________________________________ Evaluation diff --git a/doc/_src_docs/surrogate_models/rmts.rstx b/doc/_src_docs/surrogate_models/rmts.rstx index 8898aff73..f6b248c29 100644 --- a/doc/_src_docs/surrogate_models/rmts.rstx +++ b/doc/_src_docs/surrogate_models/rmts.rstx @@ -50,7 +50,7 @@ and :math:`\alpha` and :math:`\beta` are regularization coefficients. In problems with a large number of training points relative to the number of spline coefficients, the energy minimization term is not necessary; -this term can be zero-ed by setting the reg_cons option to zero. +this term can be zero-ed by setting the ``energy_weight`` option to zero. In problems with a small dataset, the energy minimization is necessary. When the true function has high curvature, the energy minimization can be counterproductive in the regions of high curvature. @@ -85,7 +85,13 @@ The number of elements in each dimension is an option that trades off efficiency In general, RMTB is the better choice when training time is the most important, while RMTC is the better choice when accuracy of the interpolant is the most important. -More details of these methods are given in [1]_. + +More details of these methods are given in [1]_. + +Specially with regard to the implementation, the above functions to minimize are multiplied by :math:`\alpha` +which does not change the minimum result. +Then the ``energy_weight`` and ``regularization_weight`` controlling options used below are respectively defined +as :math:`\alpha'=\alpha` and :math:`\beta'=\alpha\beta`. See the section `3.5 - Summary and implementation` in [1]_ for further details. .. [1] Hwang, J. T., & Martins, J. R. (2018). A fast-prediction surrogate model for large datasets. Aerospace Science and Technology, 75, 74-87. diff --git a/requirements.txt b/requirements.txt index a7c37c751..f72b53da8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ pytest-cov # allows to get coverage report ruff # format and lint code ConfigSpace ~= 0.6.1 jenn >= 1.0.2, <2.0 -egobox ~= 0.18.0 +egobox ~= 0.19.0 diff --git a/setup.py b/setup.py index 83548ec3c..f82109524 100644 --- a/setup.py +++ b/setup.py @@ -120,7 +120,7 @@ "cs": [ # pip install smt[cs] "ConfigSpace~=0.6.1", ], - "gpx": ["egobox~=0.18"], # pip install smt[gpx] + "gpx": ["egobox~=0.19"], # pip install smt[gpx] }, python_requires=">=3.8", zip_safe=False, diff --git a/smt/__init__.py b/smt/__init__.py index e5e59e38d..fab833f38 100644 --- a/smt/__init__.py +++ b/smt/__init__.py @@ -1 +1 @@ -__version__ = "2.6.0" +__version__ = "2.6.1" diff --git a/smt/tests/test_kpls_auto.py b/smt/surrogate_models/tests/test_kpls_auto.py similarity index 100% rename from smt/tests/test_kpls_auto.py rename to smt/surrogate_models/tests/test_kpls_auto.py diff --git a/smt/tests/test_issue_573.py b/smt/surrogate_models/tests/test_rmtb_issue_573.py similarity index 100% rename from smt/tests/test_issue_573.py rename to smt/surrogate_models/tests/test_rmtb_issue_573.py