Skip to content

Bugfix/fix bayesian conjugate glm tests#996

Open
kindler-king wants to merge 27 commits intosktime:mainfrom
kindler-king:bugfix/fix-bayesian-conjugate-glm-tests
Open

Bugfix/fix bayesian conjugate glm tests#996
kindler-king wants to merge 27 commits intosktime:mainfrom
kindler-king:bugfix/fix-bayesian-conjugate-glm-tests

Conversation

@kindler-king
Copy link
Contributor

Towards #7, complements #969

While reviewing PR #969 by @arnavk23, I found 3 bugs and noticed the test coverage could be substantially strengthened.

Bugs fixed in [_glm_conjugate.py]:

  • Wrong import: student_t.StudentTt.TDistribution
  • Wrong constructor param: scale=sigma= (TDistribution API)
  • [log_marginal_likelihood] not applying [add_constant] before computing XᵀX, causing shape mismatch; also float() crash on 2D matrix result

Tests added ([test_bayesian_glm_conjugate_comprehensive.py]:

  • Posterior mean/cov vs Bishop PRML eq. 3.50–3.51 (closed-form)
  • aₙ = a₀ + N/2 noise posterior shape update
  • Student-t predictive path: return type + df correctness
  • Predictive mean == X @ μₙ
  • batch fit == sequential _update equivalence
  • Edge cases: add_constant=False, ARD, precision matrix input, gprior without g raises, dimension mismatch raises
  • Numerical stability: N=500, tiny noise_precision
  • log_marginal_likelihood: finite + model comparison test

arnavk23 and others added 27 commits February 27, 2026 01:21
The framework already ensures X and y are in the specified inner mtypes
(pd_DataFrame_Table), so the pd.to_numeric coercion is unnecessary.
Simplified to direct .to_numpy(dtype=float) conversions.
…cstyle compliant; docstring and formatting fixes; add g-prior and synthetic prior support.
…sure all parameters as attributes, and return PPC samples in correct shape. Run pre-commit and auto-format with black.
…Regressor; ensure scikit-learn compliance and fix test errors.
…ressor; only assign first two values from _perform_bayesian_inference.
…ensive tests for BayesianConjugateGLMRegressor
@arnavk23
Copy link
Contributor

@kindler-king Thank you for going through my pr. I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants