文本分类与文本相似度

1. 词向量

hash: simhash
word2vec: 低维稠密向量,每一维表示词语的潜在特征,该特征捕获了句法和语义有用的信息。
(后文详解)

2. 词频

term frequency: 词频 可以是一个单词在本文档出现的次数,也可是在所有文档出现的次数。
raw count, binary, normalized, log

 

WeChat Screenshot_20180201151559.png

3. TF-IDF

tf: 这里的词频指的是本文档词频
inverse document frequency: 反文档频率 公式

 

WeChat Screenshot_20180201151619.png

4. TF-IDF variation

WeChat Screenshot_20180201152749.png

word-word correlation

1. PMI

点间互信息(PMI)主要用于计算词语间的语义相似度,基本思想是统计两个词语在文本中同时出现的概率,如果概率越大,其相关性就越紧密,关联度越高。

 

WeChat Screenshot_20180202114001.png

 

P(word1&word2) > 0;两个词语是相关的;值越大,相关性越强。
P(word1&word2) = 0;两个词语是统计独立的,不相关也不互斥。
P(word1&word2) < 0;两个词语是不相关的,互斥的。

2. PMI extension

  • 情感倾向SO-PMI
  • 左右信息熵

word-sentence

1. DF-IDF

2. mutual information

3. Information gain

信息增益法,通过某个特征词的缺失与存在的两种情况下,语料中前后信息的增加,衡量某个特征词的重要性。

4. chi-square

CHI特征选择算法利用了统计学中的"假设检验"的基本思想:首先假设特征词与类别直接是不相关的,如果利用CHI分布计算出的检验值偏离阈值越大,那么更有信心否定原假设,接受原假设的备则假设:特征词与类别有着很高的关联度。

sentence-sentence

Vector space model 向量空间模型

这个模型假设词与词间不相关(这个前提造成这个模型无法进行语义相关的判断对比word2vec,向量空间模型的缺点在于词之间的线性无关的假说前提),用向量来表示文本,从而简化了文本中的词之间的复杂关系,文档用十分简单的向量表示,使得模型具备了可计算性。

通常用doc-term matrix 来表示文章集合
d=D(W1,W2,…,Wn)

bow + weighting scheme
LDA t-w matrix d-t matrix

词袋模型(bag of words)

  • 只考虑文本中词出现的频率,不考虑词出现的顺序和句法信息。
  • 相当于把进过预处理的文本中的每一个词都当做一个特征,用于之后的任务。
  • 在很多任务上表现也不错,是一个很好的baseline,但它降低复杂度的同时,也损失了一些句法和语义信息。e.g. "我爱你" 和 "你爱我" => "我", "爱", "你"

N-gram

1 - unigram, 2 - bigram, 3 - trigram, four-gram, five-gram and so on.

WeChat Screenshot_20180206103410.png

 

以词为例, bigram 可以包含句法(syntax)的信息,e.g. ‘我爱’,‘爱你’

n-gram model

  • a type of probabilistic language model: statistical machine learning or neuron networks.
  • predict next word based on previous n-1 words
  • simplicity
  • scalability
  • OOV: smoothing
  • evaluation: perplexity
  • application: NLG

stemming 词根

the process of collapsing the morphological variants of a word together.
e.g. process processed processing => process

stocks and stocking => stock

stop list

e.g. 'the', 'a', 'in', 'of'
高频词无实意,占空间
但一些由高频词组成的短语可能会被排除掉 e.g. to be or not to be -> not

海量文本相似性

文本分词->停用词->特征向量距离的度量(欧氏距离、hamming 距离或者cosin等等)。两两比较固然能很好地适应,但这种方法的一个最大的缺点就是,无法将其扩展到海量数据。

solution: minhash / simhash

Jaccard similarity coefficient (Jaccard系数) 是常见的衡量两个集合相似度的度量
假如有集合A、B,那么, 也就是说,集合A,B的Jaccard系数等于A,B中共同拥有的元素数与A,B总共拥有的元素数的比例
minhash: http://www.cnblogs.com/bourneli/archive/2013/04/04/2999767.html
simhash:

WeChat Screenshot_20180201164800.png

 

文本分类

1. Fasttext

  • shallow learning, efficient. train billion words, 300k classes, less than 10 mins, on multicore CPU.
  • the state of the art result

     

    WeChat Screenshot_20180202111612.png

deep-neural-networks-nlp-text-mining-16-638.jpg

8xOi7.png

2. 卷积神经网络(CNN)

WeChat Screenshot_20180202151607.png

3. Transformer

调参范式

parallel search

  • grid search
  • random search

sequential optimization

the result of each training run with a particular set of hyperparameters is used as knowledge to inform the subsequent search.

  • hand tuning
  • Bayesian optimization
    updating of the posterior of a Bayesian model of successful hyperparameters for training.
  • GP-UCB
  • TPE
  • Spearmint
  • SMAC
    slow!!!
    solution: early stopping, using intermediate losses to predict final performance, and even modelling the entire time and data dependent optimization process in order to reduce the number of optimization steps and to better explore the space of promising hyperparameters.

Hybrid

  • Population Based Training(PBT)

Batch Norm

特征哈希(Feature Hashing)



转载地址:https://www.jianshu.com/p/0dc0d9957296

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值