Giter Club home page Giter Club logo

sentences_pair_similarity_calculation_siamese_lstm's Introduction

孪生LSTM网络(Siamese-LSTM)

本项目是基于孪生LSTM网络+注意力机制+曼哈顿距离(Manhattan distance)实现的句对相似度计算。
中文训练数据为蚂蚁金服句对数据,约4万组,正负样本比例1:3.6;英文训练数据来自Kaggle上的Quora句对数据,约40万组,正负样本比例1:1.7。新增一组翻译数据:使用Google Translator将Quora数据翻译成中文。

资料

使用

训练

$ python3 train.py
$ type cn for Chinese Data or en for English Data

验证

$ python3 predict.py
$ type cn for Chinese Data or en for English Data

预测

$ python3 score.py
$ type cn for Chinese Data or en for English Data

效果

$ 根据数据比例来看,中文训练集的基准准确率应为0.783,英文与翻译数据为0.630
$ =================================================================================================
$ 中文 数据实际训练 5 轮时的效果:使用随机词向量时,训练集十折交叉0.778;使用CN120G词向量时,训练集十折交叉0.789
$ 英文 数据实际训练 5 轮时的效果:使用随机词向量时,训练集十折交叉0.774;使用Google词向量时,训练集十折交叉0.771
$ 翻译 数据实际训练 5 轮时的效果:使用随机词向量时,训练集十折交叉0.755;使用CN120G词向量时,训练集十折交叉0.756
$ =================================================================================================
$ 中文 数据实际训练 8 轮时的效果:使用随机词向量时,训练集十折交叉0.777;使用CN120G词向量时,训练集十折交叉0.787
$ 英文 数据实际训练 8 轮时的效果:使用随机词向量时,训练集十折交叉0.774;使用Google词向量时,训练集十折交叉0.778
$ 翻译 数据实际训练 8 轮时的效果:使用随机词向量时,训练集十折交叉0.786;使用CN120G词向量时,训练集十折交叉0.786
$ =================================================================================================
$ 总结:1.有无预训练词向量几乎不影响结果;2.中文数据上训练几乎没有效果,和英文形成鲜明对比--这可能是因为蚂蚁金服数据间太相似了或者数据量太小,翻译数据集上的实验证明了这一点。

sentences_pair_similarity_calculation_siamese_lstm's People

Contributors

lujunru avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.