Skip to content

Instantly share code, notes, and snippets.

@calebdre
Last active June 14, 2024 01:11
Show Gist options
  • Save calebdre/6ccdbaa753f067cc94ddd8b62d8909e6 to your computer and use it in GitHub Desktop.
Save calebdre/6ccdbaa753f067cc94ddd8b62d8909e6 to your computer and use it in GitHub Desktop.
const evaluateCodeSearch = async (
files: FileInfo[],
numSamples: number = 15,
k: number = 5
) => {
// create validation set
const validationSet: ValidationQuery[] = await generateValidationQueries(files, numSamples)
const resultSet: QueryResult[][] = []
// run each validation query against the code search system
for (let query of validationSet) {
const queryStr = query.query
const result = await runQuery(queryStr, files)
resultSet.push(result)
}
// calculate evaluation score
const score = calculateMAPAtK(validationSet, resultSet)
return score
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment