fix segment-based RC regression score computation#4237
Merged
eder-matheus merged 2 commits intoMay 18, 2026
Conversation
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a custom R² calculation for through-origin regressions in correlateRC.py to replace the default sklearn scoring, which uses a 'predict mean' baseline. A new helper function, compute_through_origin_fit_score, is implemented and used for resistance and capacitance fit scoring. The review feedback suggests improving the robustness of this function by returning a perfect score of 1.0 instead of raising a ValueError when all observed values are zero, which prevents script termination during automated runs on designs with unused routing layers.
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
eder-matheus
approved these changes
May 18, 2026
74b5f96
into
The-OpenROAD-Project:master
8 of 9 checks passed
Member
|
The min routing layer is met1 so li1 won't have much useful data in any case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
When running the regression for sky130hs/aes I got a crazy negative score for the li1 layer resistance fit.
This design had a few geometrically identical small segments on this layer that are a result of a pin access maneuver to allow reaching an instance's pin:

It turns out that sklearn's default baseline model for scoring the fit i.e., measuring R² is "predict the mean" which is not the proper model for our regressions since both R and C are through-origin fits - the R² computation doesn't behave well for near-zero variance. A more proper approach would be to compute R² with a "predict zero" baseline model.
Changes
Compute the fit score manually using a helper function that uses "predict zero" baseline model rather than .score.
Observations