torchregress 0.3.0__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 (407) hide show
  1. torchregress-0.3.0/CHANGELOG.md +619 -0
  2. torchregress-0.3.0/LICENSE +21 -0
  3. torchregress-0.3.0/MANIFEST.in +4 -0
  4. torchregress-0.3.0/PKG-INFO +218 -0
  5. torchregress-0.3.0/README.md +165 -0
  6. torchregress-0.3.0/pyproject.toml +178 -0
  7. torchregress-0.3.0/setup.cfg +4 -0
  8. torchregress-0.3.0/src/torchregress/__init__.py +87 -0
  9. torchregress-0.3.0/src/torchregress/algorithms/__init__.py +84 -0
  10. torchregress-0.3.0/src/torchregress/algorithms/adaptive_prior_vi.py +284 -0
  11. torchregress-0.3.0/src/torchregress/algorithms/covariance_pseudo_labels.py +222 -0
  12. torchregress-0.3.0/src/torchregress/algorithms/error_aware.py +164 -0
  13. torchregress-0.3.0/src/torchregress/algorithms/forward_inversion.py +1102 -0
  14. torchregress-0.3.0/src/torchregress/algorithms/group_dro.py +844 -0
  15. torchregress-0.3.0/src/torchregress/algorithms/heteroscedastic_laplace.py +333 -0
  16. torchregress-0.3.0/src/torchregress/algorithms/irls.py +603 -0
  17. torchregress-0.3.0/src/torchregress/algorithms/irls_fit.py +892 -0
  18. torchregress-0.3.0/src/torchregress/algorithms/ivon.py +335 -0
  19. torchregress-0.3.0/src/torchregress/algorithms/latentnn.py +260 -0
  20. torchregress-0.3.0/src/torchregress/algorithms/rc.py +290 -0
  21. torchregress-0.3.0/src/torchregress/algorithms/simex.py +289 -0
  22. torchregress-0.3.0/src/torchregress/algorithms/tictac.py +160 -0
  23. torchregress-0.3.0/src/torchregress/algorithms/vir.py +1368 -0
  24. torchregress-0.3.0/src/torchregress/algorithms/warmup_mc.py +156 -0
  25. torchregress-0.3.0/src/torchregress/calibration/__init__.py +59 -0
  26. torchregress-0.3.0/src/torchregress/calibration/metrics.py +446 -0
  27. torchregress-0.3.0/src/torchregress/calibration/multisource.py +340 -0
  28. torchregress-0.3.0/src/torchregress/calibration/posthoc.py +667 -0
  29. torchregress-0.3.0/src/torchregress/calibration/semicp.py +202 -0
  30. torchregress-0.3.0/src/torchregress/calibration/shift.py +288 -0
  31. torchregress-0.3.0/src/torchregress/causal/__init__.py +11 -0
  32. torchregress-0.3.0/src/torchregress/causal/diagnostics.py +61 -0
  33. torchregress-0.3.0/src/torchregress/causal/dr.py +427 -0
  34. torchregress-0.3.0/src/torchregress/comparison.py +167 -0
  35. torchregress-0.3.0/src/torchregress/constraints/__init__.py +11 -0
  36. torchregress-0.3.0/src/torchregress/constraints/heads.py +84 -0
  37. torchregress-0.3.0/src/torchregress/ensemble/__init__.py +59 -0
  38. torchregress-0.3.0/src/torchregress/ensemble/_variance.py +39 -0
  39. torchregress-0.3.0/src/torchregress/ensemble/base.py +421 -0
  40. torchregress-0.3.0/src/torchregress/ensemble/bnn.py +456 -0
  41. torchregress-0.3.0/src/torchregress/ensemble/combiners.py +125 -0
  42. torchregress-0.3.0/src/torchregress/ensemble/laplace.py +266 -0
  43. torchregress-0.3.0/src/torchregress/ensemble/layers.py +104 -0
  44. torchregress-0.3.0/src/torchregress/ensemble/mc_dropout.py +166 -0
  45. torchregress-0.3.0/src/torchregress/ensemble/models.py +727 -0
  46. torchregress-0.3.0/src/torchregress/ensemble/packed.py +208 -0
  47. torchregress-0.3.0/src/torchregress/ensemble/snapshot.py +179 -0
  48. torchregress-0.3.0/src/torchregress/ensemble/swag.py +534 -0
  49. torchregress-0.3.0/src/torchregress/ensemble/utils.py +13 -0
  50. torchregress-0.3.0/src/torchregress/estimators.py +1073 -0
  51. torchregress-0.3.0/src/torchregress/health.py +84 -0
  52. torchregress-0.3.0/src/torchregress/inference/__init__.py +43 -0
  53. torchregress-0.3.0/src/torchregress/inference/orthogonal.py +499 -0
  54. torchregress-0.3.0/src/torchregress/inference/ppi.py +759 -0
  55. torchregress-0.3.0/src/torchregress/inference/ratio.py +508 -0
  56. torchregress-0.3.0/src/torchregress/losses/__init__.py +420 -0
  57. torchregress-0.3.0/src/torchregress/losses/_poisson_gaussian_kernel.py +386 -0
  58. torchregress-0.3.0/src/torchregress/losses/balanced_mse.py +252 -0
  59. torchregress-0.3.0/src/torchregress/losses/balanced_mse_bmc.py +713 -0
  60. torchregress-0.3.0/src/torchregress/losses/base.py +553 -0
  61. torchregress-0.3.0/src/torchregress/losses/beta_nll.py +153 -0
  62. torchregress-0.3.0/src/torchregress/losses/cdf.py +75 -0
  63. torchregress-0.3.0/src/torchregress/losses/censored.py +323 -0
  64. torchregress-0.3.0/src/torchregress/losses/conformal.py +3079 -0
  65. torchregress-0.3.0/src/torchregress/losses/contrastive.py +137 -0
  66. torchregress-0.3.0/src/torchregress/losses/eiv.py +1812 -0
  67. torchregress-0.3.0/src/torchregress/losses/evidential.py +532 -0
  68. torchregress-0.3.0/src/torchregress/losses/expectile.py +464 -0
  69. torchregress-0.3.0/src/torchregress/losses/faithful_gaussian.py +157 -0
  70. torchregress-0.3.0/src/torchregress/losses/families.py +911 -0
  71. torchregress-0.3.0/src/torchregress/losses/forward_quadrature.py +318 -0
  72. torchregress-0.3.0/src/torchregress/losses/gaussian.py +409 -0
  73. torchregress-0.3.0/src/torchregress/losses/gaussian_wasserstein.py +286 -0
  74. torchregress-0.3.0/src/torchregress/losses/imbalanced.py +912 -0
  75. torchregress-0.3.0/src/torchregress/losses/loss_registry.py +83 -0
  76. torchregress-0.3.0/src/torchregress/losses/mdn.py +576 -0
  77. torchregress-0.3.0/src/torchregress/losses/multisource.py +461 -0
  78. torchregress-0.3.0/src/torchregress/losses/multisource_robust.py +325 -0
  79. torchregress-0.3.0/src/torchregress/losses/nflows.py +1177 -0
  80. torchregress-0.3.0/src/torchregress/losses/noise_aware_density.py +753 -0
  81. torchregress-0.3.0/src/torchregress/losses/nre.py +675 -0
  82. torchregress-0.3.0/src/torchregress/losses/ordinal.py +214 -0
  83. torchregress-0.3.0/src/torchregress/losses/poisson.py +414 -0
  84. torchregress-0.3.0/src/torchregress/losses/poisson_gaussian.py +744 -0
  85. torchregress-0.3.0/src/torchregress/losses/prime.py +990 -0
  86. torchregress-0.3.0/src/torchregress/losses/quantile.py +401 -0
  87. torchregress-0.3.0/src/torchregress/losses/rank_sim.py +570 -0
  88. torchregress-0.3.0/src/torchregress/losses/robust.py +708 -0
  89. torchregress-0.3.0/src/torchregress/losses/sls.py +786 -0
  90. torchregress-0.3.0/src/torchregress/losses/split_eiv.py +536 -0
  91. torchregress-0.3.0/src/torchregress/losses/student_t.py +138 -0
  92. torchregress-0.3.0/src/torchregress/losses/transforms.py +176 -0
  93. torchregress-0.3.0/src/torchregress/losses/tweedie.py +325 -0
  94. torchregress-0.3.0/src/torchregress/losses/uncertain_gt.py +403 -0
  95. torchregress-0.3.0/src/torchregress/losses/utils_robust.py +46 -0
  96. torchregress-0.3.0/src/torchregress/losses/waldo.py +729 -0
  97. torchregress-0.3.0/src/torchregress/losses/wasserstein1d.py +134 -0
  98. torchregress-0.3.0/src/torchregress/method_catalog.py +2892 -0
  99. torchregress-0.3.0/src/torchregress/metrics/__init__.py +254 -0
  100. torchregress-0.3.0/src/torchregress/metrics/censored.py +116 -0
  101. torchregress-0.3.0/src/torchregress/metrics/decision.py +265 -0
  102. torchregress-0.3.0/src/torchregress/metrics/density.py +203 -0
  103. torchregress-0.3.0/src/torchregress/metrics/distribution.py +1436 -0
  104. torchregress-0.3.0/src/torchregress/metrics/ensemble.py +287 -0
  105. torchregress-0.3.0/src/torchregress/metrics/interval.py +288 -0
  106. torchregress-0.3.0/src/torchregress/metrics/multivariate.py +85 -0
  107. torchregress-0.3.0/src/torchregress/metrics/ood.py +461 -0
  108. torchregress-0.3.0/src/torchregress/metrics/ordinal.py +122 -0
  109. torchregress-0.3.0/src/torchregress/metrics/point.py +817 -0
  110. torchregress-0.3.0/src/torchregress/metrics/representation.py +202 -0
  111. torchregress-0.3.0/src/torchregress/metrics/sbi.py +685 -0
  112. torchregress-0.3.0/src/torchregress/metrics/tac.py +131 -0
  113. torchregress-0.3.0/src/torchregress/metrics/uncertain.py +91 -0
  114. torchregress-0.3.0/src/torchregress/metrics/utils.py +109 -0
  115. torchregress-0.3.0/src/torchregress/models/__init__.py +32 -0
  116. torchregress-0.3.0/src/torchregress/models/copula_spline.py +262 -0
  117. torchregress-0.3.0/src/torchregress/models/flow_matching.py +115 -0
  118. torchregress-0.3.0/src/torchregress/models/ft_transformer.py +66 -0
  119. torchregress-0.3.0/src/torchregress/models/normalizing_flow_map.py +467 -0
  120. torchregress-0.3.0/src/torchregress/models/preprocessing.py +235 -0
  121. torchregress-0.3.0/src/torchregress/models/tabular_mlp.py +170 -0
  122. torchregress-0.3.0/src/torchregress/models/training.py +489 -0
  123. torchregress-0.3.0/src/torchregress/prediction.py +281 -0
  124. torchregress-0.3.0/src/torchregress/py.typed +0 -0
  125. torchregress-0.3.0/src/torchregress/semi_supervised.py +1195 -0
  126. torchregress-0.3.0/src/torchregress/test_time/__init__.py +101 -0
  127. torchregress-0.3.0/src/torchregress/test_time/base.py +65 -0
  128. torchregress-0.3.0/src/torchregress/test_time/bayes.py +453 -0
  129. torchregress-0.3.0/src/torchregress/test_time/benchmark.py +229 -0
  130. torchregress-0.3.0/src/torchregress/test_time/cosa.py +226 -0
  131. torchregress-0.3.0/src/torchregress/test_time/dynamic.py +43 -0
  132. torchregress-0.3.0/src/torchregress/test_time/joint_tta.py +386 -0
  133. torchregress-0.3.0/src/torchregress/test_time/label_shift.py +581 -0
  134. torchregress-0.3.0/src/torchregress/test_time/ot_conformal.py +491 -0
  135. torchregress-0.3.0/src/torchregress/test_time/ot_conformal_predictive.py +64 -0
  136. torchregress-0.3.0/src/torchregress/test_time/selection.py +238 -0
  137. torchregress-0.3.0/src/torchregress/test_time/shift_weights.py +235 -0
  138. torchregress-0.3.0/src/torchregress/test_time/subspace.py +206 -0
  139. torchregress-0.3.0/src/torchregress/test_time/transport.py +1191 -0
  140. torchregress-0.3.0/src/torchregress/utils/__init__.py +62 -0
  141. torchregress-0.3.0/src/torchregress/utils/augment.py +195 -0
  142. torchregress-0.3.0/src/torchregress/utils/bspline.py +339 -0
  143. torchregress-0.3.0/src/torchregress/utils/distributions.py +19 -0
  144. torchregress-0.3.0/src/torchregress/utils/gaussian_output.py +114 -0
  145. torchregress-0.3.0/src/torchregress/utils/numpy_stats.py +65 -0
  146. torchregress-0.3.0/src/torchregress/utils/openml_relaxed.py +236 -0
  147. torchregress-0.3.0/src/torchregress/utils/ordinal.py +234 -0
  148. torchregress-0.3.0/src/torchregress/utils/propensity.py +46 -0
  149. torchregress-0.3.0/src/torchregress/utils/pytorch_compat.py +65 -0
  150. torchregress-0.3.0/src/torchregress/utils/quantile.py +76 -0
  151. torchregress-0.3.0/src/torchregress/utils/reduction.py +44 -0
  152. torchregress-0.3.0/src/torchregress/utils/security.py +27 -0
  153. torchregress-0.3.0/src/torchregress/utils/semisupervised.py +70 -0
  154. torchregress-0.3.0/src/torchregress/utils/tensor_ops.py +391 -0
  155. torchregress-0.3.0/src/torchregress/utils/transform.py +157 -0
  156. torchregress-0.3.0/src/torchregress/utils/validation.py +309 -0
  157. torchregress-0.3.0/src/torchregress/viz/__init__.py +125 -0
  158. torchregress-0.3.0/src/torchregress/viz/diagnostic.py +2109 -0
  159. torchregress-0.3.0/src/torchregress/viz/monitoring.py +673 -0
  160. torchregress-0.3.0/src/torchregress/viz/results.py +1533 -0
  161. torchregress-0.3.0/src/torchregress/viz/utils.py +456 -0
  162. torchregress-0.3.0/src/torchregress.egg-info/PKG-INFO +218 -0
  163. torchregress-0.3.0/src/torchregress.egg-info/SOURCES.txt +405 -0
  164. torchregress-0.3.0/src/torchregress.egg-info/dependency_links.txt +1 -0
  165. torchregress-0.3.0/src/torchregress.egg-info/entry_points.txt +2 -0
  166. torchregress-0.3.0/src/torchregress.egg-info/requires.txt +29 -0
  167. torchregress-0.3.0/src/torchregress.egg-info/top_level.txt +1 -0
  168. torchregress-0.3.0/tests/__init__.py +1 -0
  169. torchregress-0.3.0/tests/_multisource_reference.py +428 -0
  170. torchregress-0.3.0/tests/_test_models.py +78 -0
  171. torchregress-0.3.0/tests/algorithms/test_covariance_pseudo_labels.py +93 -0
  172. torchregress-0.3.0/tests/algorithms/test_error_aware.py +34 -0
  173. torchregress-0.3.0/tests/algorithms/test_forward_inversion.py +583 -0
  174. torchregress-0.3.0/tests/algorithms/test_group_dro.py +506 -0
  175. torchregress-0.3.0/tests/algorithms/test_irls.py +108 -0
  176. torchregress-0.3.0/tests/algorithms/test_irls_fit.py +517 -0
  177. torchregress-0.3.0/tests/algorithms/test_irls_security.py +51 -0
  178. torchregress-0.3.0/tests/algorithms/test_ivon.py +155 -0
  179. torchregress-0.3.0/tests/algorithms/test_latentnn.py +136 -0
  180. torchregress-0.3.0/tests/algorithms/test_rc.py +133 -0
  181. torchregress-0.3.0/tests/algorithms/test_rc_security.py +40 -0
  182. torchregress-0.3.0/tests/algorithms/test_simex.py +138 -0
  183. torchregress-0.3.0/tests/algorithms/test_simex_security.py +65 -0
  184. torchregress-0.3.0/tests/algorithms/test_vir.py +676 -0
  185. torchregress-0.3.0/tests/algorithms/test_warmup_mc.py +270 -0
  186. torchregress-0.3.0/tests/audit/test_audit_batch4.py +713 -0
  187. torchregress-0.3.0/tests/audit/test_audit_batch5.py +676 -0
  188. torchregress-0.3.0/tests/audit/test_audit_c2.py +171 -0
  189. torchregress-0.3.0/tests/audit/test_audit_conformal_losses_b.py +956 -0
  190. torchregress-0.3.0/tests/audit/test_audit_inference.py +620 -0
  191. torchregress-0.3.0/tests/audit/test_audit_losses_a.py +576 -0
  192. torchregress-0.3.0/tests/audit/test_audit_metrics.py +311 -0
  193. torchregress-0.3.0/tests/audit/test_audit_postharness.py +372 -0
  194. torchregress-0.3.0/tests/calibration/test_metrics.py +427 -0
  195. torchregress-0.3.0/tests/calibration/test_posthoc.py +360 -0
  196. torchregress-0.3.0/tests/calibration/test_semicp.py +198 -0
  197. torchregress-0.3.0/tests/calibration/test_semicp_single_inflation.py +72 -0
  198. torchregress-0.3.0/tests/calibration/test_shift.py +160 -0
  199. torchregress-0.3.0/tests/calibration/test_shift_edge.py +313 -0
  200. torchregress-0.3.0/tests/calibration/test_variance_restoring.py +269 -0
  201. torchregress-0.3.0/tests/causal/test_diagnostics.py +99 -0
  202. torchregress-0.3.0/tests/causal/test_dr.py +419 -0
  203. torchregress-0.3.0/tests/causal/test_dr_ppi_guards.py +190 -0
  204. torchregress-0.3.0/tests/conftest.py +78 -0
  205. torchregress-0.3.0/tests/constraints/test_heads.py +183 -0
  206. torchregress-0.3.0/tests/ensemble/test_combiners.py +108 -0
  207. torchregress-0.3.0/tests/ensemble/test_mc_dropout.py +293 -0
  208. torchregress-0.3.0/tests/ensemble/test_snapshot_and_laplace.py +159 -0
  209. torchregress-0.3.0/tests/ensemble/test_swag.py +413 -0
  210. torchregress-0.3.0/tests/ensemble/test_swag_buffer_contract.py +175 -0
  211. torchregress-0.3.0/tests/inference/test_ppi.py +585 -0
  212. torchregress-0.3.0/tests/inference/test_ppi_dr_integration.py +549 -0
  213. torchregress-0.3.0/tests/inference/test_ratio.py +498 -0
  214. torchregress-0.3.0/tests/losses/__init__.py +1 -0
  215. torchregress-0.3.0/tests/losses/test_balanced_mse.py +69 -0
  216. torchregress-0.3.0/tests/losses/test_balanced_mse_bmc.py +452 -0
  217. torchregress-0.3.0/tests/losses/test_base.py +444 -0
  218. torchregress-0.3.0/tests/losses/test_base_integration.py +189 -0
  219. torchregress-0.3.0/tests/losses/test_beta_nll.py +140 -0
  220. torchregress-0.3.0/tests/losses/test_binned_joint.py +91 -0
  221. torchregress-0.3.0/tests/losses/test_bpf_identity_tails.py +90 -0
  222. torchregress-0.3.0/tests/losses/test_cdf.py +30 -0
  223. torchregress-0.3.0/tests/losses/test_censored.py +56 -0
  224. torchregress-0.3.0/tests/losses/test_conformal.py +1366 -0
  225. torchregress-0.3.0/tests/losses/test_conformal_streaming.py +514 -0
  226. torchregress-0.3.0/tests/losses/test_conformal_weighted_quantile.py +166 -0
  227. torchregress-0.3.0/tests/losses/test_conformalized_density.py +108 -0
  228. torchregress-0.3.0/tests/losses/test_contrastive_nflows.py +198 -0
  229. torchregress-0.3.0/tests/losses/test_cti_vectorization.py +93 -0
  230. torchregress-0.3.0/tests/losses/test_cvar.py +94 -0
  231. torchregress-0.3.0/tests/losses/test_density_api.py +55 -0
  232. torchregress-0.3.0/tests/losses/test_eiv.py +363 -0
  233. torchregress-0.3.0/tests/losses/test_eiv_correctness.py +228 -0
  234. torchregress-0.3.0/tests/losses/test_eiv_internals.py +201 -0
  235. torchregress-0.3.0/tests/losses/test_evidential.py +290 -0
  236. torchregress-0.3.0/tests/losses/test_expectile.py +825 -0
  237. torchregress-0.3.0/tests/losses/test_faithful_gaussian.py +138 -0
  238. torchregress-0.3.0/tests/losses/test_families.py +498 -0
  239. torchregress-0.3.0/tests/losses/test_functional_wrappers.py +388 -0
  240. torchregress-0.3.0/tests/losses/test_gaussian.py +433 -0
  241. torchregress-0.3.0/tests/losses/test_gaussian_consistency.py +1160 -0
  242. torchregress-0.3.0/tests/losses/test_gaussian_wasserstein.py +197 -0
  243. torchregress-0.3.0/tests/losses/test_gaussian_wasserstein_hybrid_behaviour.py +44 -0
  244. torchregress-0.3.0/tests/losses/test_imbalanced.py +319 -0
  245. torchregress-0.3.0/tests/losses/test_indirect_utilities.py +229 -0
  246. torchregress-0.3.0/tests/losses/test_loss_fixes.py +577 -0
  247. torchregress-0.3.0/tests/losses/test_loss_registry.py +298 -0
  248. torchregress-0.3.0/tests/losses/test_losses_regression_guards.py +386 -0
  249. torchregress-0.3.0/tests/losses/test_mdn.py +460 -0
  250. torchregress-0.3.0/tests/losses/test_nflows.py +490 -0
  251. torchregress-0.3.0/tests/losses/test_nflows_affine_stability.py +182 -0
  252. torchregress-0.3.0/tests/losses/test_nflows_tail_bound.py +143 -0
  253. torchregress-0.3.0/tests/losses/test_noise_aware_density.py +153 -0
  254. torchregress-0.3.0/tests/losses/test_noise_density_contract_regressions.py +169 -0
  255. torchregress-0.3.0/tests/losses/test_non_gaussian_consistency.py +1723 -0
  256. torchregress-0.3.0/tests/losses/test_nre.py +876 -0
  257. torchregress-0.3.0/tests/losses/test_ordinal.py +86 -0
  258. torchregress-0.3.0/tests/losses/test_poisson.py +560 -0
  259. torchregress-0.3.0/tests/losses/test_poisson_gaussian.py +550 -0
  260. torchregress-0.3.0/tests/losses/test_poisson_gaussian_convolution.py +294 -0
  261. torchregress-0.3.0/tests/losses/test_prime_conr.py +589 -0
  262. torchregress-0.3.0/tests/losses/test_quantile.py +191 -0
  263. torchregress-0.3.0/tests/losses/test_rank_n_contrast.py +120 -0
  264. torchregress-0.3.0/tests/losses/test_rank_sim.py +610 -0
  265. torchregress-0.3.0/tests/losses/test_robust.py +412 -0
  266. torchregress-0.3.0/tests/losses/test_skew_t_cdf_accuracy.py +234 -0
  267. torchregress-0.3.0/tests/losses/test_sls.py +256 -0
  268. torchregress-0.3.0/tests/losses/test_sls_conformal.py +40 -0
  269. torchregress-0.3.0/tests/losses/test_sls_internals.py +348 -0
  270. torchregress-0.3.0/tests/losses/test_split_eiv.py +424 -0
  271. torchregress-0.3.0/tests/losses/test_student_t.py +261 -0
  272. torchregress-0.3.0/tests/losses/test_transforms.py +53 -0
  273. torchregress-0.3.0/tests/losses/test_tweedie.py +505 -0
  274. torchregress-0.3.0/tests/losses/test_uncertain_gt.py +136 -0
  275. torchregress-0.3.0/tests/losses/test_waldo.py +151 -0
  276. torchregress-0.3.0/tests/losses/test_wasserstein1d.py +95 -0
  277. torchregress-0.3.0/tests/metrics/test_density_metrics.py +182 -0
  278. torchregress-0.3.0/tests/metrics/test_distribution.py +990 -0
  279. torchregress-0.3.0/tests/metrics/test_distribution_guards.py +425 -0
  280. torchregress-0.3.0/tests/metrics/test_functional_device.py +223 -0
  281. torchregress-0.3.0/tests/metrics/test_reference_parity.py +1010 -0
  282. torchregress-0.3.0/tests/metrics/test_representation.py +112 -0
  283. torchregress-0.3.0/tests/metrics/test_sbi.py +464 -0
  284. torchregress-0.3.0/tests/metrics/test_scoring_properties.py +155 -0
  285. torchregress-0.3.0/tests/models/test_flow_matching.py +35 -0
  286. torchregress-0.3.0/tests/models/test_ft_transformer.py +24 -0
  287. torchregress-0.3.0/tests/models/test_normalizing_flow_map.py +159 -0
  288. torchregress-0.3.0/tests/models/test_tabular_mlp.py +314 -0
  289. torchregress-0.3.0/tests/test_adaptive_prior_vi.py +72 -0
  290. torchregress-0.3.0/tests/test_advanced_losses_behavior.py +218 -0
  291. torchregress-0.3.0/tests/test_api_consistency.py +288 -0
  292. torchregress-0.3.0/tests/test_bayes_linear_head.py +162 -0
  293. torchregress-0.3.0/tests/test_benchmark_report_summary.py +53 -0
  294. torchregress-0.3.0/tests/test_benchmark_smoke.py +166 -0
  295. torchregress-0.3.0/tests/test_blr_benchmarks_smoke.py +82 -0
  296. torchregress-0.3.0/tests/test_bnn.py +170 -0
  297. torchregress-0.3.0/tests/test_boxcox_detailed.py +91 -0
  298. torchregress-0.3.0/tests/test_calibration_package.py +14 -0
  299. torchregress-0.3.0/tests/test_causal_diagnostics.py +192 -0
  300. torchregress-0.3.0/tests/test_causal_dr.py +381 -0
  301. torchregress-0.3.0/tests/test_ci_workflow_contracts.py +22 -0
  302. torchregress-0.3.0/tests/test_comparison.py +278 -0
  303. torchregress-0.3.0/tests/test_comparison_seed.py +16 -0
  304. torchregress-0.3.0/tests/test_constraints_calibration.py +74 -0
  305. torchregress-0.3.0/tests/test_contrastive_flow_example.py +90 -0
  306. torchregress-0.3.0/tests/test_copula_spline.py +329 -0
  307. torchregress-0.3.0/tests/test_decision_metrics.py +140 -0
  308. torchregress-0.3.0/tests/test_device_parity.py +1350 -0
  309. torchregress-0.3.0/tests/test_docs_claims_guardrail.py +33 -0
  310. torchregress-0.3.0/tests/test_docs_snippets_smoke.py +180 -0
  311. torchregress-0.3.0/tests/test_ensemble.py +483 -0
  312. torchregress-0.3.0/tests/test_ensemble_consistency.py +414 -0
  313. torchregress-0.3.0/tests/test_ensemble_correctness_fixes.py +103 -0
  314. torchregress-0.3.0/tests/test_ensemble_training_behavior.py +177 -0
  315. torchregress-0.3.0/tests/test_ensemble_uncertainty_behavior.py +150 -0
  316. torchregress-0.3.0/tests/test_estimators.py +674 -0
  317. torchregress-0.3.0/tests/test_examples_output_summaries.py +956 -0
  318. torchregress-0.3.0/tests/test_examples_smoke.py +859 -0
  319. torchregress-0.3.0/tests/test_flow_memory_cycles.py +114 -0
  320. torchregress-0.3.0/tests/test_forward_quadrature.py +335 -0
  321. torchregress-0.3.0/tests/test_health.py +24 -0
  322. torchregress-0.3.0/tests/test_heteroscedastic_laplace.py +89 -0
  323. torchregress-0.3.0/tests/test_inference_orthogonal.py +417 -0
  324. torchregress-0.3.0/tests/test_joint_tta.py +241 -0
  325. torchregress-0.3.0/tests/test_loss_forward_signature_contracts.py +121 -0
  326. torchregress-0.3.0/tests/test_method_catalog.py +582 -0
  327. torchregress-0.3.0/tests/test_method_catalog_render.py +160 -0
  328. torchregress-0.3.0/tests/test_metrics.py +750 -0
  329. torchregress-0.3.0/tests/test_metrics_calibration_ood_behavior.py +165 -0
  330. torchregress-0.3.0/tests/test_metrics_censored.py +46 -0
  331. torchregress-0.3.0/tests/test_metrics_hardening.py +135 -0
  332. torchregress-0.3.0/tests/test_metrics_multivariate.py +34 -0
  333. torchregress-0.3.0/tests/test_metrics_ordinal.py +45 -0
  334. torchregress-0.3.0/tests/test_metrics_point.py +782 -0
  335. torchregress-0.3.0/tests/test_metrics_tail.py +24 -0
  336. torchregress-0.3.0/tests/test_metrics_uncertain.py +57 -0
  337. torchregress-0.3.0/tests/test_multisource_gaussian.py +126 -0
  338. torchregress-0.3.0/tests/test_multisource_robust.py +312 -0
  339. torchregress-0.3.0/tests/test_multisource_splines.py +139 -0
  340. torchregress-0.3.0/tests/test_multisource_vectorized.py +328 -0
  341. torchregress-0.3.0/tests/test_multivariate_score_cp.py +100 -0
  342. torchregress-0.3.0/tests/test_native_leverage_matrix_contracts.py +92 -0
  343. torchregress-0.3.0/tests/test_native_parity.py +206 -0
  344. torchregress-0.3.0/tests/test_nexc_conformal.py +91 -0
  345. torchregress-0.3.0/tests/test_numerical_stability.py +107 -0
  346. torchregress-0.3.0/tests/test_openml_relaxed.py +228 -0
  347. torchregress-0.3.0/tests/test_optional_flow_behavior.py +36 -0
  348. torchregress-0.3.0/tests/test_ot_conformal.py +105 -0
  349. torchregress-0.3.0/tests/test_ot_conformal_edge.py +346 -0
  350. torchregress-0.3.0/tests/test_packed_ensemble.py +55 -0
  351. torchregress-0.3.0/tests/test_ppi_inference.py +264 -0
  352. torchregress-0.3.0/tests/test_prediction.py +228 -0
  353. torchregress-0.3.0/tests/test_prediction_and_test_time.py +672 -0
  354. torchregress-0.3.0/tests/test_probabilistic_loss_stress.py +131 -0
  355. torchregress-0.3.0/tests/test_public_api_contracts.py +725 -0
  356. torchregress-0.3.0/tests/test_realdata_recommendation_render.py +82 -0
  357. torchregress-0.3.0/tests/test_release_scripts.py +195 -0
  358. torchregress-0.3.0/tests/test_reliability.py +146 -0
  359. torchregress-0.3.0/tests/test_scaling.py +1 -0
  360. torchregress-0.3.0/tests/test_security.py +43 -0
  361. torchregress-0.3.0/tests/test_semi_supervised.py +563 -0
  362. torchregress-0.3.0/tests/test_tictac.py +122 -0
  363. torchregress-0.3.0/tests/test_time/test_base.py +348 -0
  364. torchregress-0.3.0/tests/test_time/test_bayes.py +740 -0
  365. torchregress-0.3.0/tests/test_time/test_benchmark.py +117 -0
  366. torchregress-0.3.0/tests/test_time/test_calibration.py +235 -0
  367. torchregress-0.3.0/tests/test_time/test_cosa_and_conformal.py +151 -0
  368. torchregress-0.3.0/tests/test_time/test_dynamic.py +284 -0
  369. torchregress-0.3.0/tests/test_time/test_label_shift.py +297 -0
  370. torchregress-0.3.0/tests/test_time/test_label_shift_bbse.py +105 -0
  371. torchregress-0.3.0/tests/test_time/test_label_shift_edge.py +470 -0
  372. torchregress-0.3.0/tests/test_time/test_ot_conformal_predictive.py +228 -0
  373. torchregress-0.3.0/tests/test_time/test_ot_conformal_weighted_split.py +46 -0
  374. torchregress-0.3.0/tests/test_time/test_selection.py +102 -0
  375. torchregress-0.3.0/tests/test_time/test_selection_edge.py +342 -0
  376. torchregress-0.3.0/tests/test_time/test_subspace.py +103 -0
  377. torchregress-0.3.0/tests/test_time/test_subspace_edge.py +328 -0
  378. torchregress-0.3.0/tests/test_time/test_transport.py +668 -0
  379. torchregress-0.3.0/tests/test_time/test_transport_orchestrator.py +799 -0
  380. torchregress-0.3.0/tests/test_trcor05_weighted_quantile.py +47 -0
  381. torchregress-0.3.0/tests/test_utils_augment_api.py +30 -0
  382. torchregress-0.3.0/tests/test_utils_distributions.py +198 -0
  383. torchregress-0.3.0/tests/test_utils_exports.py +36 -0
  384. torchregress-0.3.0/tests/test_utils_gaussian_output.py +62 -0
  385. torchregress-0.3.0/tests/test_utils_numpy_stats.py +126 -0
  386. torchregress-0.3.0/tests/test_utils_ordinal.py +158 -0
  387. torchregress-0.3.0/tests/test_utils_propensity.py +20 -0
  388. torchregress-0.3.0/tests/test_utils_pytorch_compat.py +61 -0
  389. torchregress-0.3.0/tests/test_utils_quantile.py +219 -0
  390. torchregress-0.3.0/tests/test_utils_semisupervised.py +34 -0
  391. torchregress-0.3.0/tests/test_utils_tensor_ops.py +96 -0
  392. torchregress-0.3.0/tests/test_utils_transform.py +32 -0
  393. torchregress-0.3.0/tests/test_utils_validation.py +161 -0
  394. torchregress-0.3.0/tests/test_viz.py +366 -0
  395. torchregress-0.3.0/tests/test_viz_extended.py +218 -0
  396. torchregress-0.3.0/tests/test_viz_intervals.py +91 -0
  397. torchregress-0.3.0/tests/test_viz_monitoring.py +118 -0
  398. torchregress-0.3.0/tests/test_viz_results.py +853 -0
  399. torchregress-0.3.0/tests/test_viz_utils.py +200 -0
  400. torchregress-0.3.0/tests/utils/test_augment.py +184 -0
  401. torchregress-0.3.0/tests/utils/test_bspline.py +185 -0
  402. torchregress-0.3.0/tests/utils/test_check_pin_rollout_drift.py +263 -0
  403. torchregress-0.3.0/tests/utils/test_check_test_fixture_pin_discipline.py +302 -0
  404. torchregress-0.3.0/tests/utils/test_reduction.py +82 -0
  405. torchregress-0.3.0/tests/utils/test_tensor_ops.py +507 -0
  406. torchregress-0.3.0/tests/viz/test_figure_lifecycle.py +301 -0
  407. torchregress-0.3.0/tests/viz/test_monitoring.py +613 -0
