Refactor piecewise polynomial (implement GEP-8)#1132
Conversation
…#76](ttsim-dev/ttsim#76) Convert all piecewise polynomial YAML parameters from numbered dict format to ordered lists with explicit interval strings: - solidaritätszuschlag, einkommensteuertarif, vorsorge, behinderung, wohngeld, grundrente, bürgergeld/arbeitslosengeld_2 freibeträge, lohnsteuer vorsorge - Rename keys: rate_linear->slope, rate_quadratic->quadratic, intercept_at_lower_threshold->intercept - Update Python code to use new API (parameter_list instead of parameter_dict, new key names) - Fix rates shape indexing: [coeff, interval] -> [interval, coeff] in lohnsteuer.py and solidaritätszuschlag.py - Add extend_extend_intervals_to_real_line to fix stale adjacent intervals after upsert_tree merges in param_functions - Re-export extend_extend_intervals_to_real_line from gettsim.tt Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
|
@hmgaudecker When discussion GEP 8, we forgot about Regarding the behavior of
Any comments? |
Yes, I'll need more context...
Sounds scary. I think we should be very strict here. No need to use the update_previous mechanic; it's just a couple of extra lines after all. |
Yeah, needed to implement it (and fail to anticipate test results) to see how error-prone this is. The only place where we use
So the only difference compared the GEP version will be that we do 2026-01-01:
reference: ...
intervals:
- interval: "[0, 100)"
slope: 0.5
- ...instead of 2026-01-01:
- interval: "[0, 100)"
slope: 0.5
- ... |
|
That looks good, but I still don't quite get what you mean by:
Are overlapping intervals 2025-01-01:
- interval: "[0, 100)"
slope: 0.5
- interval: "[100, 200)"
slope: 0.4
2026-01-01:
- updates_previous: true
- interval: "[50, 150)"
slope: 0.4or 2025-01-01:
- updates_previous: true
- interval: "[0, 100)"
slope: 0.5
- interval: "[100, 200)"
slope: 0.4
2026-01-01:
- updates_previous: true
- interval: "[0, 100)"
slope: 0.4? The first would be terrible, I don't see why we would not support the second. |
|
I was talking about the first one and I agree we should not do it. We don't really need the second one as of now, but wouldn't hurt to cover that case. |
|
We could use it in Bürgergeld, but I am not sure whether this case would be covered: - interval: '[100, 1000)'
slope: 0.2-> - interval: '[100, 520)'
slope: 0.2
- interval: '[520, 1000)'
slope: 0.3 |
|
My hunch is that we should not allow for that. Splitting up intervals doesn't occur often and a strict "no changes in boundaries" rule is easier to keep track of (I noticed a week ago that I start to forget about all the features we implemented last summer 😄). But feel free to overrule. |
|
No, Just thought it might have worked out is the box! |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…y; dont need param function.
Documentation build overview
Show files changed (4 files in total): 📝 4 modified | ➕ 0 added | ➖ 0 deleted
|
9efd51a to
058a909
Compare
502c1b6 to
0bbe9af
Compare
…gettsim into refactor-piecewise-polynomial
Refactor piecewise polynomial YAML and code for GEP-08, twin to TTSIM #76
Convert all piecewise polynomial YAML parameters from numbered dict format
to ordered lists with explicit interval strings:
wohngeld, grundrente, bürgergeld/arbeitslosengeld_2 freibeträge,
lohnsteuer vorsorge
intercept_at_lower_threshold->intercept
parameter_dict, new key names)
in lohnsteuer.py and solidaritätszuschlag.py
after upsert_tree merges in param_functions
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com