clean up tests and validate functions - #6
Conversation
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
|
|
||
| # Load the data | ||
| mtcars = pl.read_csv("data/mtcars.csv") | ||
| r_poly = pl.read_csv("data/mtcars_poly_4.csv") |
There was a problem hiding this comment.
Bug: Missing Data Files Cause Test Failures
The new polynomial comparison test and script rely on hardcoded paths to data/mtcars_poly_4.csv and data/mtcars.csv. These data files aren't included in the repository, so tests and the script will fail with a FileNotFoundError if they're missing.
Additional Locations (1)
| beta_k = np.dot(P[:, k], P[:, k]) / np.dot(P[:, k-1], P[:, k-1]) | ||
|
|
||
| # Three-term recurrence: P_{k+1} = (x - alpha_k) * P_k - beta_k * P_{k-1} | ||
| P[:, k + 1] = (x_data - alpha_k) * P[:, k] - beta_k * P[:, k - 1] |
There was a problem hiding this comment.
Bug: Orthogonal Polynomial Calculation Errors
The orthogonal polynomial calculation has a few issues. Division by zero can occur in alpha_k and beta_k calculations when P vectors become all zeros, particularly with constant input data. The alpha_k calculation uses P[:, k]**2 instead of P[:, k], leading to incorrect orthogonal polynomial coefficients. Empty input data also causes np.mean to return NaN, which propagates through subsequent calculations.
No description provided.