{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html","markdown":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.md","pages":[{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","unit":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","unitId":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","chapter":"course","number":1}],"aliases":[{"oldId":"b-2a1d7ecf6d04b924af79cd65","targetId":"b-2a1d7ecf6d04b924af79cd65","page":"reading-opening","operation":"move","beforeSHA256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","afterSHA256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","reason":"Same source body in authored semantic page"},{"oldId":"b-7ba0ecfaf1340d1a84e398d9","targetId":"b-7ba0ecfaf1340d1a84e398d9","page":"reading-opening","operation":"move","beforeSHA256":"6561fe69b3c817a317747015c3617dc880420ffd73962dc8bb6e76a27756cfc2","afterSHA256":"6561fe69b3c817a317747015c3617dc880420ffd73962dc8bb6e76a27756cfc2","reason":"Same source body in authored semantic page"},{"oldId":"b-afb04bcafbd1659a30206a97","targetId":"b-afb04bcafbd1659a30206a97","page":"reading-opening","operation":"move","beforeSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","afterSHA256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","reason":"Same source body in authored semantic page"},{"oldId":"b-162feffcb7bef2858a69b4d2","targetId":"b-162feffcb7bef2858a69b4d2","page":"reading-opening","operation":"move","beforeSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","afterSHA256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","reason":"Same source body in authored semantic page"},{"oldId":"b-6acb624d6c60545b83e33dad","targetId":"b-6acb624d6c60545b83e33dad","page":"reading-opening","operation":"move","beforeSHA256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","afterSHA256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","reason":"Same source body in authored semantic page"}],"blocks":[{"id":"b-2a1d7ecf6d04b924af79cd65","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html#b-2a1d7ecf6d04b924af79cd65","content":"[LAB 12 · CLIP延伸：缓存与检索（近似索引选读）](/course/notebooks/921eeaf784284ce19568c6ca7619b55a.html)","sha256":"1a4de4df51c1a8787dc96ec401888dfe89d250842519319b9af7a931ca765eee","chapter":{"id":"course","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"unit":{"id":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"page":{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","number":1},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-7ba0ecfaf1340d1a84e398d9","prerequisites":[],"relatedBlocks":[]},{"id":"b-7ba0ecfaf1340d1a84e398d9","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html#b-7ba0ecfaf1340d1a84e398d9","content":"# 2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sha256":"6561fe69b3c817a317747015c3617dc880420ffd73962dc8bb6e76a27756cfc2","chapter":{"id":"course","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"unit":{"id":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"page":{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","number":1},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-2a1d7ecf6d04b924af79cd65","nextBlock":"b-afb04bcafbd1659a30206a97","prerequisites":[{"id":"b-2a1d7ecf6d04b924af79cd65","url":"#b-2a1d7ecf6d04b924af79cd65","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-afb04bcafbd1659a30206a97","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html#b-afb04bcafbd1659a30206a97","content":"并入相关学习路径","sha256":"dc06c1e728a4b5740ba634b145bc9a1da6323031626734cb4555db5a744df806","chapter":{"id":"course","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"unit":{"id":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"page":{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","number":1},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7ba0ecfaf1340d1a84e398d9","nextBlock":"b-162feffcb7bef2858a69b4d2","prerequisites":[{"id":"b-7ba0ecfaf1340d1a84e398d9","url":"#b-7ba0ecfaf1340d1a84e398d9","role":"section-title"},{"id":"b-2a1d7ecf6d04b924af79cd65","url":"#b-2a1d7ecf6d04b924af79cd65","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-162feffcb7bef2858a69b4d2","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html#b-162feffcb7bef2858a69b4d2","content":"同一CLIP缓存、exact/IVF搜索、延迟/扫描量、区域交互基线","sha256":"8021c18afc52ba7b6612f43ecfb0fdd4789efe91cc9cd656984357d81a8514de","chapter":{"id":"course","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"unit":{"id":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"page":{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","number":1},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-afb04bcafbd1659a30206a97","nextBlock":"b-6acb624d6c60545b83e33dad","prerequisites":[{"id":"b-7ba0ecfaf1340d1a84e398d9","url":"#b-7ba0ecfaf1340d1a84e398d9","role":"section-title"},{"id":"b-2a1d7ecf6d04b924af79cd65","url":"#b-2a1d7ecf6d04b924af79cd65","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6acb624d6c60545b83e33dad","type":"pre","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f.html#b-6acb624d6c60545b83e33dad","content":"```\nX,Q=a['gallery'],a['queries']\nassert np.allclose(np.linalg.norm(X,axis=1),1,atol=2e-6)\nlabels=np.array([r['label'] for r in manifest['gallery']])\ntruth=[r['label'] for r in manifest['queries']]\nS=Q@X.T\nexact=np.stack([cr.stable_rank(row,k=3) for row in S])\nfor i,row in enumerate(exact):\n    print(manifest['queries'][i]['text'],'->',[(manifest['gallery'][j]['id'],round(float(S[i,j]),4)) for j in row])\nhit3=np.mean([any(labels[j]==truth[i] for j in row) for i,row in enumerate(exact)])\nprint('exact semantic Hit@3:',hit3)\n# 反方向：每张图对 12 条文字排序。每类有两条同义候选。\ni2t=np.stack([cr.stable_rank(row,k=1) for row in S.T])\nprint('image-to-text Hit@1:',np.mean([truth[row[0]]==labels[i] for i,row in enumerate(i2t)]))\n\n```","sha256":"00533db81ffa311ed8f37086e435877c01dd22b52775e5759abb88c9252bc0aa","chapter":{"id":"course","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"unit":{"id":"notebook-blocks/e05d4164e12144fea000c0bf4d6b7e2f","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码"},"page":{"id":"reading-opening","title":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","number":1},"sectionTitle":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","currentQuestion":"2 · 精确搜索：模型给分，评价定义相关 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-162feffcb7bef2858a69b4d2","nextBlock":null,"prerequisites":[{"id":"b-7ba0ecfaf1340d1a84e398d9","url":"#b-7ba0ecfaf1340d1a84e398d9","role":"section-title"},{"id":"b-2a1d7ecf6d04b924af79cd65","url":"#b-2a1d7ecf6d04b924af79cd65","role":"problem-context"}],"relatedBlocks":[]}]}
