-
Notifications
You must be signed in to change notification settings - Fork 0
Switch scatter regression to OLS with statistics #14
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
base: main
Are you sure you want to change the base?
Conversation
Code Review: Switch scatter regression to OLS with statisticsOverall, this is a well-implemented change that significantly enhances the dashboard's analytical capabilities. The switch from Theil-Sen to OLS regression with statistical measures is appropriate for this use case. Below are my detailed findings: ✅ Strengths
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const formatRegressionFormula = regression => { | ||
| if (!regression || !Number.isFinite(regression.slope) || !Number.isFinite(regression.intercept)) { | ||
| return 'Formula unavailable'; | ||
| } | ||
| const slopeText = formatCoefficient(regression.slope); | ||
| const intercept = regression.intercept; | ||
| const interceptAbs = Math.abs(intercept); | ||
| const interceptText = formatCoefficient(interceptAbs); | ||
| const sign = intercept >= 0 ? ' + ' : ' - '; | ||
| return `y = ${slopeText}x${sign}${interceptText}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escape JS template literals inside Python f-string
The new regression helpers embed JavaScript template literals like return `y = ${slopeText}x${sign}${interceptText}`; inside a Python f-string. When the dashboard runs, Python tries to evaluate slopeText, sign, and interceptText (and the similar placeholders in the stats string below) as Python expressions and immediately raises NameError, preventing any HTML from being generated. These ${…} sequences need to be escaped (e.g., ${{…}}) or the block should be converted to a regular triple-quoted string so the JavaScript interpolation is left untouched.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_69095661587483258cee0fada0a71fcd