Skip to content

Add Predictive Kernel Entropy and Spectral Uncertainty with fixes - #467

Merged
IINemo merged 6 commits into
mainfrom
agent/pr-460-fixes
Sep 1, 2026
Merged

IINemo merged 6 commits into
mainfrom
agent/pr-460-fixes

Conversation

@ArtemVazh

Copy link
Copy Markdown
Collaborator

Summary

This is a corrected replacement for #460.

  • carries forward Predictive Kernel Entropy, Spectral Uncertainty, sentence-embedding statistics, configuration, documentation, and integration tests from the original PR
  • uses cosine_similarity instead of linear_kernel, so cosine kernels work with non-normalized or configurable embeddings
  • uses the configured SpectralUncertainty.eps in the numerical fallback and includes it in the estimator identity
  • forwards hf_cache to the sentence-transformer cache folder
  • adds focused regression tests for cosine normalization, epsilon handling, and cache propagation
  • merges the current main branch so the replacement is up to date

Attribution

The original implementation is by @nassimwalha in #460. The three original commits are preserved unchanged, including their commit SHAs and Author metadata:

  • f7a295557b174fdf4a7aa462f6eeb72645b3abcc
  • 77e76174c831f24514ba98aab6ce0d93d694cf4b
  • 092889878201e5cc94d725df5f1c4c724bf43fb9

The corrective changes are kept in a separate commit.

Root cause and impact

The previous cosine path relied on sentence-transformer embeddings being pre-normalized; custom embeddings could therefore produce scale-dependent uncertainty. The spectral fallback ignored its public eps argument, and the default calculator configuration discarded the caller's Hugging Face cache path. These fixes make the estimators robust to configurable embeddings, honor their public configuration, and avoid unexpected model downloads in cached or offline setups.

Validation

  • focused estimator and configuration smoke tests
  • Black check on all changed Python files
  • full repository Flake8 check
  • git diff --check

GitHub Actions will run the complete test suite on this draft.

@IINemo
IINemo merged commit f4e85a7 into main Sep 1, 2026
1 check passed
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.

3 participants