skcure 0.1.0a1__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 (100) hide show
  1. skcure-0.1.0a1/CHANGELOG.md +46 -0
  2. skcure-0.1.0a1/CITATION.cff +36 -0
  3. skcure-0.1.0a1/CONTRIBUTING.md +65 -0
  4. skcure-0.1.0a1/LICENSE +675 -0
  5. skcure-0.1.0a1/MANIFEST.in +7 -0
  6. skcure-0.1.0a1/PKG-INFO +170 -0
  7. skcure-0.1.0a1/README.md +126 -0
  8. skcure-0.1.0a1/benchmarks/performance.py +367 -0
  9. skcure-0.1.0a1/benchmarks/results/README.md +17 -0
  10. skcure-0.1.0a1/benchmarks/results/performance-reference.json +1792 -0
  11. skcure-0.1.0a1/benchmarks/results/scientific-reference.json +2342 -0
  12. skcure-0.1.0a1/benchmarks/simulation.py +305 -0
  13. skcure-0.1.0a1/ci/check_version.py +26 -0
  14. skcure-0.1.0a1/ci/constraints-min.txt +7 -0
  15. skcure-0.1.0a1/ci/installed_smoke.py +52 -0
  16. skcure-0.1.0a1/docs/README.md +18 -0
  17. skcure-0.1.0a1/docs/dataframes.md +104 -0
  18. skcure-0.1.0a1/docs/evaluation.md +140 -0
  19. skcure-0.1.0a1/docs/fitting.md +101 -0
  20. skcure-0.1.0a1/docs/installation.md +64 -0
  21. skcure-0.1.0a1/docs/models.md +79 -0
  22. skcure-0.1.0a1/docs/performance.md +76 -0
  23. skcure-0.1.0a1/docs/real_data.md +65 -0
  24. skcure-0.1.0a1/docs/release.md +86 -0
  25. skcure-0.1.0a1/examples/evaluation.py +28 -0
  26. skcure-0.1.0a1/examples/gbsg2_analysis.py +321 -0
  27. skcure-0.1.0a1/pyproject.toml +70 -0
  28. skcure-0.1.0a1/requirements-deep-learning.txt +4 -0
  29. skcure-0.1.0a1/requirements.txt +2 -0
  30. skcure-0.1.0a1/setup.cfg +4 -0
  31. skcure-0.1.0a1/skcure/__init__.py +17 -0
  32. skcure-0.1.0a1/skcure/_dataframe.py +33 -0
  33. skcure-0.1.0a1/skcure/_em.py +386 -0
  34. skcure-0.1.0a1/skcure/_latency.py +755 -0
  35. skcure-0.1.0a1/skcure/_latent.py +1098 -0
  36. skcure-0.1.0a1/skcure/_state.py +26 -0
  37. skcure-0.1.0a1/skcure/base.py +277 -0
  38. skcure-0.1.0a1/skcure/datasets.py +361 -0
  39. skcure-0.1.0a1/skcure/deep_learning/__init__.py +5 -0
  40. skcure-0.1.0a1/skcure/deep_learning/_deep_ptm.py +581 -0
  41. skcure-0.1.0a1/skcure/deep_learning/_loss.py +133 -0
  42. skcure-0.1.0a1/skcure/distributions/__init__.py +10 -0
  43. skcure-0.1.0a1/skcure/distributions/base.py +106 -0
  44. skcure-0.1.0a1/skcure/distributions/generalized_gamma.py +415 -0
  45. skcure-0.1.0a1/skcure/ensemble/__init__.py +3 -0
  46. skcure-0.1.0a1/skcure/ensemble/_gb.py +844 -0
  47. skcure-0.1.0a1/skcure/ggkm.py +744 -0
  48. skcure-0.1.0a1/skcure/linear_model/__init__.py +5 -0
  49. skcure-0.1.0a1/skcure/linear_model/_base.py +267 -0
  50. skcure-0.1.0a1/skcure/linear_model/_cure.py +120 -0
  51. skcure-0.1.0a1/skcure/metrics.py +322 -0
  52. skcure-0.1.0a1/skcure/py.typed +0 -0
  53. skcure-0.1.0a1/skcure/utils/__init__.py +0 -0
  54. skcure-0.1.0a1/skcure/utils/kernels.py +119 -0
  55. skcure-0.1.0a1/skcure/utils/numerics.py +28 -0
  56. skcure-0.1.0a1/skcure/utils/pgamma_derivate.py +163 -0
  57. skcure-0.1.0a1/skcure.egg-info/PKG-INFO +170 -0
  58. skcure-0.1.0a1/skcure.egg-info/SOURCES.txt +98 -0
  59. skcure-0.1.0a1/skcure.egg-info/dependency_links.txt +1 -0
  60. skcure-0.1.0a1/skcure.egg-info/requires.txt +23 -0
  61. skcure-0.1.0a1/skcure.egg-info/top_level.txt +1 -0
  62. skcure-0.1.0a1/tests/data/README.md +27 -0
  63. skcure-0.1.0a1/tests/data/boost_legacy.json +3925 -0
  64. skcure-0.1.0a1/tests/data/boost_legacy.md +74 -0
  65. skcure-0.1.0a1/tests/data/boost_legacy_comparison.json +125 -0
  66. skcure-0.1.0a1/tests/data/ggkm_em_reference.json +109336 -0
  67. skcure-0.1.0a1/tests/data/ggkm_em_reference.md +55 -0
  68. skcure-0.1.0a1/tests/data/legacy_models.json +3033 -0
  69. skcure-0.1.0a1/tests/test_baseline_latent.py +215 -0
  70. skcure-0.1.0a1/tests/test_baseline_refactor.py +461 -0
  71. skcure-0.1.0a1/tests/test_boosting.py +764 -0
  72. skcure-0.1.0a1/tests/test_boosting_controls.py +309 -0
  73. skcure-0.1.0a1/tests/test_dataframe_inputs.py +318 -0
  74. skcure-0.1.0a1/tests/test_deep_learning.py +710 -0
  75. skcure-0.1.0a1/tests/test_deep_learning_integration.py +247 -0
  76. skcure-0.1.0a1/tests/test_em_engine.py +283 -0
  77. skcure-0.1.0a1/tests/test_em_ggkm.py +652 -0
  78. skcure-0.1.0a1/tests/test_em_iteration_limit.py +68 -0
  79. skcure-0.1.0a1/tests/test_estimator_checks.py +214 -0
  80. skcure-0.1.0a1/tests/test_fit_failure_state.py +211 -0
  81. skcure-0.1.0a1/tests/test_gamma_shape_derivative.py +126 -0
  82. skcure-0.1.0a1/tests/test_ggkm.py +768 -0
  83. skcure-0.1.0a1/tests/test_gradient_boosting_cure.py +371 -0
  84. skcure-0.1.0a1/tests/test_kernels.py +332 -0
  85. skcure-0.1.0a1/tests/test_latency_contract.py +164 -0
  86. skcure-0.1.0a1/tests/test_latency_recovery.py +250 -0
  87. skcure-0.1.0a1/tests/test_latent_contract.py +45 -0
  88. skcure-0.1.0a1/tests/test_latent_stability.py +276 -0
  89. skcure-0.1.0a1/tests/test_log_tails.py +201 -0
  90. skcure-0.1.0a1/tests/test_metrics.py +115 -0
  91. skcure-0.1.0a1/tests/test_model_stability.py +228 -0
  92. skcure-0.1.0a1/tests/test_numerics.py +191 -0
  93. skcure-0.1.0a1/tests/test_other_models.py +364 -0
  94. skcure-0.1.0a1/tests/test_paper_boundary.py +58 -0
  95. skcure-0.1.0a1/tests/test_performance_benchmark.py +153 -0
  96. skcure-0.1.0a1/tests/test_poisson_latency_delegation.py +244 -0
  97. skcure-0.1.0a1/tests/test_real_data_example.py +177 -0
  98. skcure-0.1.0a1/tests/test_scientific_benchmark.py +165 -0
  99. skcure-0.1.0a1/tests/test_simulation.py +279 -0
  100. skcure-0.1.0a1/tests/test_solver_diagnostics.py +203 -0
