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

numpy.linalg.LinAlgError: Matrix is singular to machine precision #1

Open
bg-aggregator opened this issue Apr 22, 2024 · 0 comments
Open

Comments

@bg-aggregator
Copy link

My python version is 3.12.2

The code I wrote is similar to their test.

    from pybreakpoints.baiperron import breakpoint
    import numpy as np
    import pandas as pd
    
    nile = pd.read_csv("tests/data/nile.csv")
    X = np.ones_like(nile)
    results = breakpoint(X, nile)

But I got errors.

mytest.py", line 9, in <module>
    results = breakpoint(X, nile)
              ^^^^^^^^^^^^^^^^^^^
\pybreakpoints\baiperron.py", line 76, in breakpoint
    ssr = recresid(X_[i:n, :], y_[i:n])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
\pybreakpoints\recresid_.py", line 134, in recresid
    rresid = _recresid(_X, _y, span)[span:]
             ^^^^^^^^^^^^^^^^^^^^^^^

\Python312\Lib\site-packages\numba\np\linalg.py", line 899, in _inv_err_handler
    raise np.linalg.LinAlgError(
numpy.linalg.LinAlgError: Matrix is singular to machine precision.

Since it is the data from the repo the test should at least be able to run. I suspect this is just data format problem but I'm new to python and not sure how to debug.

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