Package: matchzoo-py
MatchZoo-pyPyTorch version ofMatchZoo.Facilitating the design, comparison and sharing of deep text matching models.MatchZoo 是一个通用的文本匹配工具包，它旨在方便大家快速的实现、比较、以及分享最新的深度文本匹配模型。The goal of MatchZoo is to provide a high-quality codebase for deep text matching research, such as document retrieval, question answering, conversational response ranking, and paraphrase identification. With the unified data processing pipeline, simplified model configuration and automatic hyper-parameters tunning features equipped, MatchZoo is flexible and easy to use.TasksText 1Text 2ObjectiveParaphrase Indentificationstring 1string 2classificationTextual EntailmenttexthypothesisclassificationQuestion Answerquestionanswerclassification/rankingConversationdialogresponseclassification/rankingInformation RetrievalquerydocumentrankingGet Started in 60 SecondsTo train aDeep Semantic Structured Model, make use of MatchZoo customized loss functions and evaluation metrics to define a task:importtorchimportmatchzooasmzranking_task=mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss(num_neg=4))ranking_task.metrics=[mz.metrics.NormalizedDiscountedCumulativeGain(k=3),mz.metrics.MeanAveragePrecision()]Prepare input data:train_pack=mz.datasets.wiki_qa.load_data('train',task=ranking_task)valid_pack=mz.datasets.wiki_qa.load_data('dev',task=ranking_task)Preprocess your input data in three lines of code, keep track parameters to be passed into the model:preprocessor=mz.models.ArcI.get_default_preprocessor()train_processed=preprocessor.fit_transform(train_pack)valid_processed=preprocessor.transform(valid_pack)Generate pair-wise training data on-the-fly:trainset=mz.dataloader.Dataset(data_pack=train_processed,mode='pair',num_dup=1,num_neg=4,batch_size=32)validset=mz.dataloader.Dataset(data_pack=valid_processed,mode='point',batch_size=32)Define padding callback and generate data loader:padding_callback=mz.models.ArcI.get_default_padding_callback()trainloader=mz.dataloader.DataLoader(dataset=trainset,stage='train',callback=padding_callback)validloader=mz.dataloader.DataLoader(dataset=validset,stage='dev',callback=padding_callback)Initialize the model, fine-tune the hyper-parameters:model=mz.models.ArcI()model.params['task']=ranking_taskmodel.params['embedding_output_dim']=100model.params['embedding_input_dim']=preprocessor.context['embedding_input_dim']model.guess_and_fill_missing_params()model.build()Traineris used to control the training flow:optimizer=torch.optim.Adam(model.parameters())trainer=mz.trainers.Trainer(model=model,optimizer=optimizer,trainloader=trainloader,validloader=validloader,epochs=10)trainer.run()ReferencesTutorialsEnglish DocumentationIf you're interested in the cutting-edge research progress, please take a look atawaresome neural models for semantic match.InstallMatchZoo-py is dependent onPyTorch. Two ways to install MatchZoo-py:Install MatchZoo-py from Pypi:pipinstallmatchzoo-pyInstall MatchZoo-py from the Github source:git clone https://github.com/NTMC-Community/MatchZoo-py.git
cd MatchZoo-py
python setup.py installModelsDRMM: this model is an implementation ofA Deep Relevance Matching Model for Ad-hoc Retrieval.DRMMTKS: this model is an implementation ofA Deep Top-K Relevance Matching Model for Ad-hoc Retrieval.ARC-I: this model is an implementation ofConvolutional Neural Network Architectures for Matching Natural Language SentencesARC-II: this model is an implementation ofConvolutional Neural Network Architectures for Matching Natural Language SentencesDSSM: this model is an implementation ofLearning Deep Structured Semantic Models for Web Search using Clickthrough DataCDSSM: this model is an implementation ofLearning Semantic Representations Using Convolutional Neural Networks for Web SearchMatchLSTM:this model is an implementation ofMachine Comprehension Using Match-LSTM and Answer PointerDUET: this model is an implementation ofLearning to Match Using Local and Distributed Representations of Text for Web SearchKNRM: this model is an implementation ofEnd-to-End Neural Ad-hoc Ranking with Kernel PoolingConvKNRM: this model is an implementation ofConvolutional neural networks for soft-matching n-grams in ad-hoc searchESIM: this model is an implementation ofEnhanced LSTM for Natural Language InferenceBiMPM: this model is an implementation ofBilateral Multi-Perspective Matching for Natural Language SentencesMatchPyramid: this model is an implementation ofText Matching as Image RecognitionMatch-SRNN: this model is an implementation ofMatch-SRNN: Modeling the Recursive Matching Structure with Spatial RNNaNMM: this model is an implementation ofaNMM: Ranking Short Answer Texts with Attention-Based Neural Matching ModelMV-LSTM: this model is an implementation ofA Deep Architecture for Semantic Matching with Multiple Positional Sentence RepresentationsDIIN: this model is an implementation ofNatural Lanuguage Inference Over Interaction SpaceHBMP: this model is an implementation ofSentence Embeddings in NLI with Iterative Refinement EncodersBERT: this model is an implementation ofBERT: Pre-training of Deep Bidirectional Transformers for Language UnderstandingCitationIf you use MatchZoo in your research, please use the following BibTex entry.@inproceedings{Guo:2019:MLP:3331184.3331403,
 author = {Guo, Jiafeng and Fan, Yixing and Ji, Xiang and Cheng, Xueqi},
 title = {MatchZoo: A Learning, Practicing, and Developing System for Neural Text Matching},
 booktitle = {Proceedings of the 42Nd International ACM SIGIR Conference on Research and Development in Information Retrieval},
 series = {SIGIR'19},
 year = {2019},
 isbn = {978-1-4503-6172-9},
 location = {Paris, France},
 pages = {1297--1300},
 numpages = {4},
 url = {http://doi.acm.org/10.1145/3331184.3331403},
 doi = {10.1145/3331184.3331403},
 acmid = {3331403},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {matchzoo, neural network, text matching},
}Development Team​ ​ ​ ​​​Yixing Fan​Core DevASST PROF, ICT​Jiangui Chen​Core DevPhD. ICT​​Yinqiong CaiCore DevM.S. ICT​​​Liang Pang​Core DevASST PROF, ICT​​​Lixin SuDevPhD. ICT​​​Ruibin Xiong​DevM.S. ICT​​​Yuyang Ding​DevM.S. ICT​​​Junfeng Tian​DevM.S. ECNU​​​Qinghua Wang​DocumentationB.S. Shandong Univ.​ContributionPlease make sure to read theContributing Guidebefore creating a pull request. If you have a MatchZoo-related paper/project/compnent/tool, send a pull request tothis awesome list!Thank you to all the people who already contributed to MatchZoo!Bo Wang,Zeyi Wang,Liu Yang,Zizhen Wang,Zhou Yang,Jianpeng Hou,Lijuan Chen,Yukun Zheng,Niuguo Cheng,Dai Zhuyun,Aneesh Joshi,Zeno Gantner,Kai Huang,stanpcf,ChangQF,Mike KelloggProject OrganizersJiafeng GuoInstitute of Computing Technology, Chinese Academy of SciencesHomepageYanyan LanInstitute of Computing Technology, Chinese Academy of SciencesHomepageXueqi ChengInstitute of Computing Technology, Chinese Academy of SciencesHomepageLicenseApache-2.0Copyright (c) 2019-present, Yixing Fan (faneshion)