From f548b399228d2b3d43d0699d5d0cb08c620b7c06 Mon Sep 17 00:00:00 2001 From: wizardforcel <562826179@qq.com> Date: Sun, 30 Aug 2020 17:34:46 +0800 Subject: [PATCH] 2020-08-30 17:34:46 --- docs/handson-tl-py/1.md | 2 +- docs/handson-tl-py/7.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/handson-tl-py/1.md b/docs/handson-tl-py/1.md index 7ca5096b..29ad4274 100644 --- a/docs/handson-tl-py/1.md +++ b/docs/handson-tl-py/1.md @@ -699,7 +699,7 @@ EDA 是一种非常强大的机制,可用于在进入 ML 的其他阶段之前 通过上一节中提到的方法对文本数据进行正确处理后,我们就可以利用以下一些技术来进行特征提取和转换为数值形式。 Jupyter 笔记本`feature_engineering_text_data.ipynb`中提供了可更好地理解文本数据功能的代码片段: * **词袋模型**:这是迄今为止最简单的文本数据向量化技术。 在此技术中,每个文档都表示为`N`维度上的向量,其中`N`表示预处理语料库中所有可能的单词,向量的每个组成部分表示单词的存在或其频率。 -* **TF-IDF model**:The bag-of-words model works under very simplistic assumptions and at certain times leads to various issues. One of the most common issues is related to some words overshadowing the rest of the words due to very high frequency, as the bag-of-words model utilizes absolute frequencies to vectorize. The **Term Frequency-Inverse Document Frequency** (**TF-IDF**) model mitigates this issue by scaling/normalizing the absolute frequencies. Mathematically, the model is defined as follows: +* **TF-IDF 模型**:词袋模型在非常简单的假设下工作,有时会导致各种问题。 最常见的问题之一与某些单词由于频率很高而使其余单词黯然失色有关,因为词袋模型利用绝对频率进行矢量化。 **词频逆文档频率**(**TF-IDF**)模型通过缩放/归一化绝对频率来缓解此问题。 在数学上,模型定义如下: `tfidf(w, D) = tf(W, D) * idf(w, D)` diff --git a/docs/handson-tl-py/7.md b/docs/handson-tl-py/7.md index b1a19fe6..16c41ed5 100644 --- a/docs/handson-tl-py/7.md +++ b/docs/handson-tl-py/7.md @@ -84,7 +84,7 @@ CBOW 模型体系结构尝试根据源上下文单词(环绕单词)来预测 跳过语法模型体系结构通常尝试实现与 CBOW 模型相反的功能。 它尝试在给定目标词(中心词)的情况下预测源上下文词(环绕词)。 考虑一下前面的简单句子`the quick brown fox jumps over the lazy dog`。 如果我们使用 CBOW 模型,则会得到(`context_window`和`target_word`)对,其中,如果考虑大小为 2 的上下文窗口,则有示例,类似`([quick, fox], brown)`,`([the, brown], quick)`,`([the, dog], lazy)`等。 现在,考虑到跳过语法模型的目的是根据目标单词预测上下文,该模型通常会反转上下文和目标,并尝试根据其目标单词预测每个上下文单词。 -Hence, the task becomes to predict the context [*quick*, *fox*] given the target word *brown* or [*the*, *brown*] given the target word *quick*, and so on. Thus, the model tries to predict the `context_window` words based on the `target_word`. +因此,任务变为给定目标单词`brown`来预测上下文`[quick, fox]`,或给定目标单词`quick`来预测上下文`[the, brown]`,依此类推。 因此,模型试图基于`target_word`来预测`context_window`单词。 以下是前两个模型的体系结构图: -- GitLab