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

Documentation does not build due to erroneous getting-started/polynomial-regression.ipynb #4

Open
steindev opened this issue Sep 28, 2022 · 0 comments

Comments

@steindev
Copy link
Member

After installing the minterpy conda environment and installing minterpy as described in the quickstart, building the documentation with make html in /docs fails with

reading sources... [ 95%] getting-started/polynomial-regression                                                                                  
Notebook error:
CellExecutionError in getting-started/polynomial-regression.ipynb:
------------------
from minterpy.utils import newt_eval

def get_regression_matrix(lag_poly, points):
    """ constructs the regression matrix by evaluating the lagrange monomials on
    all the points.
    :return: (k x N) the value of each Lagrange monomial in Newton form at each point.
    """

    coeffs_newton = mp.get_transformation(lag_poly, mp.NewtonPolynomial).transformation_operator.array_repr_full
    exponents = lag_poly.multi_index.exponents
    generating_points = lag_poly.grid.generating_points
    return newt_eval(points, coeffs_newton, exponents,
                     generating_points)

------------------

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 from minterpy.utils import newt_eval
      3 def get_regression_matrix(lag_poly, points):
      4     """ constructs the regression matrix by evaluating the lagrange monomials on
      5     all the points.
      6     :return: (k x N) the value of each Lagrange monomial in Newton form at each point.
      7     """

ImportError: cannot import name 'newt_eval' from 'minterpy.utils' (/home/steinigk/src/minterpy/src/minterpy/utils.py)
ImportError: cannot import name 'newt_eval' from 'minterpy.utils' (/home/steinigk/src/minterpy/src/minterpy/utils.py)

It seems the function newt_eval has been renamed to eval_newton_polynomials.

Applying the patch

diff --git a/docs/getting-started/polynomial-regression.ipynb b/docs/getting-started/polynomial-regression.ipynb
index e08f7aa..ac31a51 100644
--- a/docs/getting-started/polynomial-regression.ipynb
+++ b/docs/getting-started/polynomial-regression.ipynb
@@ -174,7 +174,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "from minterpy.utils import newt_eval\n",
+    "from minterpy.utils import eval_newton_polynomials as newt_eval\n",
     "\n",
     "def get_regression_matrix(lag_poly, points):\n",
     "    \"\"\" constructs the regression matrix by evaluating the lagrange monomials on\n",

allows to build documentation.

@steindev steindev changed the title Documentation does not build Documentation does not build due to erroneous getting-started/polynomial-regression.ipynb Sep 28, 2022
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

1 participant