<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nguyen Tuan Anh on Medium]]></title>
        <description><![CDATA[Stories by Nguyen Tuan Anh on Medium]]></description>
        <link>https://medium.com/@gofortargets?source=rss-ffd8c809ffb5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*b_o_Z4OwlRC-XoIe.</url>
            <title>Stories by Nguyen Tuan Anh on Medium</title>
            <link>https://medium.com/@gofortargets?source=rss-ffd8c809ffb5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:56:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gofortargets/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Doc2vec & word2vec in gensim]]></title>
            <link>https://medium.com/@gofortargets/doc2vec-word2vec-in-gensim-c9321c780079?source=rss-ffd8c809ffb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9321c780079</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gensim]]></category>
            <category><![CDATA[doc2vec]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Nguyen Tuan Anh]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 10:44:44 GMT</pubDate>
            <atom:updated>2017-07-19T10:45:10.468Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Take a look at:</strong></p><p>Doc2vec paper<strong>: </strong><a href="https://cs.stanford.edu/~quocle/paragraph_vector.pdf"><strong>https://cs.stanford.edu/~quocle/paragraph_vector.pdf</strong></a></p><p><strong>Prepare data</strong></p><p>Ref: <a href="https://rare-technologies.com/doc2vec-tutorial/">Official tutorial Doc2vec of Gensim</a></p><p>“Since the Doc2Vec class extends gensim’s <a href="http://radimrehurek.com/gensim/models/word2vec.html">original Word2Vec class</a>, many of the usage patterns are similar. You can easily adjust the dimension of the representation, the size of the sliding window, the number of workers, or almost any other parameter that you can change with the Word2Vec model.</p><p>The one exception to this rule are the parameters relating to the training method used by the model. In the word2vec architecture, the two algorithm names are “continuous bag of words” (cbow) and “skip-gram” (sg); in the doc2vec architecture, the corresponding algorithms are “distributed memory” (dm) and “distributed bag of words” (dbow). Since the distributed memory model performed noticeably better in the paper, that algorithm is the default when running Doc2Vec. You can still force the dbow model if you wish, by using the dm=0 flag in constructor.</p><p>The input to Doc2Vec is an iterator of <a href="http://radimrehurek.com/gensim/models/doc2vec.html#gensim.models.doc2vec.LabeledSentence">LabeledSentence objects</a>. “</p><p><strong>In the most updated version: LabeledSentence will be replaced by TaggedDocument (gensim.models.doc2vec.TaggedDocument)</strong></p><p>Basically, a document is represented by a <a href="https://radimrehurek.com/gensim/models/doc2vec.html#gensim.models.doc2vec.TaggedDocument">TaggedDocument Object</a>, consisting of 2 parts: tokens and tags (labels). For simplicity, for each document we only assign one label to distinguish with the others.</p><p><strong>Example</strong></p><p>We have documents = [&#39;this is a document&#39;, &#39;today i am good&#39;]</p><p>After preprocess we can tokenize them into: [[&#39;this&#39;, &#39;is&#39;, &#39;a&#39;, &#39;document&#39;], [&#39;today&#39;, &#39;i&#39;, &#39;am&#39;, &#39;good&#39;]]</p><p>After applying TaggedDocument <strong>class</strong> we have: [TaggedDocument(words=[&#39;this&#39;, &#39;is&#39;, &#39;a&#39;, &#39;document&#39;], tags=[&#39;TRAIN_0&#39;]), TaggedDocument(words=[&#39;today&#39;, &#39;i&#39;, &#39;am&#39;, &#39;good&#39;], tags=[&#39;TRAIN_1&#39;])]</p><h3>Define model and feed data</h3><p>Then we can easily define a Doc2Vec model and feed data into it. See here for details: <a href="https://radimrehurek.com/gensim/models/word2vec.html#gensim.models.word2vec.Word2Vec">https://radimrehurek.com/gensim/models/word2vec.html#gensim.models.word2vec.Word2Vec</a></p><ol><li>Define a model and hyper-parameters. Notes that we have 2 models: DM (default) and DBOW (dm = 0) in Doc2Vec.<br><em>“dm defines the training algorithm. By default (dm=1), ‘distributed memory’ (PV-DM) is used. Otherwise, distributed bag of words (PV-DBOW) is employed”</em></li><li>Build vocabulary</li><li>Train</li></ol><h3>Access vectors</h3><p>We can access vector of a certain document through it tagor its index, i.e. call method docvecs[tag_name] of gensim.models.Doc2Vec</p><h3>Refered hyper-parameters</h3><p><a href="https://arxiv.org/pdf/1607.05368.pdf">https://arxiv.org/pdf/1607.05368.pdf</a></p><p>Other materials:</p><p><a href="https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-IMDB.ipynb">https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-IMDB.ipynb</a></p><p><a href="https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-lee.ipynb">https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-lee.ipynb</a></p><p><a href="https://districtdatalabs.silvrback.com/modern-methods-for-sentiment-analysis">https://districtdatalabs.silvrback.com/modern-methods-for-sentiment-analysis</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9321c780079" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notes about ML]]></title>
            <link>https://medium.com/@gofortargets/notes-about-ml-1142e2f1bfc4?source=rss-ffd8c809ffb5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1142e2f1bfc4</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nguyen Tuan Anh]]></dc:creator>
            <pubDate>Tue, 11 Jul 2017 04:47:53 GMT</pubDate>
            <atom:updated>2017-09-08T11:01:00.049Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Don’t trust your feeling guts. Trust statistics instead. Don’t overlook an example and believe it is just a small portion of data.</li><li><a href="http://homes.cs.washington.edu/~pedrod/papers/cacm12.pdf">http://homes.cs.washington.edu/~pedrod/papers/cacm12.pdf</a></li><li>Mobi book on kindle: <a href="https://github.com/HFTrader/DeepLearningBook">https://github.com/HFTrader/DeepLearningBook</a></li><li><a href="http://www.trivedigaurav.com/blog/quoc-les-lectures-on-deep-learning/">My 3-hour lectures on deep learning</a>. My notes are divided into two parts: <a href="https://cs.stanford.edu/~quocle/tutorial1.pdf">Part1</a> and <a href="https://cs.stanford.edu/~quocle/tutorial2.pdf">Part 2</a>.</li><li>Weight in word2vec. Hierarchical softmax.</li><li><a href="https://www.analyticsvidhya.com/blog/2016/12/introduction-to-feature-selection-methods-with-an-example-or-how-to-select-the-right-variables/">https://www.analyticsvidhya.com/blog/2016/12/introduction-to-feature-selection-methods-with-an-example-or-how-to-select-the-right-variables/</a></li><li>Imbalance <a href="http://ieeexplore.ieee.org/document/5128907/?reload=true">http://ieeexplore.ieee.org/document/5128907/?reload=true</a></li><li><a href="https://machinelearning.apple.com/2017/07/07/GAN.html">https://machinelearning.apple.com/2017/07/07/GAN.html</a></li><li><a href="http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf">http://martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf</a></li><li><a href="https://courses.edx.org/courses/course-v1:CaltechX+CS1156x+3T2017/course/">https://courses.edx.org/courses/course-v1:CaltechX+CS1156x+3T2017/course/</a></li><li><a href="https://www.youtube.com/watch?v=XUj5JbQihlU&amp;index=15&amp;list=PLnIDYuXHkit4LcWjDe0EwlE57WiGlBs08">https://www.youtube.com/watch?v=XUj5JbQihlU&amp;index=15&amp;list=PLnIDYuXHkit4LcWjDe0EwlE57WiGlBs08</a></li><li><a href="https://www.youtube.com/watch?v=ltv1KjVLCdE&amp;index=56&amp;list=PLoRl3Ht4JOcdU872GhiYWf6jwrk_SNhz9">https://www.youtube.com/watch?v=ltv1KjVLCdE&amp;index=56&amp;list=PLoRl3Ht4JOcdU872GhiYWf6jwrk_SNhz9</a></li><li><a href="https://machinelearningmastery.com/adam-optimization-algorithm-for-deep-learning/">https://machinelearningmastery.com/adam-optimization-algorithm-for-deep-learning/</a></li><li><a href="http://16623.courses.cs.cmu.edu/">http://16623.courses.cs.cmu.edu/</a></li><li><a href="http://ai.stanford.edu/~hllee/icml07-selftaughtlearning.pdf">http://ai.stanford.edu/~hllee/icml07-selftaughtlearning.pdf</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1142e2f1bfc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>