Commit 023775e
Use
* 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).
* Use optimagic constraints directly. Need a wrapper because we are setting values on FixedConstraints.
* Fix FixedConstraintWithValue.loc type and test expectations
Remove list from loc type union, convert callers to tuple().
Update anchoring test expectations from list to tuple.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Validate not-None input directly.
* Simplify API by setting .selectors via .loc in __post_init__
* Require dags 0.5.1
* 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>om.Constraints throughout. (#86)1 parent e965395 commit 023775e
8 files changed
Lines changed: 385 additions & 555 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments