Function: normalizeScore()
ts
function normalizeScore(
raw: number,
metric: DistanceMetric,
kind: ScoreKind,
): number;Defined in: src/batteries/vector/helpers.ts:24
Normalize a backend's raw score into a [0, 1] similarity where higher is closer, accounting for the distance metric and whether the raw value is a similarity or a distance.
Parameters
| Parameter | Type | Description |
|---|---|---|
raw | number | The backend's raw score. |
metric | DistanceMetric | The distance metric the score was computed under. |
kind | ScoreKind | Whether raw is a similarity or a distance. |
Returns
number
The normalized similarity in [0, 1].