cost-core 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. cost_core-1.0.1/CHANGELOG.md +331 -0
  2. cost_core-1.0.1/CITATION.cff +31 -0
  3. cost_core-1.0.1/LICENSE +202 -0
  4. cost_core-1.0.1/MANIFEST.in +33 -0
  5. cost_core-1.0.1/PKG-INFO +634 -0
  6. cost_core-1.0.1/README.md +605 -0
  7. cost_core-1.0.1/cost_core/__init__.py +5 -0
  8. cost_core-1.0.1/cost_core/cer/__init__.py +45 -0
  9. cost_core-1.0.1/cost_core/cer/diagnostics.py +235 -0
  10. cost_core-1.0.1/cost_core/cer/model.py +575 -0
  11. cost_core-1.0.1/cost_core/cli.py +400 -0
  12. cost_core-1.0.1/cost_core/data_io.py +148 -0
  13. cost_core-1.0.1/cost_core/fitting.py +860 -0
  14. cost_core-1.0.1/cost_core/ingest/__init__.py +66 -0
  15. cost_core-1.0.1/cost_core/ingest/crosswalk.py +293 -0
  16. cost_core-1.0.1/cost_core/ingest/inflation.py +229 -0
  17. cost_core-1.0.1/cost_core/ingest/pipeline.py +939 -0
  18. cost_core-1.0.1/cost_core/learning_curve.py +1111 -0
  19. cost_core-1.0.1/cost_core/lotmodel/__init__.py +72 -0
  20. cost_core-1.0.1/cost_core/lotmodel/chartdata.py +158 -0
  21. cost_core-1.0.1/cost_core/lotmodel/config.py +39 -0
  22. cost_core-1.0.1/cost_core/lotmodel/engine.py +669 -0
  23. cost_core-1.0.1/cost_core/lotmodel/enrich.py +657 -0
  24. cost_core-1.0.1/cost_core/lotmodel/mathx.py +87 -0
  25. cost_core-1.0.1/cost_core/lotmodel/models.py +398 -0
  26. cost_core-1.0.1/cost_core/lotmodel/provenance.py +83 -0
  27. cost_core-1.0.1/cost_core/lotmodel/summary.py +549 -0
  28. cost_core-1.0.1/cost_core/lots.py +1345 -0
  29. cost_core-1.0.1/cost_core/monte_carlo.py +1374 -0
  30. cost_core-1.0.1/cost_core/program/__init__.py +68 -0
  31. cost_core-1.0.1/cost_core/program/rollup.py +1061 -0
  32. cost_core-1.0.1/cost_core/reporting/__init__.py +65 -0
  33. cost_core-1.0.1/cost_core/reporting/assumptions.py +183 -0
  34. cost_core-1.0.1/cost_core/reporting/charts.py +637 -0
  35. cost_core-1.0.1/cost_core/reporting/lot_workbook.py +472 -0
  36. cost_core-1.0.1/cost_core/reporting/pipeline.py +615 -0
  37. cost_core-1.0.1/cost_core/reporting/program_workbook.py +300 -0
  38. cost_core-1.0.1/cost_core/synth/__init__.py +62 -0
  39. cost_core-1.0.1/cost_core/synth/generator.py +618 -0
  40. cost_core-1.0.1/cost_core/synth/reports.py +488 -0
  41. cost_core-1.0.1/cost_core/synth/spec.py +420 -0
  42. cost_core-1.0.1/cost_core.egg-info/PKG-INFO +634 -0
  43. cost_core-1.0.1/cost_core.egg-info/SOURCES.txt +112 -0
  44. cost_core-1.0.1/cost_core.egg-info/dependency_links.txt +1 -0
  45. cost_core-1.0.1/cost_core.egg-info/entry_points.txt +2 -0
  46. cost_core-1.0.1/cost_core.egg-info/requires.txt +7 -0
  47. cost_core-1.0.1/cost_core.egg-info/top_level.txt +1 -0
  48. cost_core-1.0.1/example_lots.csv +7 -0
  49. cost_core-1.0.1/make_hero.py +96 -0
  50. cost_core-1.0.1/pyproject.toml +86 -0
  51. cost_core-1.0.1/requirements.txt +6 -0
  52. cost_core-1.0.1/setup.cfg +4 -0
  53. cost_core-1.0.1/tests/conftest.py +35 -0
  54. cost_core-1.0.1/tests/golden_support.py +2804 -0
  55. cost_core-1.0.1/tests/goldens/COMPARE_POLICY.json +1059 -0
  56. cost_core-1.0.1/tests/goldens/README.md +394 -0
  57. cost_core-1.0.1/tests/goldens/cli_fit_lots.json.gz +0 -0
  58. cost_core-1.0.1/tests/goldens/engine_app_example.json.gz +0 -0
  59. cost_core-1.0.1/tests/goldens/engine_app_example_base_year.json.gz +0 -0
  60. cost_core-1.0.1/tests/goldens/engine_app_example_complexity.json.gz +0 -0
  61. cost_core-1.0.1/tests/goldens/engine_app_example_complexity_2.30.json.gz +0 -0
  62. cost_core-1.0.1/tests/goldens/engine_app_example_complexity_first_only.json.gz +0 -0
  63. cost_core-1.0.1/tests/goldens/engine_app_example_defaultcf_leading_nan.json.gz +0 -0
  64. cost_core-1.0.1/tests/goldens/engine_app_example_fcst_prior_110.json.gz +0 -0
  65. cost_core-1.0.1/tests/goldens/engine_app_example_fit_prior_10.json.gz +0 -0
  66. cost_core-1.0.1/tests/goldens/engine_app_example_legacy.json.gz +0 -0
  67. cost_core-1.0.1/tests/goldens/engine_app_example_maxiter_1.json.gz +0 -0
  68. cost_core-1.0.1/tests/goldens/engine_app_example_maxiter_2.json.gz +0 -0
  69. cost_core-1.0.1/tests/goldens/engine_app_example_prior_units.json.gz +0 -0
  70. cost_core-1.0.1/tests/goldens/engine_app_example_qty_only.json.gz +0 -0
  71. cost_core-1.0.1/tests/goldens/engine_app_example_runfile_fitprior_7.json.gz +0 -0
  72. cost_core-1.0.1/tests/goldens/engine_app_example_runfile_overrides.json.gz +0 -0
  73. cost_core-1.0.1/tests/goldens/engine_app_example_scale_1_1.json.gz +0 -0
  74. cost_core-1.0.1/tests/goldens/engine_app_example_tol_1e-14.json.gz +0 -0
  75. cost_core-1.0.1/tests/goldens/engine_cc_reference.json.gz +0 -0
  76. cost_core-1.0.1/tests/goldens/engine_cc_reference_backcast.json.gz +0 -0
  77. cost_core-1.0.1/tests/goldens/engine_cc_reference_complexity.json.gz +0 -0
  78. cost_core-1.0.1/tests/goldens/engine_cc_reference_fit_prior_100.json.gz +0 -0
  79. cost_core-1.0.1/tests/goldens/engine_cc_reference_legacy.json.gz +0 -0
  80. cost_core-1.0.1/tests/goldens/engine_cc_reference_lots_scale.json.gz +0 -0
  81. cost_core-1.0.1/tests/goldens/engine_cc_reference_one_lot.json.gz +0 -0
  82. cost_core-1.0.1/tests/goldens/engine_cc_reference_prior_units.json.gz +0 -0
  83. cost_core-1.0.1/tests/goldens/engine_four_lots.json.gz +0 -0
  84. cost_core-1.0.1/tests/goldens/engine_rate_driven_8lots.json.gz +0 -0
  85. cost_core-1.0.1/tests/goldens/engine_rate_fixture.json.gz +0 -0
  86. cost_core-1.0.1/tests/goldens/engine_rate_fixture_continuation.json.gz +0 -0
  87. cost_core-1.0.1/tests/goldens/engine_rate_fixture_legacy.json.gz +0 -0
  88. cost_core-1.0.1/tests/goldens/engine_rate_selected.json.gz +0 -0
  89. cost_core-1.0.1/tests/goldens/engine_runfile_qty_only_4lot.json.gz +0 -0
  90. cost_core-1.0.1/tests/goldens/engine_three_lots.json.gz +0 -0
  91. cost_core-1.0.1/tests/goldens/engine_uniform_qty.json.gz +0 -0
  92. cost_core-1.0.1/tests/goldens/engine_wbs_avionics.json.gz +0 -0
  93. cost_core-1.0.1/tests/goldens/engine_wbs_propulsion.json.gz +0 -0
  94. cost_core-1.0.1/tests/goldens/error_paths.json.gz +0 -0
  95. cost_core-1.0.1/tests/goldens/lots_cost_core.json.gz +0 -0
  96. cost_core-1.0.1/tests/goldens/wbs_FULL_WBS.json.gz +0 -0
  97. cost_core-1.0.1/tests/goldens/wbs_TEST_PROGRAM.json.gz +0 -0
  98. cost_core-1.0.1/tests/goldens/wbs_extra_programs.json.gz +0 -0
  99. cost_core-1.0.1/tests/test_cer.py +551 -0
  100. cost_core-1.0.1/tests/test_data_io.py +73 -0
  101. cost_core-1.0.1/tests/test_fitting.py +438 -0
  102. cost_core-1.0.1/tests/test_goldens.py +552 -0
  103. cost_core-1.0.1/tests/test_ingest.py +610 -0
  104. cost_core-1.0.1/tests/test_learning_curve.py +647 -0
  105. cost_core-1.0.1/tests/test_lot_buy_risk.py +173 -0
  106. cost_core-1.0.1/tests/test_lot_engine.py +239 -0
  107. cost_core-1.0.1/tests/test_lot_engine_conformance.py +275 -0
  108. cost_core-1.0.1/tests/test_lot_workbook.py +275 -0
  109. cost_core-1.0.1/tests/test_lotmodel.py +642 -0
  110. cost_core-1.0.1/tests/test_lots.py +749 -0
  111. cost_core-1.0.1/tests/test_monte_carlo.py +956 -0
  112. cost_core-1.0.1/tests/test_program.py +971 -0
  113. cost_core-1.0.1/tests/test_reporting.py +320 -0
  114. cost_core-1.0.1/tests/test_synth.py +543 -0
