Code Monkey home page Code Monkey logo

word2vec-explorer's Introduction

Word2Vec Explorer

This tool helps you visualize, query and explore Word2Vec models. Word2Vec is a deep learning technique that feeds massive amounts of text into a shallow neural net which can then be used to solve a variety of NLP and ML problems.

Word2Vec Explorer uses Gensim to list and compare vectors and it uses t-SNE to visualize a dimensional reduction of the vector space. Scikit-Learn is used for K-Means clustering.

The UI is built using React, Babel, Browserify, StandardJS, D3 and Three.js.

TSNE 10K

TSNE Labels

Vector Comparisons

Setup

To install all Python depenencies:

pip install -r requirements.txt

Usage

Load the explorer with a Word2Vec model:

./explore GoogleNews-vectors-negative300.bin

Now point your browser at localhost:8080 to load the explorer!

Obtaining Pre-Trained Models

A classic example of Word2Vec is the Google News model trained on 600M sentences: GoogleNews-vectors-negative300.bin.gz

[More pre-trained models]](https://github.com/3Top/word2vec-api#where-to-get-a-pretrained-models)

Development

In order to make changes to the user interface you will need some NPM dependencies:

npm install
npm start

The command npm start will automatically transpile and bundle any code changes in the ui/ folder. All backend code can be found in explorer.py and ./explore.

Before submitting code changes make sure all code is compliant with StandardJS as well as Pep8:

standard
pep8 --max-line-length=100 *.py explore

Todo

  • 3D GPU/WebGL view (on branch 3d)
  • Make sure axes stay when zooming/panning scatterplot
  • Autocomplete in query interface
  • Look into supporting other high dimensional data models (go beyond word vectors)
  • Drill-down of vector that shows real distance between neighbors
  • Improved sample rated view that takes into account term counts and connectedness

word2vec-explorer's People

Contributors

dominiek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

word2vec-explorer's Issues

Glove vectors?

Any pointers on how to load plain Glove vectors? Glove vector file is space delimited; looks like this:

unk -0.319700 -0.603714 -0.022415 0.100515 -0.165660 -0.743462 0.036367 0.109477 0.458140 -0.509268 -0.048532 0.042103 -0.133670 0.293152 0.100740 -0.367848 -0.001096 -0.558302 0.225355 0.452551 0.773366 0.898674 0.003075 -0.095132 0.336681 -0.654803 0.143790 -0.803718 1.692530 0.245232 0.357206 -0.078358 0.028932 -0.104397 0.254272 0.237046 0.319291 -0.477574 0.005739 0.016173 -0.285890 -0.311312 0.237824 -0.093700 0.168486 -0.442549 0.496937 0.028480 -0.800839 -0.279894

Installation error

errror:
Running setup.py install for tsne ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\akshayc\appdata\local\temp\pip-build-pduo9y\tsne\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\akshayc\appdata\local\temp\pip-rnvzez-record\install-record.txt --single-version-externally-managed --compile:
!!!!!!!!!!!!! ['tsne', 'tsne.tests']
c:\python27\lib\site-packages\setuptools\dist.py:285: UserWarning: Normalizing 'v0.1.5' to '0.1.5'
normalized_version,
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\tsne
copying tsne_version.py -> build\lib.win32-2.7\tsne
copying tsne_init_.py -> build\lib.win32-2.7\tsne
creating build\lib.win32-2.7\tsne\tests
copying tsne\tests\test_iris.py -> build\lib.win32-2.7\tsne\tests
copying tsne\tests_init_.py -> build\lib.win32-2.7\tsne\tests
UPDATING build\lib.win32-2.7\tsne/_version.py
set build\lib.win32-2.7\tsne/_version.py to 'v0.1.5'
running build_ext
building 'bh_sne' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\tsne
creating build\temp.win32-2.7\Release\tsne\bh_sne_src
C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -Ic:\python27\include -Ic:\python27\PC /Tptsne/bh_sne.cpp /Fobuild\temp.win32-2.7\Release\tsne/bh_sne.obj -msse2 -O3 -fPIC -w
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9002 : ignoring unknown option '-msse2'
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
bh_sne.cpp
c:\python27\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\lib\site-packages\numpy\core\include -I/usr/local/include -Itsne/bh_sne_src/ -Ic:\python27\include -Ic:\python27\PC /Tptsne/bh_sne_src/quadtree.cpp /Fobuild\temp.win32-2.7\Release\tsne/bh_sne_src/quadtree.obj -msse2 -O3 -fPIC -w
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9002 : ignoring unknown option '-msse2'
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
quadtree.cpp
tsne/bh_sne_src/quadtree.cpp(12) : fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory
error: command 'C:\Users\AkshayC\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

----------------------------------------

Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\akshayc\appdata\local\temp\pip-build-pduo9y\tsne\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\akshayc\appdata\local\temp\pip-rnvzez-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\akshayc\appdata\local\temp\pip-build-pduo9y\tsne\

Environment:
Windows: 10
python: 2.7
installationerrorword2vec

Cannot find bootstrap.css

Failed to load resource: the server responded with a status of 404 (Not Found)

I got this error and found that there are missing file "bootstrap.css"

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.