2536c937e3
翻译自英文原版 maths-cs-ai-compendium,共 20 章全部完成。 第01章 向量 | 第02章 矩阵 | 第03章 微积分 第04章 统计学 | 第05章 概率论 | 第06章 机器学习 第07章 计算语言学 | 第08章 计算机视觉 | 第09章 音频与语音 第10章 多模态学习 | 第11章 自主系统 | 第12章 图神经网络 第13章 计算与操作系统 | 第14章 数据结构与算法 第15章 生产级软件工程 | 第16章 SIMD与GPU编程 第17章 AI推理 | 第18章 ML系统设计 第19章 应用人工智能 | 第20章 前沿人工智能 翻译说明: - 所有数学公式 $...$ / $$...$$、代码块、图片引用完整保留 - mkdocs.yml 配置中文导航 + language: zh - README.md 已翻译为中文(兼 docs/index.md) - docs/ 目录包含指向各章文件的 symlink - 约 29,000 行中文内容,排除 .cache/ 构建缓存
87 lines
5.4 KiB
XML
87 lines
5.4 KiB
XML
<svg width="720" height="320" xmlns="http://www.w3.org/2000/svg">
|
|
<defs>
|
|
<marker id="w2v-arrow" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
|
|
<polygon points="0 0, 7 2.5, 0 5" fill="#555"/>
|
|
</marker>
|
|
</defs>
|
|
<text x="360" y="22" fill="#333" font-size="14" font-weight="bold" text-anchor="middle">Word2Vec: CBOW vs Skip-gram</text>
|
|
|
|
<!-- === CBOW (left side) === -->
|
|
<text x="170" y="50" fill="#3498db" font-size="13" font-weight="bold" text-anchor="middle">CBOW</text>
|
|
<text x="170" y="66" fill="#666" font-size="10" text-anchor="middle">Predict target from context</text>
|
|
|
|
<!-- Context words (input) -->
|
|
<rect x="30" y="85" width="70" height="28" rx="5" fill="#3498db" opacity="0.12" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="65" y="104" fill="#3498db" font-size="11" text-anchor="middle">the</text>
|
|
|
|
<rect x="30" y="120" width="70" height="28" rx="5" fill="#3498db" opacity="0.12" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="65" y="139" fill="#3498db" font-size="11" text-anchor="middle">cat</text>
|
|
|
|
<rect x="30" y="175" width="70" height="28" rx="5" fill="#3498db" opacity="0.12" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="65" y="194" fill="#3498db" font-size="11" text-anchor="middle">on</text>
|
|
|
|
<rect x="30" y="210" width="70" height="28" rx="5" fill="#3498db" opacity="0.12" stroke="#3498db" stroke-width="1.5"/>
|
|
<text x="65" y="229" fill="#3498db" font-size="11" text-anchor="middle">the</text>
|
|
|
|
<!-- Average box -->
|
|
<rect x="130" y="140" width="80" height="32" rx="6" fill="#f39c12" opacity="0.15" stroke="#f39c12" stroke-width="1.5"/>
|
|
<text x="170" y="160" fill="#f39c12" font-size="11" text-anchor="middle" font-weight="bold">Average</text>
|
|
|
|
<!-- Arrows to average -->
|
|
<line x1="100" y1="99" x2="130" y2="148" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="100" y1="134" x2="130" y2="152" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="100" y1="189" x2="130" y2="160" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="100" y1="224" x2="130" y2="164" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
|
|
<!-- Target word (output) -->
|
|
<rect x="248" y="140" width="70" height="32" rx="5" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="2"/>
|
|
<text x="283" y="161" fill="#e74c3c" font-size="12" text-anchor="middle" font-weight="bold">sat</text>
|
|
|
|
<line x1="210" y1="156" x2="248" y2="156" stroke="#555" stroke-width="1.2" marker-end="url(#w2v-arrow)"/>
|
|
|
|
<text x="65" y="80" fill="#666" font-size="9" text-anchor="middle">Context</text>
|
|
<text x="283" y="135" fill="#666" font-size="9" text-anchor="middle">Target</text>
|
|
|
|
<!-- Divider -->
|
|
<line x1="360" y1="45" x2="360" y2="300" stroke="#ccc" stroke-width="1" stroke-dasharray="5,3"/>
|
|
|
|
<!-- === Skip-gram (right side) === -->
|
|
<text x="550" y="50" fill="#27ae60" font-size="13" font-weight="bold" text-anchor="middle">Skip-gram</text>
|
|
<text x="550" y="66" fill="#666" font-size="10" text-anchor="middle">Predict context from target</text>
|
|
|
|
<!-- Target word (input) -->
|
|
<rect x="420" y="140" width="70" height="32" rx="5" fill="#e74c3c" opacity="0.15" stroke="#e74c3c" stroke-width="2"/>
|
|
<text x="455" y="161" fill="#e74c3c" font-size="12" text-anchor="middle" font-weight="bold">sat</text>
|
|
<text x="455" y="135" fill="#666" font-size="9" text-anchor="middle">Target</text>
|
|
|
|
<!-- Hidden layer -->
|
|
<rect x="520" y="140" width="60" height="32" rx="6" fill="#f39c12" opacity="0.15" stroke="#f39c12" stroke-width="1.5"/>
|
|
<text x="550" y="161" fill="#f39c12" font-size="10" text-anchor="middle" font-weight="bold">Hidden</text>
|
|
|
|
<line x1="490" y1="156" x2="520" y2="156" stroke="#555" stroke-width="1.2" marker-end="url(#w2v-arrow)"/>
|
|
|
|
<!-- Context words (output) -->
|
|
<rect x="620" y="85" width="70" height="28" rx="5" fill="#27ae60" opacity="0.12" stroke="#27ae60" stroke-width="1.5"/>
|
|
<text x="655" y="104" fill="#27ae60" font-size="11" text-anchor="middle">the</text>
|
|
|
|
<rect x="620" y="120" width="70" height="28" rx="5" fill="#27ae60" opacity="0.12" stroke="#27ae60" stroke-width="1.5"/>
|
|
<text x="655" y="139" fill="#27ae60" font-size="11" text-anchor="middle">cat</text>
|
|
|
|
<rect x="620" y="175" width="70" height="28" rx="5" fill="#27ae60" opacity="0.12" stroke="#27ae60" stroke-width="1.5"/>
|
|
<text x="655" y="194" fill="#27ae60" font-size="11" text-anchor="middle">on</text>
|
|
|
|
<rect x="620" y="210" width="70" height="28" rx="5" fill="#27ae60" opacity="0.12" stroke="#27ae60" stroke-width="1.5"/>
|
|
<text x="655" y="229" fill="#27ae60" font-size="11" text-anchor="middle">the</text>
|
|
|
|
<!-- Arrows from hidden to context -->
|
|
<line x1="580" y1="148" x2="620" y2="103" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="580" y1="152" x2="620" y2="137" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="580" y1="160" x2="620" y2="185" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
<line x1="580" y1="164" x2="620" y2="220" stroke="#555" stroke-width="1" marker-end="url(#w2v-arrow)"/>
|
|
|
|
<text x="655" y="80" fill="#666" font-size="9" text-anchor="middle">Context</text>
|
|
|
|
<!-- Bottom note -->
|
|
<text x="360" y="280" fill="#666" font-size="10" text-anchor="middle">Both architectures learn dense word embeddings as a byproduct of prediction.</text>
|
|
<text x="360" y="296" fill="#666" font-size="10" text-anchor="middle">Skip-gram works better for rare words; CBOW is faster for frequent words.</text>
|
|
</svg> |