Commit e965395
Output formatting (#84)
* Refactor model configuration to use frozen dataclasses instead of dicts
Introduce strongly-typed dataclasses for model configuration:
- Dimensions, Labels, Anchoring, EstimationOptions, TransitionInfo
- FactorEndogenousInfo, EndogenousFactorsInfo
This improves type safety and enables IDE autocompletion while keeping
user-facing model_dict as a plain dictionary.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Use frozendict for immutable dict fields in dataclasses
Replace dict fields with frozendict in frozen dataclasses to ensure
true immutability:
- Labels.aug_periods_to_periods
- Labels.aug_stages_to_stages
- Anchoring.outcomes
- TransitionInfo.param_names, individual_functions, function_names
- EndogenousFactorsInfo.aug_periods_to_aug_period_meas_types, factor_info
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Ignore ty false positive.
* Return ProcessedModel dataclass from process_model() instead of dict
Update process_model() to return a ProcessedModel frozen dataclass
and update all consumers to use attribute access instead of dict access.
This provides:
- Better type safety with explicit typed fields
- Immutability via frozen dataclass
- IDE autocomplete support
- Clear documentation of the model structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Rename FactorEndogenousInfo to FactorInfo
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Ensure complete typing in src/skillmodels.
* Require Python 3.14 before fixing type annotations.
* Move TESTS_DIR -> TEST_DATA_DIR, which points to a subdirectory of src so that config.TEST_DATA_DIR is valid also for skillmodels the package (as opposed to the project).
* Fix more linting issues.
* Make ruff rules much stricter.
* Further tighten type annotations. Fix a missing run-time annotation of NDArray.
* Move unsafe_fixes = false from .pre-commit config to pyproject.
* Fix query in data simulation.
* More fixes to imports, add test.
* Use more tuples in place of lists to prevent errors.
* Fix typing.
* Dataclasses for user input.
* Simplify.
* Use modern rng everywhere.
* Update CLAUDE.md
* Get rid of if TYPE_CHECKING blocks
* Update hooks and clean up
* Call by name throughout.
* Autogenerated docs, harmonised hooks / project configuration.
* Get rid of model_dict.
* Replace yaml model specifications by ModelSpec-s.
* Next shot at fixing pickling.
* Add improved output formatting.
* Add variance decompositions.
* Fix variance decomposition to use aug_period instead of period.
The filtered_states DataFrame and params index both use aug_period as the
period identifier, not period. This fixes KeyError when calling
decompose_measurement_variance.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix diagnostic_plots double-processing of debug data.
debug_loglike already returns processed debug data (it calls
process_debug_data internally). Remove the redundant second call
to process_debug_data which was causing AttributeError when trying
to iterate over already-processed DataFrames.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Review comments 1: single EstimationOptions; improved dataclasses with all defaults set right there; get rid of remaining mutable types being passed around.
* Review comments on docs; tighten typing of Mapping to MappingProxyType where we could do so.
* Back to general implementation of ensure_containers_are_immutable.
* Small fixes.
* Latest boilerplate version.
* Make optimagic a package dependency.
* Latest boilerplate.
* Make jupyterbook and pytask required deps.
* Use dags 0.5.0 dev branch.
* Update CLAUDE.md with complete API docs and actual application usage
Document all 14 public exports, get_maximization_inputs return dict,
ProcessedModel attributes, frequently used internal APIs, all 7
transition functions, and ModelSpec builder methods — based on how
the package is actually used in skane-struct-bw and health-cognition.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Increase test coverage to close to 100%.
* Fix bugs caught by review agent.
* Call ty environment 'type-checking'.
* Require dags 0.5, bump pandas, numpy and hooks, fix resulting issues.
* Remove suppression of deprecation warning, which is unnecessary in Pandas 3.0
* Make ruff stricter.
* Update boilerplate.
* Update ty and remove a couple of unused-ignores.
* Rename _sel to select_by_loc; fix stale docstring
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Allow passing states directly to get_transition_plots (health-cognition use case).
* Fix aug_period/period bug in transition equation visualization
The viz code assumed states DataFrames always have `aug_period` as a
column, but pre-computed states (e.g. from health-cognition) may carry
`period` in the index instead. Add `_normalize_states_columns` to
promote index levels and rename `period` → `aug_period` when needed.
Also document the period vs aug_period convention in CLAUDE.md.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Remove aug_periods from public-facing functions.
* Previous commit was too greedy.
* Use pixi 0.66 in CI; prek autoupdate.
* CHORE: Approximation-tolerant floating point comparisons, remove pandas in-place operations.
* Get rid of unnecessary block-comments.
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent fd70d45 commit e965395
57 files changed
Lines changed: 6371 additions & 3710 deletions
File tree
- .github/workflows
- src/skillmodels
- test_data
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Submodule .ai-instructions added at f2744aa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | | - | |
52 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
0 commit comments