mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 00:25:23 +03:00
add confidence to tooltip only
This commit is contained in:
parent
1445a17e27
commit
8c0781ad4a
@ -189,6 +189,21 @@ export default function SearchView({
|
|||||||
setSelectedIndex(0);
|
setSelectedIndex(0);
|
||||||
}, [searchTerm, searchFilter]);
|
}, [searchTerm, searchFilter]);
|
||||||
|
|
||||||
|
// confidence score
|
||||||
|
|
||||||
|
const zScoreToConfidence = (score: number) => {
|
||||||
|
// Normalizing is not needed for similarity searches
|
||||||
|
// Sigmoid function for normalized: 1 / (1 + e^x)
|
||||||
|
// Cosine for similarity
|
||||||
|
if (searchFilter) {
|
||||||
|
const notNormalized = searchFilter?.search_type?.includes("similarity");
|
||||||
|
|
||||||
|
const confidence = notNormalized ? 1 - score : 1 / (1 + Math.exp(score));
|
||||||
|
|
||||||
|
return Math.round(confidence * 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// update search detail when results change
|
// update search detail when results change
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -422,7 +437,8 @@ export default function SearchView({
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipPortal>
|
<TooltipPortal>
|
||||||
<TooltipContent>
|
<TooltipContent>
|
||||||
Matched {value.search_source}
|
Matched {value.search_source} at{" "}
|
||||||
|
{zScoreToConfidence(value.search_distance)}%
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</TooltipPortal>
|
</TooltipPortal>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user