{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"先做一个无需模型的关系检验 · 实现代码","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html","markdown":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.md","pages":[{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","unit":"先做一个无需模型的关系检验 · 实现代码","unitId":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","chapter":"course","number":1}],"aliases":[{"oldId":"b-fab7400c8b4dd5c49b6822f8","targetId":"b-fab7400c8b4dd5c49b6822f8","page":"reading-opening","operation":"move","beforeSHA256":"b097cc692a4f43c3eeba08ce9c2e73c631f1bad298a5fb1dec9efa967315dac3","afterSHA256":"b097cc692a4f43c3eeba08ce9c2e73c631f1bad298a5fb1dec9efa967315dac3","reason":"Same source body in authored semantic page"},{"oldId":"b-949bd72e838792dca3c67b01","targetId":"b-949bd72e838792dca3c67b01","page":"reading-opening","operation":"move","beforeSHA256":"c11573d2069bfb7a2b440a806bb5a0d5fe47396744263d55901107ee158e51dd","afterSHA256":"c11573d2069bfb7a2b440a806bb5a0d5fe47396744263d55901107ee158e51dd","reason":"Same source body in authored semantic page"},{"oldId":"b-18402b0ac4dfa9bb93d8c95f","targetId":"b-18402b0ac4dfa9bb93d8c95f","page":"reading-opening","operation":"move","beforeSHA256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","afterSHA256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","reason":"Same source body in authored semantic page"},{"oldId":"b-8b0d0b553e01498ba5b67da2","targetId":"b-8b0d0b553e01498ba5b67da2","page":"reading-opening","operation":"move","beforeSHA256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","afterSHA256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","reason":"Same source body in authored semantic page"},{"oldId":"b-e90c68619e6abccdaec10fc0","targetId":"b-e90c68619e6abccdaec10fc0","page":"reading-opening","operation":"move","beforeSHA256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","afterSHA256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","reason":"Same source body in authored semantic page"}],"blocks":[{"id":"b-fab7400c8b4dd5c49b6822f8","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html#b-fab7400c8b4dd5c49b6822f8","content":"[LAB 04 · CLIP：候选、提示与关系检验](/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html)","sha256":"b097cc692a4f43c3eeba08ce9c2e73c631f1bad298a5fb1dec9efa967315dac3","chapter":{"id":"course","title":"先做一个无需模型的关系检验 · 实现代码"},"unit":{"id":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","title":"先做一个无需模型的关系检验 · 实现代码"},"page":{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","number":1},"sectionTitle":"先做一个无需模型的关系检验 · 实现代码","currentQuestion":"先做一个无需模型的关系检验 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-949bd72e838792dca3c67b01","prerequisites":[],"relatedBlocks":[]},{"id":"b-949bd72e838792dca3c67b01","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html#b-949bd72e838792dca3c67b01","content":"# 先做一个无需模型的关系检验 · 实现代码","sha256":"c11573d2069bfb7a2b440a806bb5a0d5fe47396744263d55901107ee158e51dd","chapter":{"id":"course","title":"先做一个无需模型的关系检验 · 实现代码"},"unit":{"id":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","title":"先做一个无需模型的关系检验 · 实现代码"},"page":{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","number":1},"sectionTitle":"先做一个无需模型的关系检验 · 实现代码","currentQuestion":"先做一个无需模型的关系检验 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-fab7400c8b4dd5c49b6822f8","nextBlock":"b-18402b0ac4dfa9bb93d8c95f","prerequisites":[{"id":"b-fab7400c8b4dd5c49b6822f8","url":"#b-fab7400c8b4dd5c49b6822f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-18402b0ac4dfa9bb93d8c95f","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html#b-18402b0ac4dfa9bb93d8c95f","content":"主线阅读与优先实验","sha256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","chapter":{"id":"course","title":"先做一个无需模型的关系检验 · 实现代码"},"unit":{"id":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","title":"先做一个无需模型的关系检验 · 实现代码"},"page":{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","number":1},"sectionTitle":"先做一个无需模型的关系检验 · 实现代码","currentQuestion":"先做一个无需模型的关系检验 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-949bd72e838792dca3c67b01","nextBlock":"b-8b0d0b553e01498ba5b67da2","prerequisites":[{"id":"b-949bd72e838792dca3c67b01","url":"#b-949bd72e838792dca3c67b01","role":"section-title"},{"id":"b-fab7400c8b4dd5c49b6822f8","url":"#b-fab7400c8b4dd5c49b6822f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8b0d0b553e01498ba5b67da2","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html#b-8b0d0b553e01498ba5b67da2","content":"真实CLIP输入/权重/分数、候选改动、四条件规则与独立关系推理","sha256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","chapter":{"id":"course","title":"先做一个无需模型的关系检验 · 实现代码"},"unit":{"id":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","title":"先做一个无需模型的关系检验 · 实现代码"},"page":{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","number":1},"sectionTitle":"先做一个无需模型的关系检验 · 实现代码","currentQuestion":"先做一个无需模型的关系检验 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-18402b0ac4dfa9bb93d8c95f","nextBlock":"b-e90c68619e6abccdaec10fc0","prerequisites":[{"id":"b-949bd72e838792dca3c67b01","url":"#b-949bd72e838792dca3c67b01","role":"section-title"},{"id":"b-fab7400c8b4dd5c49b6822f8","url":"#b-fab7400c8b4dd5c49b6822f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e90c68619e6abccdaec10fc0","type":"pre","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebook-blocks/b5078a7304e54d9fa89ee186821582fb.html#b-e90c68619e6abccdaec10fc0","content":"```\n# 每次整册运行使用临时工作目录，保留项目旧文件与历史结果。\nimport os, tempfile\nL03_RUN_DIR=tempfile.mkdtemp(prefix=\"lecture03-lab04-\")\nos.chdir(L03_RUN_DIR)\n# 可独立运行；无需前面任何模型、文件或隐藏变量。\n# 改 holder 为 left/right，先预测，再看两条规则是否仍然一致。\nconditions = [\n    {'condition': 1, 'left': 'red', 'right': 'blue', 'holder': 'left'},\n    {'condition': 2, 'left': 'blue', 'right': 'red', 'holder': 'left'},\n    {'condition': 3, 'left': 'red', 'right': 'blue', 'holder': 'right'},\n    {'condition': 4, 'left': 'blue', 'right': 'red', 'holder': 'right'},\n]\ndef choice_for_color(color):\n    return {'red': 'A', 'blue': 'B'}[color]\ndef compare_rules(case):\n    relation = choice_for_color(case[case['holder']])\n    position = choice_for_color(case['left'])\n    return relation, position\nassert compare_rules({'left':'red','right':'blue','holder':'right'}) == ('B','A')\nprint('条件 | 持球关系规则 | 左侧颜色规则 | 两者不同')\nfor case in conditions:\n    relation, position = compare_rules(case)\n    print(case['condition'], relation, position, relation != position)\n\n```","sha256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","chapter":{"id":"course","title":"先做一个无需模型的关系检验 · 实现代码"},"unit":{"id":"notebook-blocks/b5078a7304e54d9fa89ee186821582fb","title":"先做一个无需模型的关系检验 · 实现代码"},"page":{"id":"reading-opening","title":"先做一个无需模型的关系检验 · 实现代码","number":1},"sectionTitle":"先做一个无需模型的关系检验 · 实现代码","currentQuestion":"先做一个无需模型的关系检验 · 实现代码","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8b0d0b553e01498ba5b67da2","nextBlock":null,"prerequisites":[{"id":"b-949bd72e838792dca3c67b01","url":"#b-949bd72e838792dca3c67b01","role":"section-title"},{"id":"b-fab7400c8b4dd5c49b6822f8","url":"#b-fab7400c8b4dd5c49b6822f8","role":"problem-context"}],"relatedBlocks":[]}]}
