當前位置:
首頁 > 知識 > PyTorch文本分類教程

PyTorch文本分類教程

這是我計劃編寫的系列教程的第4部分,這一系列教程將介紹如何使用神奇的PyTorch庫實現自己實現一個很酷的模型。

使用本項目的前提是假設你已經掌握了PyTorch的基本知識,遞歸神經網路。如果你是PyTorch的新手,建議首先閱讀PyTorch的深度學習:60分鐘閃電戰和根據實例學習PyTorch。

如果對項目有什麼問題、建議或更正都可以發布issue。

註:項目是在Python 3.6中使用PyTorch 0.4運行的。

目的

構建可以將文本文檔標記為多個類別之一的模型。

我們將實現層次注意網路(HAN),這是一種更有趣、更易於解釋的文本分類模型。

這個模型不僅對文檔進行分類,還選擇文本中它認為最重要的特定部分——句子和單個單詞。

以下是舉例及分析結果:

"I think I"m falling sick. There was some indigestion at first. But now a fever is beginning to take hold."

"But think about it! It"s so cool. Physics is really all about math. What Feynman said, hehe."

"I want to tell you something important. Get into the stock market and investment funds. Make some money so you can buy yourself some yogurt."

"How do computers work? I have a CPU I want to use. But my keyboard and motherboard do not help."

"You can just google how computers work. Honestly, its easy."

"You know what"s wrong with this country? Republicans and democrats. Always at each other"s throats"

"There"s no respect, no bipartisanship."

本教程持續更新中~

在此期間,你依然可以看看代碼,了解它的工作原理!

我們在Yahoo Answer數據集上的準確率達到了75.1%(論文中為75.8%)。

Github項目地址:

https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Text-Classification

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 AI研習社 的精彩文章:

需求多變的AI安防行業,需要什麼樣的AI視覺計算引擎?
搜狗搜索 「AIS 2019」 論文研討會回放觀看&嘉賓 PPT 打包下載

TAG:AI研習社 |