Add Predictive Kernel Entropy and Spectral Uncertainty with fixes - #467
Merged
Merged
Conversation
ArtemVazh
marked this pull request as ready for review
August 19, 2026 09:13
IINemo
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a corrected replacement for #460.
cosine_similarityinstead oflinear_kernel, so cosine kernels work with non-normalized or configurable embeddingsSpectralUncertainty.epsin the numerical fallback and includes it in the estimator identityhf_cacheto the sentence-transformer cache foldermainbranch so the replacement is up to dateAttribution
The original implementation is by @nassimwalha in #460. The three original commits are preserved unchanged, including their commit SHAs and
Authormetadata:f7a295557b174fdf4a7aa462f6eeb72645b3abcc77e76174c831f24514ba98aab6ce0d93d694cf4b092889878201e5cc94d725df5f1c4c724bf43fb9The 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
epsargument, 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
git diff --checkGitHub Actions will run the complete test suite on this draft.