@@ -0,0 +1,331 @@
1
+ # Changelog
2
+
3
+ All notable changes to `cost_core` are recorded here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ Entries say what moved and by how much. A number that changes is not a
9
+ housekeeping detail here, because someone may have put the old one in a budget.
10
+
11
+ ## [Unreleased]
12
+
13
+ ### Fixed
14
+
15
+ - The buy S-curve is readable again when the simulation throws a long tail.
16
+ The axis followed the single most extreme draw, and parameter uncertainty on
17
+ a short series is a t with a few degrees of freedom, so one iteration in five
18
+ thousand landing at 2.6x the median squeezed the whole curve into a vertical
19
+ line against the left spine. It now shows the 0.5th through 99.5th
20
+ percentile, widened to keep P50, P80, P90 and the point estimate inside it,
21
+ and the axis label says so whenever anything is cropped. No number moves: the
22
+ curve is still drawn in full and the percentiles are what they were.
23
+
24
+ - `ce-core fit-lots` says which units its costs are in. The engine is scale
25
+ free and hands back whatever it is given, but its column headings read `($K)`,
26
+ carried over from the desktop tool whose input column is `AUC ($K)`, while
27
+ the charts format the same numbers as dollars. Feed it a file in dollars, as
28
+ the bundled `example_lots.csv` is, and a first-unit cost of $7.5M prints as
29
+ `T1 ($K) 7,477,686`, which is a 1,000x misread waiting to happen. The command
30
+ now states the convention in its output and in `--csv --help`, and the README
31
+ says it as well. The headings are unchanged, because they are the engine's
32
+ column names: the goldens pin them, the workbook writer builds sheets from
33
+ them and the desktop tool reads them.
34
+
35
+ ## [1.0.1] - 2026-09-11
36
+
37
+ A tests-only release. The engine's code and every number it produces are the
38
+ same as 1.0.0's; the one thing that reads differently is the version in the
39
+ provenance row. What changed is the source distribution, which ships the test
40
+ suite, and 1.0.0's failed on Linux.
41
+
42
+ ### Fixed
43
+
44
+ - The test suite passes off Windows. Every golden and every frozen draw in it
45
+ was captured on Windows, and the first push of 1.0.0 failed the same six
46
+ tests on all six Linux lanes. Nothing in `cost_core` changed and no golden
47
+ was rewritten; the tests assumed more was portable than is.
48
+
49
+ Under Linux the same numpy on the same machine draws about 0.5% of the
50
+ analytic risk model's values one to nine ulps away from Windows, so the four
51
+ frozen-draw hashes can't hold there. That model is now pinned at p50, p80
52
+ and p90 on every platform, to 1e-12 relative, and at the hashes on Windows
53
+ only, where they still catch a change like scipy 1.18.1's that leaves the
54
+ percentiles alone.
55
+
56
+ The same last-bit differences move the MUPE and ZMPE refits in the
57
+ learning-curve block of `tests/goldens/lots_cost_core`, because
58
+ `cost_core.learning_curve` fits with central differences: fifty leaves, up
59
+ to 3.8e-8 relative on T1, and the `scatter_0.3` MUPE loop stops at 12 steps
60
+ instead of 11. Which leaves move depends on the CPU as well, through the
61
+ kernel OpenBLAS picks for it: three GitHub lanes, and OpenBLAS forced onto
62
+ its kernels without FMA, also moved an iteration count or two and flipped
63
+ the sign of the `Mean bias` the two exact-fit fixtures print as zero, both
64
+ ways between `-0.00%` and `+0.00%`. Off Windows, every MUPE and ZMPE statistic
65
+ in that block is now compared under a measured allowance,
66
+ `COMPARE_POLICY.expected_to_move_across_platforms`, the
67
+ three iteration counts aren't compared, and those `Mean bias` cells pass
68
+ when both sides print a zero. On Windows all of it stays at 1e-9. Nothing
69
+ else in any golden moves, anywhere. That makes Windows the place a numpy or
70
+ scipy cap raise has to be measured: under Linux, numpy 2.5.3 and scipy
71
+ 1.18.1 now both pass the whole suite.
72
+
73
+ And a masked path in an error text keeps the separator of the machine that
74
+ wrote it, so off Windows the error-path comparison now reads
75
+ `<error_inputs>\` and `<error_inputs>/` as the same.
76
+
77
+ ## [1.0.0] - 2026-09-09
78
+
79
+ The first release. This is the point where the library stopped being the back
80
+ half of a desktop tool and became something installable on its own: the lot cost
81
+ engine, the WBS roll-up and the shared estimator all live here, and the window
82
+ lives in [lot-cost-model](https://github.com/MichaelFowler1/lot-cost-model),
83
+ which today carries its own copy of the deterministic fit and imports this
84
+ library for the risk half. The version says the interface is now something worth
85
+ keeping stable, and the goldens are what hold it to that.
86
+
87
+ ### Added
88
+
89
+ - A golden-master corpus under `tests/goldens`, read by
90
+ `tests/test_goldens.py`. It holds what the engine produced on 2026-09-06 for
91
+ 36 engine cases, eleven WBS programmes (two of them `FULL_WBS` at a
92
+ different buy scale), the CSV and Excel front door, three command line runs
93
+ and the error texts, at full float precision. Every case
94
+ is rebuilt from inputs stored beside it and compared under
95
+ `COMPARE_POLICY.json`, so the tolerances are written down instead of hidden
96
+ in assertions. It exists because the steps that follow re-express the
97
+ engine's arithmetic, and a claim that nothing moved beyond one part in a
98
+ billion needs something to be measured against.
99
+
100
+ - `cost_core.program`, the WBS roll-up. Several elements, each fitted to its
101
+ own analogy history or derived as a percentage or a flat amount, priced
102
+ against one shared lot schedule and correlated into one programme estimate.
103
+ It came from the desktop tool, where it was `wbs.py` and could not be used
104
+ without importing a window.
105
+
106
+ - An `empirical` distribution type in `cost_core.monte_carlo`. Its spec is
107
+ `{"type": "empirical", "draws": ...}` and it is the draws themselves rather
108
+ than a family fitted to them. The quantile function is `numpy.interp` over
109
+ the Hazen plotting positions of the sorted draws, which returns each knot
110
+ bit for bit and clamps instead of extrapolating. Draws must be at least two,
111
+ finite and non-negative. The last is required rather than merely expected,
112
+ because the sampler clamps costs at zero after drawing them and one negative
113
+ draw would silently stop the column being a permutation of the draws.
114
+
115
+ ### Changed
116
+
117
+ - The distribution name on PyPI is `cost-core`. The import name does not move:
118
+ `import cost_core` is unchanged, and setuptools normalises the two spellings
119
+ to the same artefact names, so the hyphen is only what you type after
120
+ `pip install`.
121
+
122
+ - The sdist carries the whole of `tests/`, plus `example_lots.csv`,
123
+ `requirements.txt` and this file, through a new `MANIFEST.in`. setuptools'
124
+ default sweep picks up `tests/test_*.py` and nothing those modules import, so
125
+ the sdist used to unpack into a suite that could not run: `pytest tests/ -q`
126
+ never reached a test, because collection was interrupted by
127
+ `ModuleNotFoundError: No module named 'golden_support'`, and `--collect-only`
128
+ reported 704 tests collected and one error, the 48 in `test_goldens.py` being
129
+ the ones it lost. It now unpacks into the same suite the repository runs,
130
+ goldens included, and `pytest tests/ -q` gives the same 752 passed from an
131
+ unpacked release as from a checkout.
132
+
133
+ - `requires-python` drops from `>=3.11` to `>=3.9`. Nothing here needed 3.11.
134
+ The PEP 604 unions that looked like they needed 3.10 all sit in annotations
135
+ in files carrying `from __future__ import annotations`, so none of them is
136
+ evaluated at runtime, and the suite passes on 3.9 unmodified. The last
137
+ 3.9-capable releases of numpy, pandas, scipy and matplotlib -- 2.0.2, 2.3.3,
138
+ 1.13.1 and 3.9.4 -- all satisfy the dependency floors, so the floors did not
139
+ have to move either.
140
+
141
+ - CI runs 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on every push, up from 3.11 and
142
+ 3.12. Every lane now installs the package from the version range it declares
143
+ instead of from `requirements.txt`, because four of the five pins in that file
144
+ will not install on 3.9 and three of them will not install on 3.10, so a
145
+ pinned install could not have been what the lower lanes ran. One lane applies
146
+ the pins afterwards, so the goldens are still checked against the stack they
147
+ were recorded on. A lane on every version also uninstalls matplotlib and
148
+ imports the engine without it, which is the only thing that keeps the claim
149
+ below honest.
150
+
151
+ The 3.9 lane names `ubuntu-24.04` instead of `ubuntu-latest`. setup-python
152
+ takes its interpreters from the manifest in `actions/python-versions`, which
153
+ has linux builds of 3.9 up to 24.04 and no further while every other version in
154
+ the matrix has a 26.04 build. `ubuntu-latest` is 24.04 today, so the lane runs;
155
+ the day it moves on, a lane left following it would stop finding an interpreter
156
+ and 3.9 is too far past end of life for a new build to appear. Naming the image
157
+ keeps the floor actually tested rather than quietly skipped.
158
+
159
+ - **numpy and scipy now carry an upper bound, `numpy<2.5` and `scipy<1.18`.**
160
+ These are reproducibility bounds, not compatibility ones. Above them the
161
+ library imports and runs; what it stops doing is reproducing the numbers this
162
+ release pins, and both effects were measured on Python 3.12 one package at a
163
+ time.
164
+
165
+ numpy 2.5.3 moves the unbiased refits in `tests/goldens/lots_cost_core`. The
166
+ MUPE iteration lands somewhere slightly different and sometimes takes a
167
+ different number of steps, 13 instead of 11 on the `scatter_0.3` case, so T1
168
+ goes 2,712.4962079 -> 2,712.4962290, about 8 parts in a billion, and the
169
+ nominally zero mean percentage error goes -4.3e-13 -> -2.6e-11. scipy 1.18.1
170
+ moves the same refits further, T1 to 2,712.4963311, about 4.5 parts in a
171
+ hundred million, and it also changes the draws the risk model produces, so
172
+ all four frozen-draw hashes in `tests/test_monte_carlo.py` fail as well.
173
+ Forty-one golden leaves move under scipy and forty-two under numpy, against
174
+ a tolerance of 1e-9 relative and 1e-12 absolute.
175
+
176
+ None of that is a bug in either library, and neither version was excluded
177
+ before. Both declare Requires-Python >=3.12, so the 3.12, 3.13 and 3.14 lanes
178
+ were all new enough to be offered them, and with nothing stopping them a lane
179
+ resolved both together and failed five tests on numbers: 71 golden leaves in
180
+ one case and the four frozen-draw hashes. The lanes whose tests actually ran
181
+ on a resolved stack were 3.12 and 3.13; 3.14 resolves the same pair and is
182
+ protected only because it applies `requirements.txt` before it runs the suite.
183
+ Raising a bound means rebaselining the goldens and the frozen draws under the
184
+ new stack and recording the movement, the way `COMPARE_POLICY.json` records
185
+ every other rebaseline here, rather than quietly widening a tolerance until
186
+ the failure stops.
187
+
188
+ - **matplotlib is an optional extra, `cost-core[plots]`, rather than a
189
+ dependency.** It draws the charts and does nothing else here, so a caller who
190
+ wants numbers should not have to install a plotting stack to get them: the lot
191
+ engine, the CERs, the risk simulation and the Excel workbooks all import and
192
+ run without it. `cost_core.monte_carlo` no longer imports pyplot at module
193
+ scope, `plot_distribution` imports it when called, and anything that draws --
194
+ `cost_core.reporting.charts`, `ce-core full-run`, `ce-core fit-lots --simulate
195
+ --out` -- fails with a message naming the extra rather than a bare
196
+ `No module named 'matplotlib'`. `fit-lots --out` on its own draws nothing and
197
+ needs nothing: the buy S-curve is the only chart that command writes and it
198
+ only exists with `--simulate`, so the eight tables and the `ASSUMPTIONS.md`
199
+ come out of a bare install unchanged. **This changes what a `pip install` pulls: an
200
+ install that used to produce charts now needs `pip install 'cost-core[plots]'`.**
201
+
202
+ - The lot engine, the analyst summary and the Excel workbook writer are the
203
+ desktop tool's current versions rather than the copy taken from it on 21
204
+ August. The engine itself had not moved in between; the summary had gained
205
+ three provenance rows, and the workbook writer three risk sheets, data
206
+ labels, a prediction band and an S-curve. Every function was carried across
207
+ from the tool's own source rather than retyped, so no number moved.
208
+
209
+ - `save_complete_excel_workbook` now lives in `cost_core.reporting`, with the
210
+ other reporting code, and `cost_core.lotmodel` re-exports it. Importing
211
+ `cost_core.reporting` no longer pulls matplotlib: its chart and pipeline
212
+ names load on first use, so the workbook writers can be imported without it.
213
+
214
+ - `generate_analyst_summary` takes an optional `provenance` mapping, so a
215
+ caller can stamp its own version rather than the library's.
216
+
217
+ - The three lot models are fitted through `cost_core.fitting` instead of
218
+ through the private least squares, MUPE and ZMPE the lot engine carried.
219
+ The coefficients move by about a part in a hundred billion, and that move is
220
+ the old error leaving: against an exact solve in sixty digits the old normal
221
+ equations sat 1.1e-11 out and the new path sits 1.5e-14. Model selection
222
+ does not change on any of the 36 pinned cases and the analyst summary is
223
+ identical character for character.
224
+
225
+ Two things do move further than that. The unbiased refits on the
226
+ `Fit_Methods` table shift by up to 3.3e-7 relative on their coefficients,
227
+ because the shared estimator's iteration stops on its own least squares
228
+ tolerance and its ZMPE starts from the MUPE answer rather than from ordinary
229
+ least squares. One leaf goes further in relative terms and not in absolute
230
+ ones: the ZMPE learning exponent of the flat reference series is 0.0036265630
231
+ against 0.0036265683, which is 1.5e-6 relative on a move of 5.3e-9, and it is
232
+ large only because the number it divides into is nearly zero. That is why the
233
+ exponent carries an absolute allowance as well as a relative one;
234
+ `COMPARE_POLICY._atol_on_the_exponents` has the reasoning. The ZMPE row was
235
+ never reproducible better than about 1e-7 against itself, measured by
236
+ perturbing its own seed, so this is inside the noise that row always had.
237
+ And `DFFITS` now reports zero below two degrees
238
+ of freedom, where the leave-one-out variance is zero divided by zero and the
239
+ old formula returned whatever the rounding produced.
240
+
241
+ - The significance gate no longer forms a rate t-statistic when the fit has no
242
+ residual spread to measure against. A series priced straight off the curve
243
+ reproduces itself exactly, so the coefficient and its standard error are
244
+ both at the floating-point floor and their ratio is decided by the last bit:
245
+ two solvers agreeing to twelve digits, pricing every lot identically, could
246
+ recommend different models. The t is reported as unavailable there instead,
247
+ which is the test `cost_core.cer.diagnostics` already applies before
248
+ dividing by the same quantity, and leaves the learning curve as the default.
249
+ Across every lot fit the test suite performs the ratio is either below
250
+ 1.1e-14 or above 2.6e-4, so nothing real sits near the line.
251
+
252
+ - The programme roll-up hands each fitted element's simulated buy totals to
253
+ the risk model directly, as an `empirical` marginal, instead of summarising
254
+ them as a two-parameter lognormal first. An element total is a sum of
255
+ correlated lognormal lot costs and is not itself lognormal, so no
256
+ two-parameter fit reproduced it. Because the draw count equals the
257
+ programme's iteration count, the copula returns a permutation of those very
258
+ draws, so **each element's percentiles inside the programme simulation are
259
+ now identical to its standalone percentiles**, at all 99 levels, under `==`.
260
+ Under the old handoff none of the 99 levels agreed and the worst was 0.79%
261
+ to 1.23% out.
262
+
263
+ The programme percentiles move as a result. They fall through the working
264
+ range and rise in the far tail, because the fitted lognormal was too fat in
265
+ the shoulder and too thin at the extreme:
266
+
267
+ | figure | TEST_PROGRAM | | FULL_WBS | |
268
+ | --- | --- | --- | --- | --- |
269
+ | | before -> after | change | before -> after | change |
270
+ | P50 | 197,359,861.00 -> 197,248,653.81 | -0.056% | 235,806,082.37 -> 235,679,973.43 | -0.053% |
271
+ | P80 | 199,334,505.70 -> 198,764,987.35 | -0.286% | 238,045,329.47 -> 237,399,495.65 | -0.271% |
272
+ | P90 | 200,431,772.55 -> 199,833,437.80 | -0.299% | 239,289,630.07 -> 238,611,118.46 | -0.284% |
273
+ | P99 | 202,989,641.04 -> 204,171,353.96 | +0.582% | 242,190,252.94 -> 243,530,315.40 | +0.553% |
274
+ | standard deviation | 2,361,702.58 -> 2,337,709.99 | -1.016% | 2,678,170.73 -> 2,650,963.13 | -1.016% |
275
+ | reserve to P80 | 2,168,821.67 -> 1,599,303.32 | -26.3% | 2,459,443.78 -> 1,813,609.96 | -26.3% |
276
+ | point estimate sits at | P46.3875 -> P47.9625 | +1.575 points | P46.3875 -> P47.9625 | +1.575 points |
277
+
278
+ All of these are at 8,000 iterations, seed 11, element correlation 0.25 and
279
+ lot correlation 0.30. The reserve is the headline: the old P80 was carrying
280
+ $569,518 on `TEST_PROGRAM` and $645,834 on `FULL_WBS` that came from the
281
+ summary's own error rather than from anything measured.
282
+
283
+ The standard deviation falls 1.02% although the element variances rise about
284
+ 4%. A Gaussian copula attenuates a heavier-tailed marginal more, so the
285
+ achieved Pearson correlation between the three fitted elements drops from a
286
+ mean of 0.262 to 0.216 while Spearman does not move: pair by pair, 0.279,
287
+ 0.241 and 0.267 become 0.225, 0.189 and 0.235. Variance rose, covariance
288
+ fell further, and the total narrowed.
289
+
290
+ Nothing else moved. Each element's own simulated buy, the deterministic
291
+ roll-up and every engine number are byte-identical, and so is every
292
+ non-empirical marginal in the risk model, which is now pinned by a frozen
293
+ seeded simulation in `tests/test_monte_carlo.py`.
294
+
295
+ - `tests/goldens/wbs_TEST_PROGRAM.json.gz` and
296
+ `tests/goldens/wbs_FULL_WBS.json.gz` are rebaselined in their
297
+ `program_level_percentiles` block, and only there, to the numbers above.
298
+ They are still compared leaf by leaf rather than excluded, so the new values
299
+ are pinned as tightly as the old ones were.
300
+ `COMPARE_POLICY.exclude_after_step3` records what was rebaselined, when, why
301
+ and by how much, and `tests/goldens/README.md` carries the same account.
302
+
303
+ - The command line moved from a top-level `cli` package to `cost_core.cli`.
304
+ A wheel that installs a package called `cli` into site-packages shares that
305
+ name with every other distribution that does, and installing or removing
306
+ either can break the other. The `ce-core` command is unchanged, and
307
+ `python -m cost_core.cli` replaces `python -m cli.ce_core_cli`.
308
+
309
+ ### Removed
310
+
311
+ - `cost_core.gui` and the `ce-core gui` subcommand. It was a copy of the
312
+ desktop tool's window taken on 21 August, already older than the tool by the
313
+ time it landed, and two windows over one engine is one too many. The window
314
+ to keep is [lot-cost-model](https://github.com/MichaelFowler1/lot-cost-model).
315
+ **Anyone importing `cost_core.gui` or
316
+ running `ce-core gui` has to move to that repository.**
317
+
318
+ - `cost_core.lotmodel.mathx.ols_fit` and `.solve_model`, the lot engine's
319
+ private least squares and its midpoint iteration, replaced by
320
+ `cost_core.lotmodel.models` on top of `cost_core.fitting`. `mathx` keeps the
321
+ lot midpoint, the unit tracking and the two column helpers, which are
322
+ geometry and parsing. The private MUPE and ZMPE in
323
+ `cost_core.lotmodel.enrich` are gone the same way.
324
+
325
+ - `cost_core.program.SPEC_TOLERANCE` and `cost_core.program._lognormal_spec`,
326
+ along with the test that bounded the fit against the element it summarised.
327
+ There is no longer an approximation there to bound.
328
+
329
+ [Unreleased]: https://github.com/MichaelFowler1/cost-risk-toolkit/compare/v1.0.1...HEAD
330
+ [1.0.1]: https://github.com/MichaelFowler1/cost-risk-toolkit/compare/v1.0.0...v1.0.1
331
+ [1.0.0]: https://github.com/MichaelFowler1/cost-risk-toolkit/releases/tag/v1.0.0
@@ -0,0 +1,31 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ type: software
4
+ title: "cost-risk-toolkit"
5
+ abstract: >-
6
+ A Python library and CLI for defense cost estimating. Generates synthetic
7
+ CSDR/SRDR contractor cost data, normalises it through an ingest pipeline with
8
+ a persisted WBS crosswalk and full row-level provenance, fits Wright and
9
+ Crawford learning curves and parametric cost estimating relationships by OLS,
10
+ MUPE and ZMPE, and runs correlated Monte Carlo risk simulation with discrete
11
+ risks, tornado analysis and P50/P80/P90 thresholds. Every run emits an
12
+ assumptions and provenance log organised around the four characteristics of a
13
+ reliable estimate in the GAO Cost Estimating and Assessment Guide. All data
14
+ used is synthetic; no real or proprietary contractor data is included.
15
+ authors:
16
+ - family-names: "Fowler"
17
+ given-names: "Michael"
18
+ alias: "MichaelFowler1"
19
+ repository-code: "https://github.com/MichaelFowler1/cost-risk-toolkit"
20
+ url: "https://github.com/MichaelFowler1/cost-risk-toolkit"
21
+ keywords:
22
+ - cost-estimating
23
+ - monte-carlo
24
+ - learning-curve
25
+ - risk-analysis
26
+ - csdr
27
+ license: "Apache-2.0"
28
+ version: "1.0.1"
29
+ # CFF pairs `version` with `date-released`: together they describe the release
30
+ # being cited, not the first commit. Each release moves both.
31
+ date-released: "2026-09-11"
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Michael Fowler
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,33 @@
1
+ # What goes into the sdist, beyond the files setuptools adds on its own.
2
+ #
3
+ # Without this file setuptools' default sweep picks up `tests/test_*.py` and
4
+ # nothing those modules import: no conftest.py, no golden_support.py, and none
5
+ # of the recorded goldens. An sdist like that unpacks into a suite that collects
6
+ # and then errors on `import golden_support`, which is worse than shipping no
7
+ # tests at all. So graft the whole directory: the suite in the sdist is then the
8
+ # suite in the repo, goldens included, and `pytest tests/ -q` works from an
9
+ # unpacked source release.
10
+ graft tests
11
+
12
+ # example_lots.csv is test input, not decoration. tests/golden_support.py reads
13
+ # it from the repository root for the `example_lots_csv` and `cli_fit_lots`
14
+ # golden cases, so a grafted tests/ without it is still a suite that cannot run.
15
+ include example_lots.csv
16
+
17
+ # A source release should carry the history and the citation metadata, not only
18
+ # the code. README.md and LICENSE arrive on their own through `readme` and the
19
+ # license field; requirements.txt is the exact stack the goldens were recorded
20
+ # against, which is worth having beside them.
21
+ include CHANGELOG.md
22
+ include CITATION.cff
23
+ include requirements.txt
24
+
25
+ # The README tells the reader to regenerate the hero figure with this script, so
26
+ # a source release that omits it is a source release the README lies about. The
27
+ # figure itself is not here: the README now points at it by absolute URL, which
28
+ # is what makes it render on PyPI, where nothing from the sdist is served.
29
+ include make_hero.py
30
+
31
+ # Build leftovers are not source.
32
+ global-exclude *.py[cod]
33
+ prune tests/__pycache__