@@ -0,0 +1,619 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.3.0] - 2026-11-04
11
+
12
+ Bug fixes, performance of existing code, docs, and harness parity on top of the
13
+ 0.3.0b1 API cut. Three method families landed after the beta and ship in 0.3.0
14
+ (see *Added*).
15
+
16
+ ### Added
17
+
18
+ - Multi-source regression: `MarginalizedMultiSourceGaussianNLLLoss` and
19
+ `PackedObservations` (joint NLL over all noisy measurements of one shared
20
+ Gaussian latent, linearized observation maps, full measurement covariance,
21
+ masked missing dimensions), `RobustMultiSourceGaussianNLLLoss`, and
22
+ `GaussianLatentForwardObservationNLLLoss` (quadrature through a nonlinear
23
+ forward map). Calibration heads `CommonScaleSplineHead`,
24
+ `RelativeSurveySplineHead`, `ConditionBiasHead` and
25
+ `bspline_basis_with_derivative`. Docs: `docs/losses/multisource.md`.
26
+ - `torchregress.models.GaussianCopulaSplineHead`: a conditional joint spline
27
+ flow (full-covariance Gaussian followed by per-coordinate monotone
28
+ rational-quadratic splines) with exact marginalization of missing
29
+ coordinates. Requires the `flows` extra.
30
+ - `PoissonGaussianLoss` (registry key `"poisson_gaussian"`): NLL of Poisson shot
31
+ noise convolved with Gaussian read noise, `y = g K + b + eps`, with fixed or
32
+ learnable gain, offset and read-noise variance. Finite support with
33
+ `tail_sigma` and renormalisation, an observation-conditioned window for
34
+ outliers, chunked evaluation and analytic gradients (ported from torchsky).
35
+ Docs: `docs/losses/poisson_gaussian.md`.
36
+
37
+ ### Changed
38
+
39
+ - Performance: `GaussianCopulaSplineHead.intrinsic_log_prob` and `observed_log_prob`
40
+ no longer loop in Python over distinct missingness patterns. The exact observed-subvector
41
+ Gaussian marginal is computed for the whole batch with one batched Cholesky of
42
+ `diag(m) L Lᵀ diag(m) + diag(1 - m)`; fully observed batches use the predicted Cholesky
43
+ factor `L` directly (no `L Lᵀ` re-factorisation). Input checks are read back in one
44
+ device-to-host copy. Results and gradients match the per-pattern implementation to
45
+ float64 round-off. CPU, batch 2048, forward+backward: D=12 with random missingness
46
+ (≈1090 patterns) 1.43 → 0.07 s/step; D=6 0.09 → 0.04 s/step.
47
+
48
+ - Performance: `MarginalizedMultiSourceGaussianNLLLoss` and
49
+ `RobustMultiSourceGaussianNLLLoss` now score all objects as one padded batch.
50
+ They use batched Cholesky and triangular solves, so there is no per-object
51
+ Python loop and no per-object host synchronization. Unobserved slots are
52
+ decoupled unit-variance coordinates with zero residual and zero Jacobian, so
53
+ they contribute nothing. The robust mixture scores each inlier/outlier
54
+ assignment for the whole batch and takes a batched `logsumexp`. Values and
55
+ gradients match the previous object-by-object code (float64: values within
56
+ 2e-15 relative, gradients within 1e-11 relative). On CPU with float64,
57
+ 50k objects, 12 slots and D=3, forward plus backward runs at about 1.6e5
58
+ objects/s, up from 1.0e3 (`auto`). The robust variant runs at 1.7e4
59
+ objects/s, up from 70. Inputs are validated once per batch. If a batch has
60
+ several different errors, the first failing check type is reported. Checks
61
+ are no longer reported per object. `last_diagnostics` is now a read-only
62
+ mapping that is copied to Python lists only when it is read. Timing script:
63
+ `python -m tools.benchmark_multisource`.
64
+
65
+ - Performance: `SkewTLoss` / `skew_t_nll` no longer synchronise with the host
66
+ on accelerators. The Student-t CDF in the skew-t density evaluated its
67
+ incomplete-beta continued fraction with an early-exit Lentz loop that read a
68
+ convergence flag back to the host every term (on CUDA ~1,500 kernel launches
69
+ and ~17 device-to-host reads per training step, and no CUDA-graph capture).
70
+ Off the CPU the same continued fraction is now evaluated at a fixed depth
71
+ (63 Lentz iterations; the early-exit loop never needs more than ~70 for
72
+ dof ≤ 1e10) as a binary-tree product of its 2×2 recurrence matrices, with no
73
+ value-dependent control flow, so training steps can be captured and
74
+ replayed as CUDA graphs. The CPU keeps the early-exit loop (faster there,
75
+ unchanged numerics). Values and gradients match the early-exit evaluation
76
+ to float64 round-off (≤1e-12 relative for dof ≤ 1e3) and scipy's
77
+ `t.logcdf` to 1e-10 relative over dof 1+1e-6 … 1e3. H100 MIG 1g.12gb, MLP +
78
+ `SkewTLoss` Adam step, batch 4096: 42.8 ms eager → 31.4 ms eager, 2.2 ms
79
+ as a CUDA graph (batch 1024: 34.4 → 28.8 / 1.4 ms). Timing script:
80
+ `python tools/benchmark_skew_t.py --device cuda`.
81
+ - Renamed `PoissonGaussianMixtureLoss` to `PoissonGaussianContaminationMixtureLoss`
82
+ (registry key `"poisson_gaussian_contamination_mixture"`) and
83
+ `EnhancedPoissonGaussianMixtureLoss` to
84
+ `EnhancedPoissonGaussianContaminationMixtureLoss`
85
+ (`"enhanced_poisson_gaussian_contamination_mixture"`), with matching config
86
+ dataclasses (`PoissonGaussianContaminationMixtureConfig`,
87
+ `EnhancedPoissonGaussianContaminationMixtureConfig`). They compute
88
+ `w*Pois + (1-w)*N` with a shared rate, not the detector convolution
89
+ (`PoissonGaussianLoss`). Behaviour is unchanged. The example is now
90
+ `examples/poisson_gaussian_contamination_mixture_demo.py`.
91
+ `PoissonGaussianLikelihoodRatioLoss` is unchanged: it is not a mixture.
92
+ - Examples: each synthetic / real-data pair is one script with
93
+ `--dataset {synthetic,diabetes}` (causal, censored, EIV, multimodal,
94
+ noisy-label, OOD selective prediction, ordinal, uncertain ground truth); the
95
+ `*_realdata_comparison.py` files are gone. Overlapping demos are one script per
96
+ topic: `loss_comparison.py --suite`, `conformal_regression_example.py --mode`,
97
+ `contrastive_flow_parameter_estimation.py --mode`, `count_regression_demo.py
98
+ --family` (replaces the Poisson and Tweedie demos),
99
+ `test_time_bayesian_linear_head_demo.py --mode`,
100
+ `gaussian_wasserstein_bound_demo.py --mode`. Summary JSON values are unchanged.
101
+ - The `external_comparison_*` examples (MAPIE, crepes, torchcp, BoTorch,
102
+ scikit-learn) moved to torchregress-harness suites, and
103
+ `examples/benchmarks/self_agreement_higgs_ood.py` to torchregress-research.
104
+ - Density-conformal calibration and prediction stream over rows, so peak memory
105
+ no longer grows with the split size (1M+ rows on CPU or GPU):
106
+ - `ConformalizedDensity` / `ContrastiveFlowConformal` evaluate the density in
107
+ chunks of at most `chunk_size` (new keyword-only argument, default 131072)
108
+ `(context, y)` pairs in `calibrate`, `calibrate_log_prob` and `contains`.
109
+ Scalar `predict_interval` evaluates `chunk_size // grid_size` contexts per
110
+ density call instead of one Python iteration per row (about 8x faster on
111
+ 2000 rows with a small NSF on CPU). Results are identical for row-wise
112
+ densities.
113
+ - `WaldoDensityConformal` calls `sample_fn` on row chunks (new keyword-only
114
+ `chunk_size`, default `2**20 // n_samples` rows) and computes moments and
115
+ Wald scores per chunk. A split that fits in one chunk gives bit-identical
116
+ results for a fixed seed; with several chunks a sampler that draws one
117
+ `[S, N, D]` noise block consumes the generator in a different order, so
118
+ thresholds differ by Monte Carlo error only (same score distribution).
119
+ - `WaldoPosteriorCalibrator` computes sample moments and scores per row chunk
120
+ (new keyword-only `chunk_size`), without a second `[N, S, D]` temporary.
121
+ Results are unchanged.
122
+ - `WaldoConformal.predict_interval` is vectorised over rows (shared grid and
123
+ critical values, no per-row Python loop or host sync; about 100x faster on
124
+ 20000 rows) and `WaldoConformal.predict_region` processes rows in bounded
125
+ chunks. Outputs are unchanged.
126
+ - The grid level-set search shared by `CTI`, `SLSConformal` and
127
+ `ConformalizedDensity` no longer synchronises with the device.
128
+ - `tools/benchmark_conformal_streaming.py` times these paths at realistic
129
+ sizes (`--device cuda` for GPU).
130
+ - Performance: `crps_from_binned_cdf` is computed in closed form for all rows
131
+ and bins at once (target clipped to each bin, float64, row chunks of bounded
132
+ memory) instead of a Python loop over rows and bins, on the device of the
133
+ first tensor argument. Return types are unchanged (float for `mean`/`sum`,
134
+ NumPy array for `none`). Agrees with the loop to 2e-15; 1e5 rows x 64 bins on
135
+ CPU: 119 s -> 0.11 s (1e6 rows: 1.2 s).
136
+ - Memory: `neighbour_target_gap`, `target_ordering`, `frozen_readout_metrics`
137
+ and `representation_geometry_report` no longer build N x N (or N_test x
138
+ N_train) distance matrices: k-NN and pair distances are computed in row
139
+ chunks (O(chunk * N) memory) on the input's device, and tensors with
140
+ `requires_grad` are accepted. `target_ordering` keeps its rule (all pairs
141
+ when N(N-1)/2 <= `max_pairs`, else `max_pairs` seeded random pairs) and gives
142
+ bit-identical values. N = 1e5, D = 16 now runs on CPU in about 25 s; before,
143
+ the gap alone needed an 80 GB distance matrix.
144
+ - `FTTransformer` (and `AutoregressiveTimeLayer`) build their `norm_first`
145
+ encoders with `enable_nested_tensor=False`, which silences the PyTorch
146
+ warning on every construction. Behaviour is unchanged.
147
+
148
+ ### Fixed
149
+
150
+ - `VIRRegressor` training is stable again across seeds, platforms and torch
151
+ versions. The `kl_weight` latent regulariser averaged
152
+ `KL(q(z|x) || N(0, I))` over the latent dimensions instead of summing them,
153
+ so it was `latent_dim` times weaker than documented. Without a scale anchor,
154
+ the label-smoothing recolouring let the encoder expand the latent scale every
155
+ epoch (latent and gradient norms grew roughly 100x). Late epochs then became
156
+ chaotic and tail error regressed on some seeds, for example in the pip/torch
157
+ 2.15 CI job. The KL is now summed over latent dimensions and averaged over
158
+ the batch; the default weight is unchanged.
159
+ - `create_flow_model(flow_type="maf")` and the affine-coupling types
160
+ (`"realnvp"`/`"cinn"`/`"nice"`) no longer produce exploding samples. A far-tail
161
+ base draw could give an out-of-range coordinate; the ReLU conditioner then
162
+ extrapolated to a huge shift and a saturated tiny scale (zuko's affine layer
163
+ allows `|log s| < 6.9`, a 1000x stretch per layer), and the inverse pass
164
+ cascaded geometrically over coordinates and layers. On
165
+ `synthetic_multitarget_big` (density_parity, seed 1, GPU) the MAF had a sound
166
+ NLL (0.957) but finite samples up to 2.4e12 and CRPS 1.3e4; all three seeds
167
+ showed the same tail on larger draws, and so does zuko's MAF used through sbi.
168
+ The affine flows keep zuko's layout and state-dict keys but bound each layer's
169
+ log-scale softly by 3 (`slope=exp(-3)`, overridable with `slope=`) and feed the
170
+ conditioners `x / sqrt(1 + (x / B)^2)` with `B = 10` (standardized units;
171
+ `bound=` sets `B`). Both directions use the same conditioner, so the flows
172
+ remain exact bijections with exact `log_prob`. **Outputs change**: newly
173
+ trained MAF/RealNVP/cINN flows differ, and existing checkpoints load unchanged
174
+ but evaluate under the new layers (pass `slope=1e-3` and a very large `bound`
175
+ to reproduce the old map). `bound` is now accepted for `"maf"` and the
176
+ affine-coupling types as the conditioner clip half-width.
177
+ - Sampling a normalizing flow (`NormalizingFlowLoss.sample` and everything built on it:
178
+ `ContrastiveFlowLoss`, `quantile`/`cdf`, WALDO sample functions) and the spline
179
+ inverse of `GaussianCopulaSplineHead.intrinsic_log_prob` / `observed_log_prob` no
180
+ longer strand tensors in reference cycles. torch's `Transform.inv` caches its
181
+ inverse with a strong reference, so every zuko inverse pass left a
182
+ `transform <-> inverse` cycle holding its spline parameters (about 11 KiB per
183
+ 6-D NSF draw) until Python's object-count-driven GC ran; on CUDA chunked
184
+ sampling of a few hundred thousand draws ran an 11 GiB device out of memory.
185
+ The young generation is now collected after each call; results are unchanged.
186
+ - Medians follow the textbook (NumPy/SciPy) convention, averaging the two
187
+ middle values for even counts, instead of `torch.median`'s lower middle value:
188
+ `neighbour_target_gap`, the `*_NMAD` entries of `frozen_readout_metrics`,
189
+ `calculate_mad` (and so `reweight_fixed_predictions(variance_type="robust")`),
190
+ the masked `scale="mad"` estimate of `iteratively_reweighted_fit`, the
191
+ `VarianceTemperatureScaler` `clip` centre/MAD and variance median,
192
+ `BalancedMSEBMC`'s robust scale and fitted median, `RepresentationShiftInflator`'s
193
+ reference scale, the median-heuristic bandwidths of `random_fourier_features`
194
+ and the test-time Bayesian head, and the MC-sample centre in `conformal.py`.
195
+ Results move slightly for even-sized inputs.
196
+ `neighbour_target_gap`'s docstring now says what it computes: the median over
197
+ points of the mean absolute target difference to the k nearest neighbours.
198
+ - MAD-to-sigma consistency constant is `1 / Phi^-1(0.75) = 1.482602218505602`
199
+ instead of the rounded `1.4826` everywhere (`MedianAbsoluteDeviation`,
200
+ `median_absolute_deviation`, `NormalizedMedianAbsoluteDeviation`, representation
201
+ `nmad` and readout NMAD, IRLS robust scales, `BalancedMSEBMC` robust scale,
202
+ `VarianceTemperatureScaler` `clip`).
203
+ - `PoissonGaussianMixtureLoss` and `EnhancedPoissonGaussianMixtureLoss` docs
204
+ and docstrings described the shot-plus-read-noise convolution and cited
205
+ Seifert et al. (2023), which uses it. They compute a two-component mixture;
206
+ the docs now say so, report its low-count bias, and point to
207
+ `PoissonGaussianLoss`. Behaviour is unchanged.
208
+ - Examples whose real-data track never seeded the global RNG (censored, uncertain
209
+ ground truth) now do, so their Diabetes results are reproducible.
210
+ - `WaldoConformal` (and `WaldoPosteriorCalibrator` / `WaldoDensityConformal`,
211
+ which use it) set the Wald threshold with an interpolated `torch.quantile`
212
+ instead of the finite-sample order statistic `ceil((n+1)(1-alpha))`, so
213
+ regions under-covered (0.882 vs 0.90 nominal at n=50 over 2000 repeats; now
214
+ 0.9075). Global, per-bin and `WaldoCriticalValueRegressor` thresholds all use
215
+ `finite_sample_quantile`. A bin with too few points for `alpha` has an
216
+ infinite threshold, and the interpolated critical value next to it is `+inf`
217
+ instead of `nan`. Found by the torchregress-harness multivariate rows.
218
+ - `probability_integral_transform(return_histogram=True)` raised on CUDA tensors
219
+ (`torch.histogram` has no CUDA kernel); it now bins with bucketize/bincount
220
+ under the same convention.
221
+ - `ConformalLoss` no longer swallows unknown keyword arguments (including the
222
+ removed `debias`). Docs and tests that still advertised the no-op are gone.
223
+ - Removed the thin `PredictiveBatch.from_density` / `from_samples` constructors
224
+ (use the dataclass fields directly).
225
+ - Removed the identity factory `create_mdn_loss` (use `MixtureDensityLoss`).
226
+ - `WaldoDensityConformal` and `WaldoPosteriorCalibrator` with
227
+ `covariance_type="diagonal"` raised a shape error for multi-target samples
228
+ (they passed the full sample covariance). They now use the per-target sample
229
+ variances.
230
+ - `GaussianLatentForwardObservationNLLLoss` placed its Gauss–Hermite nodes on
231
+ the latent prior, so it was badly wrong when the observation noise is narrow
232
+ relative to the latent spread pushed through the map, even for a linear map
233
+ (harness repro: -0.30, +0.47, -0.10 nats at Q=64, 128, 256; up to hundreds of
234
+ nats on synthetic SNR 7-50 fluxes at Q=32). It now uses adaptive
235
+ Gauss–Hermite quadrature: a fixed number of derivative-free bracketing and
236
+ parabolic passes on `[N,Q]` node grids centre and scale the rule on the
237
+ integrand's peak. The centre and scale are a stop-gradient change of
238
+ variables, there are no host syncs, and it runs under `torch.inference_mode`.
239
+ The rule is exact for linear maps at any order of 3 or more, and the
240
+ synthetic flux grid's maximum error at Q=32 drops to 2e-7 nats. The map is
241
+ now called several times per forward (once per pass without autograd), so it
242
+ must be deterministic and side-effect free. Forward cost at equal order is
243
+ about 2.5-5x on CPU, but Q=16 now beats the old Q=256. The quadrature
244
+ constants are no longer float64 buffers: they are converted to the input
245
+ device and dtype at use, so `.to("mps")` works. They no longer appear in
246
+ `state_dict()`.
247
+
248
+ ## [0.3.0b1] - 2026-10-26
249
+
250
+ API cut. One public name per behavior.
251
+
252
+ ### Removed
253
+
254
+ - Compatibility aliases: `MDNLoss` (use `MixtureDensityLoss`), `ExpectileCrossover`, `QuantileCrossover`, `AsymmetricLeastSquaresLoss`, `CORALLoss` (use `CumulativeLinkLoss`; `CORALHead` is unchanged), `JackknifePlus` (use `CVPlus`; leave-one-out is `K = n`), `SelfAgreementTrainer` (use `TeacherStudentTrainer`), `iteratively_reweighted_least_squares` (use `reweight_fixed_predictions` or `iteratively_reweighted_fit`), `RepresentationShiftCalibrator`, `SignificantSubspaceAligner`, `prediction_interval_coverage`, `MeanIntervalWidth`.
255
+ - Torchmetrics re-exports and the calibration-metric re-exports from `torchregress.metrics`. Calibration metrics are `torchregress.calibration` only.
256
+ - The ignored `debias` argument on `CQR`, `UACQR`, and `ConformalLoss`.
257
+ - `utils.quantile.quantile_loss` is `pinball_residual`. `fetch_openml_regression_with_sklearn_fallback` is `fetch_openml_regression`.
258
+ - Registry keys `"als"` and `"coral"`.
259
+
260
+ ### Added
261
+ - True noise-adaptive Balanced MSE (`BalancedMSEBMC`, `balanced_mse_bmc_loss`;
262
+ Ren et al., CVPR 2022) with fitted label prior and target-noise scale; this is
263
+ distinct from the historical inverse-bin-frequency `BalancedMSELoss`.
264
+ - RankSim ranking-similarity regularizer (`RankSimLoss`, `rank_sim_regularizer`;
265
+ Gong et al., ICML 2022) for representation-level imbalanced regression, with
266
+ a blackbox-interpolation gradient and composition with task losses.
267
+ - Variational Imbalanced Regression (`VIRLoss`, `VIRRegressor`) for long-tailed
268
+ regression with evidential (Normal-Inverse-Gamma) uncertainty: label-similarity
269
+ latent smoothing, smoothed label-density reweighting, evidential regularisation,
270
+ and `predict(return_std=True)`. Docs: `docs/methods/algorithms/vir.md`.
271
+ - Corrected the historical `BalancedMSELoss` documentation: it implements inverse
272
+ bin-frequency weighting, not Ren et al.'s noise-adaptive Balanced MSE (BMC);
273
+ the misleading citation was removed and the distinction is documented.
274
+ - Contrastive likelihood-ratio / neural-ratio-estimation tooling (2026-10-17):
275
+ - `losses.NeuralRatioLoss` (+ `build_ratio_classifier`, `neural_ratio_logits`,
276
+ `neural_ratio_loss`): classifier-based neural ratio estimation with balanced binary
277
+ (NRE-A) and multiclass (NRE-B/InfoNCE-style) criteria, paired or mismatched negatives,
278
+ and flow-loss-style shape/ambiguity validation. The logit estimates
279
+ `log p(x|theta) - log p(x)`, so grid-argmax is the MLE and the training prior cancels
280
+ under a prior-sampled reference. Docs: `docs/losses/nre.md`.
281
+ - `inference.posterior_log_weights`, `effective_sample_size`, `grid_log_posterior`,
282
+ `maximum_likelihood_estimate`: finite-bank likelihood-ratio/posterior reweighting,
283
+ Kish ESS diagnostics, and MLE/MAP point estimates with documented prior/proposal
284
+ corrections. Docs: `docs/api/inference.md`, `docs/methods/inference.md`.
285
+ - `metrics.simulation_based_calibration_ranks`, `sbc_rank_histogram`,
286
+ `sbc_uniformity_pvalue`, `tarp_coverage`: simulation-based calibration and TARP
287
+ posterior-coverage diagnostics. Docs: `docs/metrics/calibration.md`,
288
+ `docs/api/metrics.md`.
289
+ - `ContrastiveFlowLoss`: documented `temperature=1, margin=0` likelihood-ratio regime with
290
+ a `likelihood_ratio_mode` property, chunked negative evaluation, and target-shape
291
+ validation; the flow guide now frames it correctly as InfoNCE/multiclass NRE and
292
+ distinguishes it from the Elsharkawy-Kahn contrastive-normalizing-flow method.
293
+ - The contrastive-flow comparison example now also trains classifier NRE and an NPE-style
294
+ posterior flow, and reports SBC/TARP diagnostics next to point accuracy and runtime.
295
+ - **Post-freeze method additions (user-requested audit, 2026-10-17; targeted at 0.4.0):**
296
+ - `algorithms.ForwardInversionRegressor` (+ `build_decoder_mlp`): generative `y -> x`
297
+ surrogate (statistical inverse regression / auto-decoder construction) trained with
298
+ known per-observable errors and inverted per object by maximum likelihood (damped
299
+ Gauss–Newton or L-BFGS) with Fisher covariance `(J^T Sigma_x^{-1} J)^{-1}`; removes
300
+ input attenuation and inverse-regression prior bias. Training supports the full
301
+ heteroscedastic Gaussian likelihood (default), a robust Student-t likelihood
302
+ (`likelihood="student_t"`) and fixed-weight heteroskedastic least squares
303
+ (`likelihood="wls"`). `predict(..., return_info=True)` returns per-object stationarity
304
+ and Fisher-condition diagnostics for the local, non-convex test-time inversion, and the
305
+ guide documents when a discriminative model is the better choice. Docs:
306
+ `docs/methods/algorithms/forward_inversion.md`.
307
+ - `losses.SplitMeasurementLoss` / `split_measurement_loss` and
308
+ `losses.CorrectedScoreEIVLoss` / `corrected_score_eiv_loss`: paired-exposure
309
+ cross-product loss (no noise model required) and the Stefanski–Nakamura corrected
310
+ score (subtracts the measurement-error curvature instead of adding a TLS gradient
311
+ penalty). Docs: `docs/losses/split_eiv.md`.
312
+ - `losses.PrimeLoss` and `losses.ConR` (+ `conr_loss`, `uniform_proxy_targets`):
313
+ representation-level imbalanced-regression losses (PRIME proxies with uniformly
314
+ spaced targets; ConR contrastive collapse penalty). Feature Distribution Smoothing
315
+ already existed (`losses.FeatureDistributionSmoother`) and is cross-linked, not
316
+ duplicated. Docs: `docs/losses/prime_conr.md`.
317
+ - `algorithms.ContinuousGroupDRO` and `algorithms.GroupDROTrainer`: exponentiated-gradient
318
+ worst-target-regime training over continuous target bins (equalizes per-regime mean
319
+ loss, unlike CVaR's worst individual samples). Docs: `docs/methods/algorithms/group_dro.md`.
320
+ - `calibration.VarianceRestoringCalibrator`: marginal de-shrinkage by moment matching or
321
+ 1-D optimal transport, with `describe()` diagnostics; documented as marginal (not
322
+ conditional) calibration. Docs: `docs/methods/calibration.md`.
323
+ - `method_catalog` metadata, `docs/api/*`, loss-guide indexes and site navigation updated
324
+ for all of the above.
325
+ - `MixtureDensityLoss.sample` supports `covariance_type="full"` (draws `mu + L eps` from the selected component's covariance Cholesky factor); previously only diagonal mixtures could be sampled.
326
+ - `inference.random_fourier_features` and `inference.median_heuristic_bandwidth`: random Fourier feature nuisance basis for `orthogonal_partially_linear` with a median-heuristic bandwidth (median pairwise distance of the standardised `z` on a seeded subsample), per-covariate polynomial terms (`polynomial_degree`, default 3: across five confounding designs it keeps 95% coverage within 0.90-0.95, where degree 1 drops to 0.78 on cubic confounding) and a seeded draw. `orthogonal_partially_linear(ridge="gcv" | "loo")` picks the nuisance ridge penalty per nuisance and training fold by generalized cross-validation or exact leave-one-out error (closed form from one SVD, unpenalised intercept); a float `ridge` (default `1e-6`) behaves exactly as before. Over 200 replications at n = 500 the old harness recipe (unit-bandwidth RFF, `ridge=1e-2`, no linear part) gave Coverage95 0.785 / bias +0.008 on CCDDHNR-2018 and 0.820 / +0.060 on the cubic design; the new defaults give 0.955 / +0.004 and 0.900 / +0.016, and `polynomial_degree=3` gives 0.945 / -0.002 on the cubic design (plan item B5).
327
+ - `losses.create_flow_model(bound=...)` sets the NSF spline tail bound (zuko fixes it at 5), and `losses.recommended_tail_bound(y_standardised)` derives it from the training target (data range with 25% head-room, clipped to [5, 25]). `NormalizingFlowLoss`'s out-of-range warning reports the actual bound. New "Training recipe for NLL and calibration" section in `docs/losses/nflows.md` (validation early stopping, derived bound, 16 bins): test NLL 1.272 -> 1.201 (skewed), 1.935 -> 1.852 (Student-t 3 df), 6.144 -> 5.417 (`load_diabetes`) with equal or better 90% interval scores, versus the fixed 60-epoch recipe of the harness `pzflow_parity` row (plan item B4). Library defaults (`bins=8`, bound 5) are unchanged.
328
+ - `test_time.select_high_confidence(scores=...)`: optional per-row ranking score (default: maximum probability).
329
+ - `torchregress.models`: `TabularMLP` (periodic numeric embeddings, SiLU blocks, dropout), `TabularPreprocessor` (median/IQR scaling, smooth clipping, NaN imputation with missing indicators), `fit_tabular` / `fit_tabular_ensemble` (AdamW, one-cycle schedule, early stopping with restore-best-weights, target standardisation) and `TabularFit`. Works with any loss, including `GaussianNLLLoss` (`2 * D` outputs) and `MultiQuantileLoss`. Docs: `docs/methods/tabular_mlp.md`, `docs/api/models.md`. `models` is a new lazy top-level submodule (plan item B2).
330
+ - `torchregress.estimators` (experimental, may change in 0.4): model-agnostic UQ wrappers. `ConformalRegressor(base, method="split" | "normalized" | "cqr" | "cv+" | "jackknife+", alpha, n_folds, prefit)` with `fit` / `predict` / `predict_interval(X, alpha, test_weights)` puts `SplitConformal`, `CQR` or `CVPlus` intervals on any scikit-learn or LightGBM model, a quantile pair/triple, a torch module with a training callable, or a fitted `TabularFit`; NumPy in gives NumPy out and tensors give tensors. `CalibratedRegressor(base, method="vts" | "isotonic+vts")` fits `VarianceTemperatureScaler` (and `IsotonicMeanCalibrator`) on a held-out split of any Gaussian-output base and offers `predict_dist` / `predict_interval`, optionally with conformal widths. Tests check parity with direct use of the conformal classes and with MAPIE `SplitConformalRegressor` / `ConformalizedQuantileRegressor` (prefit) to 1e-6. Docs: `docs/methods/estimators.md`, `docs/api/estimators.md`. `estimators` is a new lazy top-level submodule (plan item B1).
331
+ - `estimators.calibrated_deep_ensemble(X, y, n_members, val_fraction, loss, alpha, conformal, seed, **fit_kwargs)`: Gaussian `TabularMLP` ensemble via `fit_tabular_ensemble` with mixture moments (mean member variance plus variance of member means), a variance temperature fitted on a held-out carve and optional normalized split-conformal intervals; returns a `CalibratedRegressor` (plan item B3). Experimental, may change in 0.4.
332
+
333
+ - Examples for the 0.3.0 APIs: `tabular_mlp_tutorial.py` (`TabularMLP`, `fit_tabular`, `TabularPreprocessor` with NaNs), `calibrated_regressor_comparison.py` (`CalibratedRegressor`, `calibrated_deep_ensemble`, `ConformalRegressor`), `nsf_tail_bound_comparison.py` (`recommended_tail_bound` vs the fixed NSF bound on Student-t noise) and `orthogonal_inference_rff_demo.py` (random Fourier nuisances, median bandwidth, `ridge="gcv"`), each under 15 s on 2 CPU cores and smoke-tested.
334
+
335
+ ### Changed
336
+
337
+ - Declared public (added to `__all__`; they were already importable):
338
+ `CQR`, `CTI`, `MultivariateScoreConformal`,
339
+ `NonExchangeableConformalRegressor` and `BaseEIVLoss` in
340
+ `torchregress.losses`, and `SelfAgreementTrainer` (alias of
341
+ `TeacherStudentTrainer`) in `torchregress.semi_supervised`. Listed in
342
+ `docs/api/losses.md`, `docs/api/conformal.md` and
343
+ `docs/api/semi_supervised.md`.
344
+ - `MixtureDensityLoss(covariance_type="full")` now reads its lower-triangular
345
+ factor as the Cholesky factor of the **precision** (`full_parameterization="precision"`,
346
+ new default, as in sbi's MDN): the log-density is linear in the factor, with no
347
+ triangular solve. The covariance form (`full_parameterization="covariance"`, the
348
+ previous behaviour) did not fit multi-target data: on the 16-target scm20d
349
+ benchmark, train / test NLL 0.42 / 3.32 vs -3.45 / 0.31 with the precision form
350
+ (sbi's MDN: 0.04). The output layout is unchanged. `predict_mean_std` and
351
+ `predict_interval` now support full covariance (per-dimension marginals).
352
+ The precision form is not better everywhere: in harness run #6
353
+ (`density_parity`, test NLL) it improves mt_scm20d 3.11 → 0.33 and mt_jura
354
+ 2.53 → 1.95 but is worse on the 2-target energy_efficiency (-1.32 → -0.76)
355
+ and mt_enb (-1.18 → -0.85). `docs/losses/mdn.md` now explains both
356
+ parameterisations, recommends comparing `full_parameterization="covariance"`
357
+ on validation NLL for low-dimensional targets, and warns that the extracted
358
+ precision factor `T` is not a covariance square root (use `.sample()`).
359
+
360
+ - `quantiles_to_density_grid` (and `PredictiveBatch.with_density` for quantile
361
+ batches) keeps the tail mass: `tau_0` below the first quantile and
362
+ `1 - tau_K` above the last are spread uniformly over the grid margins
363
+ instead of being dropped and renormalised. The grid CDF now equals `tau_k`
364
+ at every knot; for levels 0.05/0.95 a 90% interval read off the grid covers
365
+ 0.900 of Gaussian draws instead of 0.854 (PRD-001; supersedes TR-COR-02).
366
+ - `docs/losses/sls.md`: new section measuring the width of SLS bounding-box intervals against `GaussianNLL` / `MultivariateGaussian` on the three harness multivariate designs (plan item B7). The 1.2-1.3x width gap at nominal level shrinks to 1.04-1.11x at equal joint coverage; raw `SLSLoss` thresholds cover only 0.45-0.56 of held-out targets (0.91 in-sample), so the coverage guarantee needs `SLSConformal`. No library default changed: warmup, window, flow size and boundary-sample count do not reduce width at equal coverage on all designs.
367
+ - 28 plumbing helpers are no longer re-exported from `torchregress.utils` (and
368
+ dropped from its `__all__`); they remain importable from their submodules, for
369
+ example `from torchregress.utils.tensor_ops import convert_to_tensor`.
370
+ `distributions`: `normal_cdf`. `gaussian_output`: `parse_heteroscedastic_output`,
371
+ `low_rank_output_dim`, `split_low_rank_gaussian_output`. `numpy_stats`:
372
+ `subsample_rows`, `winsorize`. `ordinal`: `labels_to_levels`,
373
+ `normalize_class_probs`, `class_probs_to_levels`. `pytorch_compat`: `get_device`.
374
+ `quantile`: `quantile_loss`, `multi_quantile_loss`. `tensor_ops`: `apply_mask`,
375
+ `convert_to_tensor`, `ensure_batch_dim`, `prepare_cross_covariance`,
376
+ `prepare_model_input_for_gradients`, `compute_model_gradients`,
377
+ `calculate_gaussian_nll`, `calculate_propagated_variance`. `validation`:
378
+ `validate_reduction`, `validate_range`, `validate_quantile`, `validate_weights`,
379
+ `validate_metric_inputs`, `validate_sample_weight`, `check_tensor`. `security`:
380
+ `validate_url`. `parse_heteroscedastic_output`, `low_rank_output_dim` and
381
+ `split_low_rank_gaussian_output` stay public in `torchregress.ensemble` /
382
+ `torchregress.losses`.
383
+ - Dependency floors raised to the newest releases resolvable from conda-forge:
384
+ `torch>=2.13`, `numpy>=2.5`, `scipy>=1.18`, `torchmetrics>=1.9`; extras
385
+ `matplotlib>=3.11`, `zuko>=1.6`, `scikit-learn>=1.9`, `pandas>=3.0`,
386
+ `polars>=1.43`, `pyarrow>=25.0`, `pytest>=9.1`. Pre-commit hooks: ruff
387
+ v0.16.10, pre-commit-hooks v6.0.0. Tested on torch 2.14.1 / numpy 2.5.3 /
388
+ scipy 1.18.1 (PyPI) and the pixi lock (conda-forge torch 2.13.0).
389
+
390
+ ### Removed
391
+ - The `torchregress.metrics.calibration` shim module. Its 7 names
392
+ (`ExpectedCalibrationError`, `MarginalCalibrationError`, `bias`,
393
+ `calibration_metrics_report`, `calibration_score`,
394
+ `expected_calibration_error`, `marginal_calibration_error`) stay exported
395
+ from both `torchregress.metrics` and `torchregress.calibration`: replace
396
+ `from torchregress.metrics.calibration import X` with
397
+ `from torchregress.metrics import X` or `from torchregress.calibration import X`
398
+ (the implementation lives in `torchregress.calibration.metrics`).
399
+
400
+ ### Fixed
401
+ - `InverseGaussianLoss` and `GammaLoss` (and `TweedieLoss` with `p >= 2`) now
402
+ raise `ValueError` ("... requires strictly positive targets") when any
403
+ unmasked target is `<= 0`. Both distributions have support `y > 0` and their
404
+ deviances are undefined at `y = 0`; the `eps` guards silently turned a zero
405
+ target into a large finite penalty (about 5e7 per entry for the Inverse
406
+ Gaussian, about 17 for the Gamma at `mu = 1`) that dominated training.
407
+ Masked-out entries are not checked. Targets are not shifted or clipped.
408
+ - `LocalConformal`, `LocalConformalMAD` and `DensityConformal` built dense
409
+ (n_test x n_cal) kernel matrices with several temporaries alive at once, so
410
+ memory grew with the product of the two sizes: at ~2x10^4 x 1.5x10^4 rows the
411
+ harness `conformal/zurich_delays` job was killed by a 32 GB limit. Kernel
412
+ weights and the weighted-quantile search now run in test-row blocks
413
+ (O(n_cal) memory per block); results are identical.
414
+ - `CVPlus` / `JackknifePlus` materialised and fully sorted two
415
+ (n_train x n_test) candidate tensors (CV+ uses every training row); the
416
+ order statistics now come from `torch.kthvalue` over test-row blocks, with
417
+ identical endpoints.
418
+ - `metrics.ood` kernel density scores and `NeighborhoodCovariancePseudoLabeler`
419
+ (which built an (n_query, n_ref, D) difference tensor) now work in query-row
420
+ blocks; results are identical.
421
+ - `algorithms.WarmupMCTrainer` iterated a `DataLoader` over a `TensorDataset`
422
+ (one Python `__getitem__` per row per epoch); it now shuffles and slices on
423
+ the device, as `LatentNN` does.
424
+ - `algorithms.LatentNN` scaled quadratically with the number of rows: the per-row
425
+ latent inputs were one dense `nn.Parameter` under `torch.optim.Adam`, so every
426
+ mini-batch step updated all N x D values and moments (O(N^2 D / B) per epoch;
427
+ 8x the rows took 36x longer, and the harness `folktables_eiv` job with 1.2M rows
428
+ ran for 2.5 days without finishing). Latents now use a lazy, row-sparse Adam
429
+ (only the batch rows' values and moments move, per-row bias correction), batches
430
+ are drawn on the device instead of through a `DataLoader`, and Monte Carlo
431
+ `predict(sigma_x=...)` runs in row chunks. Training is linear in N; full-batch
432
+ training is unchanged (identical to dense Adam). Mini-batch results change:
433
+ rows outside the batch no longer drift on stale momentum.
434
+ - `fit_tabular` / `TabularFit.predict`: `GaussianNLLLoss(log_variance=False)` heads are mapped back to the original scale with a new `"variance"` layout (`var * sigma^2`) instead of being treated as a location output; `standardize_target=False` keeps the Gaussian layout, so `calibrated_deep_ensemble(..., standardize_target=False)` works (audit C2-003, C2-006).
435
+ - `ConformalRegressor`, `CalibratedRegressor` and `calibrated_deep_ensemble` raise `ValueError` for NaN or infinite targets instead of returning NaN intervals or a temperature fitted on a subset (audit C2-004).
436
+ - `TabularPreprocessor`: the smooth clip no longer overflows for huge values (mapped to 0 above 1e154) or turns infinite inputs into NaN (audit C2-002).
437
+ - `inference.median_heuristic_bandwidth` is exact for data far from the origin and rejects non-finite input; `test_time.select_high_confidence(scores=)` ranks NaN scores lowest (audit C2-001, C2-005).
438
+ - `test_time.ShiftFactoredPredictiveTransport`: the confident-row selection (`top_fraction`, default 0.5) now ranks rows on the unrenormalised in-grid peak probability (maximum bin probability times the predictive mass inside the support grid) instead of the renormalised maximum. Renormalisation inflated the peak of predictives cut by the grid edge, so on fine grids the selection favoured them and the EM prior mean overshot a label shift by up to 0.32 |shift| at 256 bins (0.14 at 64); it is now below 0.07 |shift| at 16, 64 and 256 bins for shifts of +/-0.8. Selected rows, and therefore `target_prior` and the adapted predictive, change for a given input (plan item B6).
439
+ - `test_time.ShiftFactoredPredictiveTransport` with a Gaussian predictive: the prior correction is applied to the native mean / std as a moment change (transported minus untransported binned moments, weighted by the row's in-grid predictive mass) instead of returning the moments of the transported grid. Those added the discretisation and the truncation at the grid edge whenever `transport_applied` was true, so a near-identity prior moved the predictive (up to 3.7 sigma for edge rows) and target predictives beyond the source label range collapsed onto the edge bin: on a 2.5 SD label shift the target NLL went from 0.19 (untransported) to 7-4300 depending on `n_support`, now 0.24-0.26 (0.19-0.24 without uncertainty inflation); on a 0.8 SD shift without inflation 0.029 -> 0.046 before, 0.019 now (16 bins). New metadata `prior_mass_outside_source_range` and a `UserWarning` when the raw EM prior puts more than 0.2 of its mass on the support bins outside the source label range (label-shift support violation or unreliable EM). The docs page now warns that the stabilised prior's shrink weight scales as 1/`n_support` (2% of the EM correction at the default 256 bins on a calibrated Gaussian predictive) and that uncertainty inflation widens the predictive under label shift (harness finding 8 follow-up).
440
+ - `inference.orthogonal_partially_linear`: both nuisance regressions (`E[x|z]`, `E[y|z]`) now share one cross-fitting split. Independent splits biased `theta` (-0.026, about 7.7 standard errors, over 200 replications of the DoubleML CCDDHNR-2018 design at n = 500); found by the harness `orthogonal_inference` suite against DoubleML on the same nuisance basis. Point estimates for a given `seed` change.
441
+ - **0.3.0 release audit: 61 defects fixed**, each with a regression test in
442
+ `tests/audit/` (full list with severities: `docs/reports/audit_0.3.0.md`).
443
+ Results that change for existing code:
444
+ - *Conformal prediction.* Thresholds are `+inf` (infinite intervals) when
445
+ `ceil((n+1)(1-alpha)) > n`, per Mondrian group, or when the weighted mass
446
+ cannot reach `1-alpha`; they used to fall back to the largest score and
447
+ under-cover at small `n`. Weighted conformal follows Tibshirani et al.
448
+ (2019): only relative weights matter, the test point defaults to the mean
449
+ calibration weight, and a new `test_weights=` argument gives per-point
450
+ thresholds. CV+/Jackknife+ use the lower rank `floor(alpha (n+1))`.
451
+ `DensityConformal` scores use the density at `y_pred` in both phases.
452
+ Negative Mondrian group ids work; R2C, CTI, DCP and `SLSConformal` honour
453
+ `groups=`. `SemiConformalCalibrator` computes in float64.
454
+ - *Losses.* `EvidentialRegressionLoss` uses the NIG predictive
455
+ (`Omega = 2 beta (1 + nu)`, Amini et al. 2020, Eq. 8). Skew-t NLL values
456
+ change (incomplete-beta bug). Skew-normal, censored/AFT, zero-inflated
457
+ Poisson and GEV are exact in the tails instead of saturating.
458
+ `BetaNLLLoss` and `CVaRLoss` handle 1-D `[B]` inputs. Weighted `'mean'`
459
+ is normalised by the sum of weights in the flow, multi-expectile and
460
+ imbalanced losses (FocalR, BalancedMSE, BinReweightedMSE,
461
+ DensityWeighted, LDS, PropensityWeighted), and `BaseLoss` accepts `[B, D]`
462
+ masks with `[B]` weights. `ExpectileCrossoverLoss` raises on
463
+ non-ascending levels. EIV losses propagate gradients through the
464
+ Jacobian; latent-marginalisation and input-noise losses now marginalise;
465
+ `SLSLoss.forward` no longer mutates state (new `evaluate_frontier`).
466
+ - *Metrics.* `distribution_metrics_report["crps"]` is exact (was 3-4% low).
467
+ Quantile PIT randomises out-of-range targets (seedable `generator=`).
468
+ MedAE/MAD/NMAD use the true median and per-output averaging (sklearn);
469
+ trimmed MSE matches `scipy.stats.trim_mean`. `VarioScore.higher_is_better`
470
+ is `True`. Absolute variance floors and covariance jitter became
471
+ `min_variance=` / relative `jitter=` arguments.
472
+ - *Calibration.* `VarianceTemperatureScaler` has no hidden `[0.05, 20]`
473
+ clamp (`temperature_bounds=` restores it) and returns the closed-form MLE
474
+ by default. `IsotonicMeanCalibrator` is true isotonic regression.
475
+ - *Inference and causal.* `ppi_quantile_ci` inverts the rectified CDF
476
+ (Angelopoulos et al. 2023); the old estimator was inconsistent. PPI and
477
+ DR estimators keep float64; the PPI bootstrap no longer allocates an
478
+ `[n_boot, N]` matrix. DR `fold_bootstrap` standard errors are correct
479
+ (were 0.56x at two folds); trimming every unit raises.
480
+ - *Ensembles.* Predicted variances use the `GaussianNLLLoss` training range
481
+ `[1e-6, e^30]` (was `[e^-8, e^6]`); `predict` runs in eval mode and
482
+ restores the previous modes; `base_seed` leaves the global RNG alone.
483
+ `bars_to_density_grid` puts no mass outside the bin edges.
484
+ - *Semi-supervised.* The documented trust-weight options (`tau`,
485
+ `weight_power`, `hard_weight_threshold`, `batch_relative_mode`,
486
+ `batch_trust_top_k`) take effect; `TeacherStudentTrainer(tau=)` defaults
487
+ to 0.2, the value the code always used. Unknown options raise.
488
+ - `test_time.ShiftFactoredPredictiveTransport.ppi_target_ci` keeps float64 inputs.
489
+ - **Audit batches 4–5** (`algorithms`, `test_time`, `utils`, `prediction`,
490
+ `comparison`, `viz`): 37 more defects fixed (one documented, decision
491
+ pending), tests in `tests/audit/test_audit_batch4.py`
492
+ and `test_audit_batch5.py`.
493
+ - *IRLS* weights are `w(r/sigma)` times the initial precision; they used to
494
+ compound over iterations (`w^n_iter`). `variance_type="robust"` takes the
495
+ MAD over samples (it was zero for `(N, 1)` targets). Concatenated
496
+ `[mean, log_sigma]` outputs work with the default config.
497
+ - *SIMEX* accepts float64, is scale-equivariant (no absolute jitter), and
498
+ `predict` averages independent remeasurements. *Regression calibration*
499
+ honours `posterior(sigma_u=)` and uses relative eigenvalue floors.
500
+ - *Weighted / OT conformal and transport conformal* return infinite
501
+ intervals when the finite-sample guarantee needs them, and the transport
502
+ threshold is the exact order statistic (it was one too high).
503
+ - `DomainClassifierRatioEstimator` corrects for unequal pool sizes;
504
+ `DelayedLabelResidualAdapter` no longer deflates the first batch;
505
+ `IVON.state_dict()` stores the step count; `HeteroscedasticLaplaceRegressor`
506
+ accepts a plain linear head and `n_samples=1`; `BayesianLinearHead`
507
+ honours `generator=`; transport, label-shift and pseudo-label helpers keep
508
+ float64.
509
+ - `comparison.compute_point_metrics` no longer broadcasts `[N, 1]` against
510
+ `[N]` (N×N errors) and averages R² per output (scikit-learn).
511
+ - `masked_mean`/`masked_sum` ignore NaN at masked positions; Box-Cox and
512
+ Yeo-Johnson are accurate for small lambda; `normal_cdf` is accurate in the
513
+ lower tail; validators reject NaN; `quantiles_to_density_grid` sorts
514
+ crossing quantiles (its truncation to `[q_0, q_K]` is now documented);
515
+ numeric-coded nominal OpenML columns load.
516
+ - Viz: residual histogram and QQ plot handle `[N, 1]` predictions, the PIT
517
+ histogram spans [0, 1], the Qini area is finite, RMSCE ignores empty bins,
518
+ `plot_performance_comparison` knows more lower-is-better metrics, and
519
+ plots that create their own figure close it.
520
+ - Found by the harness after the audit (tests in
521
+ `tests/audit/test_audit_postharness.py`):
522
+ - `SkewTLoss` / `skew_t_nll`: the gradient with respect to the skewness was
523
+ exactly zero at `alpha = 0`, so heads initialised there never learned
524
+ skew. The Student-t CDF term is now smooth at 0 and log-space in the
525
+ tails; values are unchanged (match scipy).
526
+ - `ShiftFactoredPredictiveTransport`: the source prior is the mean source
527
+ predictive distribution on the support grid (it was an eps-clamped label
528
+ histogram), and support-grid EM stops on a log-likelihood plateau. EM no
529
+ longer collapses onto empty margin bins (prior TV ~1 with no shift) and
530
+ prior transport is applied under label shift. `estimate_target_prior_em`
531
+ gives classes with no source mass a target prior of 0; new
532
+ `LabelShiftEMConfig.loglik_tol` (default off).
533
+ - Docs: EM label-shift estimation needs calibrated source posteriors (BBSE
534
+ does not).
535
+ - Metrics return float64 for float64 inputs (18 metrics used to return
536
+ float32), and functional metric wrappers move their internal torchmetrics
537
+ state to the input device. Calibration-error histograms no longer use
538
+ `torch.histogram`, which has no CUDA kernel.
539
+ - `import torchregress.test_time` works without scikit-learn (only the default
540
+ classifier of `WeightedConformalRegressionAdapter` needs it).
541
+ - Examples: every script runs against the current API; external comparisons
542
+ use MAPIE 1.x, torchcp 1.2 and scikit-learn's `TweedieRegressor`; the
543
+ Tweedie examples no longer apply `exp` twice.
544
+ - `CORALLoss` no longer overwrites the `CumulativeLinkLoss` docstring: it is
545
+ now a thin subclass of `CumulativeLinkLoss` with its own docstring (same
546
+ computation, same `"coral"` registry key).
547
+ - `torchregress.method_catalog` declares an explicit `__all__` (its 4
548
+ dataclasses, `CapabilityValue` and 5 functions), so `import *` no longer
549
+ re-exports `Any`, `Dict`, `dataclass` and the other typing imports.
550
+ - Docs: removed names that do not exist (`PackedEnsembleRegressor`,
551
+ `MCDropoutModel`, `BayesianModelAveraging`, `mse`, `mean_absolute_percentage_error`,
552
+ `conformal_loss`, `create_eiv_loss`, ...) and corrected calls the functions
553
+ do not accept (`mask=`/`weights=` on point metrics, which take `sample_weight`;
554
+ `AsymmetricLeastSquaresLoss(tau=)`, `create_grid_figure(n_cols=)`,
555
+ `plot_pit_histogram(bins=)`, `prediction_interval_coverage(confidence=)`).
556
+ `plot_target_density_error_overlap` is now shown as `(y_true, y_pred)`.
557
+ - `highest_posterior_density_coverage`: the docstring and the metrics guide now
558
+ state that `alpha` is the nominal HPD mass, not the miscoverage (no
559
+ behaviour change).
560
+
561
+ ### Packaging and CI
562
+ - SPDX licence metadata (`setuptools>=77`), project URLs, typed classifier;
563
+ the sdist ships the test suite and CHANGELOG.
564
+ - CI `package` job and release `install-smoke` matrix (Linux/macOS, Python
565
+ 3.12–3.14): build, check contents (`scripts/release/check_dist.py`),
566
+ `twine check --strict`, install with core dependencies only and import every
567
+ submodule (`scripts/release/smoke_install.py`).
568
+ - `docs.yml` publishes the documentation to GitHub Pages.
569
+ - Local CUDA testing: `cuda` marker, CPU-vs-device parity suite for 77 losses
570
+ and 94 metrics (`tests/test_device_parity.py`), `pixi run test-cuda`
571
+ writing `reports/cuda/<date>_<sha>.txt`.
572
+
573
+ ### Tests
574
+ - `tests/metrics/test_reference_parity.py` checks all 97 `metrics` exports
575
+ against scoringrules, properscoring, scipy, scikit-learn or closed forms
576
+ (14 have no reference and say why); `tests/metrics/test_scoring_properties.py`
577
+ adds Hypothesis invariants (CRPS non-negativity and equivariance,
578
+ propriety, pinball monotonicity). `scoringrules`, `properscoring` and
579
+ `hypothesis` join the `test` extra.
580
+
581
+ ### Added
582
+ - `losses.FaithfulGaussianLoss`: `mean_weight` accepts a per-output vector (length `D`, validated finite and non-negative), and a new `mean_loss="huber"` option (with `huber_delta`) bounds the pull of outlying targets on the mean. Defaults unchanged. `mean_weight` is now a registered buffer.
583
+ - `utils.BSplineDensityBasis`: unit-integral (M-spline) B-spline basis for simplex-parameterised 1D densities — exact bin integrals, cumulative moments and `E|U - x|` via piecewise Gauss–Legendre.
584
+ - `losses.DiscreteWasserstein1Loss` / `discrete_wasserstein1`: 1-Wasserstein between mass vectors on a shared 1D grid (mass or point targets).
585
+ - `losses.RankNContrastLoss` / `rank_n_contrast_loss`: Rank-N-Contrast (Zha et al. 2023) with tie-aware rank denominators, mask/weights support.
586
+
587
+ ## [0.2.0] - 2026-08-27
588
+
589
+ ### Fixed
590
+ - `BetaNLLLoss` preserves `[B,D]` elementwise before `_reduce` so partial masks `[[True,False]]` no longer discard whole rows (NEW-HIGH-02)
591
+ - `PoissonLikelihoodRatioLoss` clamps `exp(y_pred.clamp(max=30))` to avoid `inf` for `y_pred~100` (NEW-HIGH-04)
592
+ - `GEV` `gev_nll_elementwise` masks `1/xi` and `pow(-1/xi)` via `use_gev` so `xi→0` does not overflow before `where` (NEW-HIGH-03)
593
+ - `Tweedie p=1` Poisson term uses `ratio.clamp(min=eps)` not `log(+eps)` bias (NEW-MED-03)
594
+ - `prediction.quantiles_to_density_grid` forces `float32` levels for int quantiles, `n_support>=2` and `isfinite` guards (NEW-LOW-01/05)
595
+ - `losses/families.py` adds `unconstrained_inputs` flag (default `True`) to avoid `softplus(softplus(x))` (NEW-MED-01, pattern shown for SkewNormal/SkewT)
596
+ - `losses/conformal.py` unifies `_weighted_conformal_threshold` → `_weighted_quantile` augmented `+w_{n+1}=1` (NEW-HIGH-01) and CV+/Jackknife+ docs correct `>=1-2alpha` (NEW-HIGH-05)
597
+ - `ensemble/swag.py` skips BatchNorm `running_*` buffers in posterior (NEW-HIGH-06)
598
+ - `algorithms/simex.py` validates `sigma_u` PSD via cholesky, warns if `|w|>5` (NEW-HIGH-07)
599
+ - `algorithms/tictac.py` clamps `log_k` to `[-6,6]` and warns if Hessian `>50M` elems (~200MB) (NEW-HIGH-08)
600
+ - `algorithms/adaptive_prior_vi.py` `VIDSRegressor` KL and NLL both `mean()` so KL not dominated by `P` (NEW-HIGH-09)
601
+ - `losses/__init__.py` adds explicit `__all__` (139 symbols) for `audit_api_coverage.py` soundness (TR-API-01 latent)
602
+
603
+ ### Changed
604
+ - `BetaNLLLoss` numerics: previously `sum(dim=-1)` then `mean` over `B`; now `mean` over `B*D` elementwise (breaking for `D>1`, semver MINOR, documented)
605
+ - `README` badge `python 3.12 | 3.13 | 3.14 | 3.15` now matches `pyproject.toml:14 requires-python <3.16` (NEW-LOW-09)
606
+
607
+ ### Added
608
+ - `CHANGELOG.md` (Keep a Changelog) and release-script `prepare_release.sh` now enforces bump
609
+
610
+ ## [0.1.0] - 2026-08-26
611
+
612
+ - Initial PyPI release candidate (unreleased). Pre-1.0 blockers TR-COR-01…09 (all fixed in `6ce4b9e`).
613
+ - Features: 19 loss families, `PredictiveBatch`, `torchmetrics` metrics, conformal (split/CQR/CTI/weighted/Mondrian/CV+), `SemiConformalCalibrator`, ensembles (DeepEnsemble/BatchEnsemble/SWAG/Laplace/BNN/MC-Dropout), algorithms (IRLS/SIMEX/RC/LatentNN/TICTAC/VIDS), causal `dr_*`, PPI, test-time (BLR/OT/COSA/subspace/transport).
614
+
615
+ [Unreleased]: https://github.com/astroai/torchregress/compare/v0.3.0...HEAD
616
+ [0.3.0]: https://github.com/astroai/torchregress/compare/v0.3.0b1...v0.3.0
617
+ [0.3.0b1]: https://github.com/astroai/torchregress/compare/v0.2.0...v0.3.0b1
618
+ [0.2.0]: https://github.com/astroai/torchregress/compare/v0.1.0...v0.2.0
619
+ [0.1.0]: https://github.com/astroai/torchregress/releases/tag/v0.1.0