@@ -0,0 +1,46 @@
1
+ # Release notes
2
+
3
+ ## 0.1.0a1 — unreleased alpha
4
+
5
+ - Use a consistent training memory layout in GGKM so kernel rounding from
6
+ NumPy versus DataFrame inputs does not alter the optimizer's fitted result.
7
+ - Consolidate exponential helpers and handle expected tail overflow/underflow
8
+ consistently, preserving NaNs, infinities, and representable tiny values.
9
+ - Support eager Polars and Narwhals DataFrame feature inputs across estimators,
10
+ preserving feature-name checks and avoiding conversion through pandas. Share
11
+ input normalization with standalone kernels and future model implementations.
12
+ - Extend scientific validation to genuine Poisson, negative-binomial, and
13
+ binomial count-generating mechanisms, preserving existing simulation defaults.
14
+ - Add survival-aware scikit-learn estimator checks and reproducible runtime
15
+ and process-memory benchmarks.
16
+ - Add a complete GBSG2 real-data analysis with training-only model selection,
17
+ held-out evaluation, and explicit interpretation limits.
18
+ - Prepare the first alpha metadata and document the public API and release
19
+ verification procedure. No package publication is performed by CI.
20
+
21
+ - Recover finite generalized-gamma latency line-search failures with one
22
+ validated restart, addressing a Windows warm-refit failure. Keep optional
23
+ JAX imports compatible with type checking when the extra is absent.
24
+ - Organize estimators in `skcure.ggkm`, `skcure.ensemble`,
25
+ `skcure.linear_model`, and `skcure.deep_learning`.
26
+ - Unify gradient boosting cure families in `GradientBoostingCure` and add
27
+ a scikit-survival-compatible `DeepPromotionTimeCure` wrapper.
28
+ - Stabilize generalized-gamma tails and gradients, latent count likelihoods,
29
+ incidence updates, and neural losses at extreme parameter values.
30
+ - Add relative EM convergence tolerance, per-stage solver options, explicit
31
+ termination reasons, inner optimizer diagnostics, and warnings at fit caps.
32
+ All EM estimators retain `max_em_iter=1000` by default.
33
+ - Add a total boosting tree budget (default 1000), opt-in validation stopping
34
+ with complete best-state restoration, and staged tree predictions.
35
+ - Add `predict_latent_mean` consistently across estimator families and
36
+ document partial warm-start initialization reuse.
37
+ - Distinguish model-implied cure ROC/AUC diagnostics from observed-outcome
38
+ evaluation; preserve old metric names as aliases.
39
+ - Add IPCW survival evaluation, ground-truth cure simulations, and a
40
+ simulation benchmark.
41
+ - Use SciPy gamma shape derivatives by default. JAX becomes an optional,
42
+ explicitly selected helper backend without import-time precision changes.
43
+ - Require NumPy 2.0+ and SciPy 1.13+. Keep optional neural dependencies and
44
+ the pinned upstream DeepCure source installation separate from core metadata.
45
+ - Add user documentation, CI and distribution checks, citation metadata,
46
+ and the GPL-3.0-or-later license.
@@ -0,0 +1,36 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use scikit-cure, cite this software and the papers relevant to your models."
3
+ type: software
4
+ title: scikit-cure
5
+ authors:
6
+ - name: scikit-cure contributors
7
+ version: 0.1.0a1
8
+ repository-code: https://github.com/cowvin0/scikit-cure
9
+ url: https://github.com/cowvin0/scikit-cure
10
+ license: GPL-3.0-or-later
11
+ abstract: "Cure models extending the scikit-survival estimator API."
12
+ references:
13
+ - type: article
14
+ title: "scikit-survival: A Library for Time-to-Event Analysis Built on Top of scikit-learn"
15
+ authors:
16
+ - family-names: Pölsterl
17
+ given-names: Sebastian
18
+ journal: Journal of Machine Learning Research
19
+ year: 2020
20
+ volume: 21
21
+ issue: 212
22
+ start: 1
23
+ end: 6
24
+ url: https://jmlr.org/papers/v21/20-729.html
25
+ - type: article
26
+ title: The Deep Promotion Time Cure Model
27
+ authors:
28
+ - family-names: Medina-Olivares
29
+ given-names: Victor
30
+ - family-names: Lessmann
31
+ given-names: Stefan
32
+ - family-names: Klein
33
+ given-names: Nadja
34
+ journal: arXiv
35
+ year: 2023
36
+ url: https://arxiv.org/abs/2305.11575
@@ -0,0 +1,65 @@
1
+ # Contributing
2
+
3
+ Bug reports and pull requests are welcome at
4
+ [cowvin0/scikit-cure](https://github.com/cowvin0/scikit-cure).
5
+ Include a small reproducible example, package versions, and the traceback
6
+ when reporting a problem. For numerical issues, include the model settings
7
+ and convergence diagnostics.
8
+
9
+ Use a virtual environment named `.venv` and install development tools:
10
+
11
+ ```bash
12
+ python -m pip install -e '.[dev]'
13
+ python -m pytest -q
14
+ python -m pyright
15
+ python -m build
16
+ python -m twine check dist/*
17
+ ```
18
+
19
+ Tests using real neural dependencies skip when those dependencies are absent.
20
+ Install `requirements-deep-learning.txt` to run them. JAX derivative comparison
21
+ tests similarly require `.[jax]`; core imports and tests must work without
22
+ these extras. The CI matrix checks the minimum core versions, current
23
+ dependencies, multiple operating systems, optional backends, and installable
24
+ wheel/source artifacts. A manual release-check workflow builds and validates
25
+ artifacts without publishing them.
26
+
27
+ `tests/test_estimator_checks.py` runs selected upstream scikit-learn checks
28
+ with survival-aware target adapters, plus censored-target pipeline checks.
29
+ Keep expected short-fit convergence warnings scoped to those fits; unexpected
30
+ warnings should remain visible. The CI validation job also runs quick scientific,
31
+ performance, and real-data workflows and stores their JSON reports.
32
+
33
+ Keep constructor parameters cloneable and explicit, use the scikit-survival
34
+ target format, and preserve public prediction semantics. Add tests for
35
+ mathematical invariants and meaningful failure cases when changing fitting
36
+ or numerical routines. Frozen model fixtures in `tests/data` guard numerical
37
+ compatibility; changes to them need an explanation of the mathematical change.
38
+
39
+ ## Adding models and DataFrame support
40
+
41
+ New cure estimators should inherit `BaseCureEstimator` and use
42
+ `_validate_fit_data(X, y)` for fitting and `_validate_predict_data(X)` for
43
+ prediction. These methods supply the shared DataFrame handling, feature-name
44
+ checks, and numeric validation. Validate each prediction input once, then pass
45
+ the validated array to internal calculations.
46
+
47
+ Utilities and transformers that do not inherit the estimator base can use
48
+ `ensure_eager_dataframe` from the private `skcure._dataframe` module before
49
+ their usual scikit-learn validation. This helper unwraps Narwhals frames and
50
+ rejects lazy inputs without collecting them. Preserve the native DataFrame
51
+ until feature names have been checked; keep dtype, sparse support, and other
52
+ numeric requirements at the validation call site. Avoid backend-specific
53
+ branches in numerical code and imports from scikit-survival's private modules.
54
+
55
+ Add new estimators to the shared fixture in `tests/test_dataframe_inputs.py`
56
+ so they receive the same NumPy, pandas, Polars, and Narwhals compatibility
57
+ checks. Extend those checks for any additional input contract.
58
+
59
+ Update the user guide and `CHANGELOG.md` for public behavior changes. Before
60
+ a release, set matching versions in `pyproject.toml`, `skcure/__init__.py`,
61
+ and `CITATION.cff`, and run `python ci/check_version.py`.
62
+ See [alpha release scope and verification](docs/release.md) before preparing
63
+ distribution artifacts.
64
+
65
+ The project is licensed under GPL-3.0-or-later; see [LICENSE](LICENSE).