Coursera课程自然语言处理(NLP) 借助分类和词向量做自然语言处理 deeplearning.ai

本课程介绍了如何使用逻辑回归和朴素贝叶斯进行情感分析,通过词嵌入技术理解和翻译单词。课程涵盖了从预处理文本到训练和测试模型的全过程,并探讨了这些方法在自然语言处理中的应用。
摘要由CSDN通过智能技术生成

在这里插入图片描述

借助分类和词向量做自然语言处理

欢迎来到由 DeepLearning.ai提供的自然语言处理专项的第一门课程。这门课由Younes Bensouda Mourri,Łukasz Kaiser和Eddy Shyu讲授。

目录

课程简介

第一门课程的内容简介

In Course 1 of the Natural Language Processing Specialization, offered by deeplearning.ai, you will:
a) Perform sentiment analysis of tweets using logistic regression and then naïve Bayes,
b) Use vector space models to discover relationships between words and use PCA to reduce the dimensionality of the vector space and visualize those relationships, and
c) Write a simple English to French translation algorithm using pre-computed word embeddings and locality sensitive hashing to relate words via approximate k-nearest neighbor search.

Please make sure that you’re comfortable programming in Python and have a basic knowledge of machine learning, matrix multiplications, and conditional probability.

By the end of this Specialization, you will have designed NLP applications that perform question-answering and sentiment analysis, created tools to translate languages and summarize text, and even built a chatbot!

This Specialization is designed and taught by two experts in NLP, machine learning, and deep learning. Younes Bensouda Mourri is an Instructor of AI at Stanford University who also helped build the Deep Learning Specialization. Łukasz Kaiser is a Staff Research Scientist at Google Brain and the co-author of Tensorflow, the Tensor2Tensor and Trax libraries, and the Transformer paper.

逻辑回归

有监督学习 & 情感分析

  • 在有监督机器学习中,你需要有输入特征 X X X以及特征的标签 Y Y Y

  • 目标是尽可能地减小损失值

  • 将特征 X X X输入给 p r e d i c t i o n   f u n c t i o n prediction\space function prediction function,将实现特征 X X X输出为预测标签 Y ^ \hat{Y} Y^

  • 当标签 Y Y Y和预测值 Y ^ \hat{Y} Y^差异值较小时,可以实现从特征到标签的最佳映射

  • 损失函数 C o s t Cost Cost计算 Y ^ \hat{Y} Y^ Y Y Y之间的差异

  • 通过计算的损失值来更新参数,迭代重复至损失值为一个较理想的值

    • 在这里插入图片描述
  • 逻辑回归的函数为 s i g m o i d sigmoid sigmoid函数

    • 在这里插入图片描述
  • 情感分析的有监督机器学习分类问题例子:

目的是辨别 t w e e t tweet tweet文本中的语句是积极的还是消极的情感

  • 建立逻辑回归分类器模型,我们分为3个步骤:提取特征, 训练,预测:
    1. 处理原 t w e e t tweet tweet文本为训练数据集并且提取有用的特征
      • t w e e t tweet tweet文本中带有积极正面情感标记为1,带有消极负面情感标记为0
    2. 训练逻辑回归分类器模型并减小损失值
    3. 预测
  • [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0invH1yu-1598175380213)(Images/02.png)]

特征提取

  1. 稀疏矩阵表示
  • 为了将一个文本转化为向量表示,我们需要建立一个词汇表 ( V o c a b u l a r y ) (Vocabulary) (Vocabulary),然后能够将任何文本或则 t w e e t tweet tweet转化为数组矩阵

  • 词汇表 V V V将会以列表形式存储 t w e e t tweet tweet中的不同单词

  • 利用稀疏矩阵存储,在 t w e e t tweet tweet中出现的单词词汇表 V V V将会赋予 1 1 1,而未出现的单词赋予 0 0 0

  • 在这里插入图片描述

  • 稀疏矩阵存在的问题:

  • 逻辑回归模型将会学习 N + 1 N+1 N+1个参数, N N N是词汇表 V V V的大小

  • 耗费巨大的训练时间

  • 耗费巨大的预测时间

  • 在这里插入图片描述

    1. 分别统计消极负面和积极正面的频率
  • t w e e t tweet tweet语料库中不同的单词建立词汇库 V V V

  • 建立两个类别,一个类别是消极负面情感,另一个类别是积极正面情感

  • 在词汇表 V V V中计算积极单词的频率,需要统计它在积极正面的 t w e e t tweet tweet文本中出现的次数,计算消极单词的频率一致

    • 在这里插入图片描述
  • 实际上在编码时,此表是一个字典,将单词及其对应的类别映射到频率,例如单词

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值