All Projects → jeffThompson → Word2VecAndTsne

jeffThompson / Word2VecAndTsne

Licence: other
Scripts demo-ing how to train a Word2Vec model and reduce its vector space

Programming Languages

python
139335 projects - #7 most used programming language
processing
702 projects

Projects that are alternatives of or similar to Word2VecAndTsne

biovec
ProtVec can be used in protein interaction predictions, structure prediction, and protein data visualization.
Stars: ✭ 23 (-48.89%)
Mutual labels:  word2vec, gensim, tsne
Role2vec
A scalable Gensim implementation of "Learning Role-based Graph Embeddings" (IJCAI 2018).
Stars: ✭ 134 (+197.78%)
Mutual labels:  word2vec, sklearn, gensim
word-embeddings-from-scratch
Creating word embeddings from scratch and visualize them on TensorBoard. Using trained embeddings in Keras.
Stars: ✭ 22 (-51.11%)
Mutual labels:  word2vec, gensim
Turkish Word2vec
Pre-trained Word2Vec Model for Turkish
Stars: ✭ 136 (+202.22%)
Mutual labels:  word2vec, gensim
Webvectors
Web-ify your word2vec: framework to serve distributional semantic models online
Stars: ✭ 154 (+242.22%)
Mutual labels:  word2vec, gensim
Magnitude
A fast, efficient universal vector embedding utility package.
Stars: ✭ 1,394 (+2997.78%)
Mutual labels:  word2vec, gensim
Ml Projects
ML based projects such as Spam Classification, Time Series Analysis, Text Classification using Random Forest, Deep Learning, Bayesian, Xgboost in Python
Stars: ✭ 127 (+182.22%)
Mutual labels:  word2vec, gensim
Gemsec
The TensorFlow reference implementation of 'GEMSEC: Graph Embedding with Self Clustering' (ASONAM 2019).
Stars: ✭ 210 (+366.67%)
Mutual labels:  word2vec, gensim
Word2vec
訓練中文詞向量 Word2vec, Word2vec was created by a team of researchers led by Tomas Mikolov at Google.
Stars: ✭ 48 (+6.67%)
Mutual labels:  word2vec, gensim
Log Anomaly Detector
Log Anomaly Detection - Machine learning to detect abnormal events logs
Stars: ✭ 169 (+275.56%)
Mutual labels:  word2vec, gensim
Danmf
A sparsity aware implementation of "Deep Autoencoder-like Nonnegative Matrix Factorization for Community Detection" (CIKM 2018).
Stars: ✭ 161 (+257.78%)
Mutual labels:  word2vec, sklearn
Splitter
A Pytorch implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019).
Stars: ✭ 177 (+293.33%)
Mutual labels:  word2vec, gensim
Nlp Journey
Documents, papers and codes related to Natural Language Processing, including Topic Model, Word Embedding, Named Entity Recognition, Text Classificatin, Text Generation, Text Similarity, Machine Translation),etc. All codes are implemented intensorflow 2.0.
Stars: ✭ 1,290 (+2766.67%)
Mutual labels:  word2vec, gensim
Musae
The reference implementation of "Multi-scale Attributed Node Embedding".
Stars: ✭ 75 (+66.67%)
Mutual labels:  word2vec, gensim
Sense2vec
🦆 Contextually-keyed word vectors
Stars: ✭ 1,184 (+2531.11%)
Mutual labels:  word2vec, gensim
Wordembeddings Elmo Fasttext Word2vec
Using pre trained word embeddings (Fasttext, Word2Vec)
Stars: ✭ 146 (+224.44%)
Mutual labels:  word2vec, gensim
Aravec
AraVec is a pre-trained distributed word representation (word embedding) open source project which aims to provide the Arabic NLP research community with free to use and powerful word embedding models.
Stars: ✭ 239 (+431.11%)
Mutual labels:  word2vec, gensim
Twitter sentiment analysis word2vec convnet
Twitter Sentiment Analysis with Gensim Word2Vec and Keras Convolutional Network
Stars: ✭ 24 (-46.67%)
Mutual labels:  word2vec, gensim
Tadw
An implementation of "Network Representation Learning with Rich Text Information" (IJCAI '15).
Stars: ✭ 43 (-4.44%)
Mutual labels:  word2vec, gensim
Gensim
Topic Modelling for Humans
Stars: ✭ 12,763 (+28262.22%)
Mutual labels:  word2vec, gensim

WORD2VEC AND TSNE

Word2Vec is cool. So is tsne. But trying to figure out how to train a model and reduce the vector space can feel really, really complicated. I definitely found that to be the case, so here are some Python scripts meant to document how to start using these great tools, and to make it easier for you to use Word2Vec and tsne in your projects. If you make something cool with this code, please let me know!

(For a more detailed tutorial on how to use these scripts, see this blog post.)

CONTENTS

  • lib/: where you need to put rasterfairy and any other modules that you can't install with pip, etc
  • ModelsAndData/: where the 50kCommonWords.txt file is located, and where model files will be written to by default; also includes a sample trained on H.G. Wells' Time Machine
  • SampleOutput/: a sample output from a Wikipedia dump (trained including parts-of-speech), reduced to 2D
  • TagTextForTraining.py: splits a text into words, then gets their part-of-speech – useful for preserving different senses of a word
  • TrainModel.py: first script to run, which trains a Word2Vec model on a text file
  • TsneToGrid.py: a final optional step, uses the rasterfairy module to convert the tsne vector space into an even grid
  • TwoStageReduce.py: second step, takes a Word2Vec model and reduces its vector space to N dimensions
  • VisualizeVectorSpace/: a Processing sketch for visualizing your flattened vector space

REQUIRED LIBRARIES

To use this code, you'll need to install some pretty hefty libraries. Luckily, they all install very easily.

  • gensim for Word2Vec
  • sklearn for its tsne implementation
  • numpy for handling the lists of vectors
  • Optional: rasterfairy for tsne-to-grid layout
  • Optional: pattern for part-of-speech tagging
  • Optional: Wikipedia Extractor to strip Wiki tags (if you're using a Wikipedia dump as your data source)

TO USE THIS CODE

Here's the basics, or see this blog post (if you make something cool with this code, please let me know!):

  1. Install the required libraries listed above and download a data set to train on
  2. Get an input text file to train on, such as a novel (a good place to start) or something larger like a Wikipedia data dump – note that larger files = much longer processing time
  3. Run TrainModel.py on your text file, which outputs a binary .model file
  4. Run TwoStageReduce.py on the .model file, which outputs several csv files containing your reduced model (an initial reduction run, the final run, and the final run with vectors normalized -1 to 1)
  5. Optionally, run TsneToGrid.py to convert your csv file to an even grid
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].