mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
20 lines (19 loc) • 1.03 kB
TypeScript
import { MatchFunc } from "./MatchFunc";
import { Primitive } from "./Primitive";
/**
Calculate binary Normalized Discounted Cumulative Gain (NDCG) at rank K.
NDCG is a measure of ranking quality that evaluates how well the retrieved
results are ordered by relevance, considering the position of each result.
For binary relevance (relevant or not relevant), relevance scores are 1 or 0.
@param relevantItems - List of expected relevant items (all with relevance score 1).
@param retrievedItems - List of retrieved items to evaluate.
@param matchFunc - Function to compare items for equality.
@param k - Cutoff rank (top-k results to consider).
@returns Binary NDCG at rank K.
*/
export declare function binaryNdcgAtK<T extends Primitive>(relevantItems: T[], retrievedItems: T[], matchFunc: MatchFunc<T>, k: number): number;
/**
Normalized Discounted Cumulative Gain (NDCG)
*/
export declare function ndcg(realScores: number[], idealNum: number, k: number): number;
//# sourceMappingURL=binaryNdcgAtK.d.ts.map