Sequence Model - Natural Language Processing & Word Embeddings
Word Embeddings
Word Representation
- 1-hot representation: any product of them is
- Featurized representation: word embedding
Visualizing word embeddings

t-SNE algorithm:
learn the concepts that fell like they should be more related
Using word embeddings
Named entity recognition example

it will be much smaller in training sets and so this allows you to carry out transfer learning
Transfer learning and word embeddings
-
Learn word embeddings from large text corputs. ( words)
(or download pre-trained embedding online.)
-
Transfer embedding to new task with smaller training set.
(say, 100k words)
-
Optional: Continue to finetune word embeddings with new data
Properties of Word Embeddings
Analogies
find a word to satisfiy
- Cosine similarity
Embedding Matrix

Learning Word Embeddings: Word2vec & GloVe
Learning Word Embeddings
-
Neural language model
mask a word and build a network to predict the word, and get the parameters

-
Other context/target pairs
Context: Last 4 words / 4 words on left & right / Last 1 word / Neraby 1 word(skig gram)
Word2Vec
Skip-grams
come up with a few context to target errors to create our supervised learning problem
-
Model
is a parameter associated with output
-
Problems with softmax classification
computation cost is too high
-
Solutions with softmax classification
hierarchical softmax classifier

Negative Sampling
context | word | target? |
---|---|---|
orange | juice | 1 |
orange | king | 0 |
orange | book | 0 |
orange | the | 0 |
orange | of | 0 |
Defining a new learning problem & Model
-
pick a context word and a target word to get a positive example;
-
pick k random words in dictionary and the target word to get k negative examples.
-
train 10000 binary classification problem ( example ) instead of multiple classification(computation cost is much lower)
Selecting negative examples
represents the frequency of .
GloVe Word Vectors
GloVe(global vectors for word representation)
represent how close to each others
is a weighting term:
(regarding )
and are symmetric so you can calculate
.
Applications Using Word Embeddings
Sentiment Classification
Average the word embeddings of the sentence and use a softmax to predict

But it makes some mistakes, e.x. "Completely lacking in good taste, good service, and good ambience."
RNN for sentiment classification
Use the many-to-one RNN (input the word embeddings) can solve this problem.
Debiasing word embeddings
Word embeddings can reflect gender, ethnicity, age, sexual, orientation, and other biases of the text used to train the model.
Addressing bias in word embeddings
-
Indentify bias direction
average
bias direction( )
non-bias direction( )
SVU(singluar vale decomposition, like PCA) can solve it
-
Neutralize: For every word that is not definitional, project to get rid of bias
(need to figure out which words should be neutralize, use SVM first to classify)
-
Equalize pairs.
grandmother - grandfater have the same similarity and distance(gender neural)
you can handpick them(they are not so much)
Homework - Emojify
Building the Emojifier-V2

Compile it
Train it
__EOF__

本文链接:https://www.cnblogs.com/zjp-shadow/p/15142398.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效
2018-08-15 BZOJ 3745: [Coci2015]Norma(分治)