Skip to main content

Word embeddings with meaningful dimensions for better explainability.

Project description

nessvec

Install from Source (recommended)

Clone the repository with all the source code and data:

$ git clone git@gitlab.com:tangibleai/nessvec
$ cd nessvec

Create a conda environment and install the dependencies:

$ conda create -n nessvec 'python==3.9.7'
$ conda env update -n nessvec -f scripts/environment.yml
$ pip install -e .

Install from PyPi (only tested on Linux)

$ pip install nessvec

Get Started

>>> from nessvec.util import load_glove
>>> w2v = load_glove()
>>> seattle = w2v['seattle']
>>> seattle
array([-2.7303e-01,  8.5872e-01,  1.3546e-01,  8.3849e-01, ...
>>> portland = w2v['portland']
>>> portland
array([-0.78611  ,  1.2758   , -0.0036066,  0.54873  , -0.31474  ,...
>>> len(portland)
50
>>> from numpy.linalg import norm
>>> norm(portland)
4.417...
>>> portland.std()
0.615...
>>> cosine_similarity(seattle, portland)
0.84...
>>> cosine_similarity(portland, seattle)
0.84...

>>> from nessvec.util import cosine_similarity
>>> cosine_similarity(w2v['los_angeles'], w2v['mumbai'])
.5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nessvec-0.1.16.tar.gz (169.2 kB view details)

Uploaded Source

Built Distribution

nessvec-0.1.16-py3-none-any.whl (192.7 kB view details)

Uploaded Python 3

File details

Details for the file nessvec-0.1.16.tar.gz.

File metadata

  • Download URL: nessvec-0.1.16.tar.gz
  • Upload date:
  • Size: 169.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for nessvec-0.1.16.tar.gz
Algorithm Hash digest
SHA256 8e435a4c116f8878b959120e385a8103bb76db7cb01d21ae3432e0a9482f4338
MD5 f2f140db89336c7eba193a189f3d015d
BLAKE2b-256 59d3054c905eb1404311a8f23022e5c1df209fa48b6b97a40c2a378164b57448

See more details on using hashes here.

File details

Details for the file nessvec-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: nessvec-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 192.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for nessvec-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 35b28cb0ef873c83479b469a47547d05882dce0e1d5cd2b05539b4dc1ce75010
MD5 534d53f5d6bfd45026f94a12d72cd9d1
BLAKE2b-256 49666b1c13ed2c8c414d31656cf655161689632d001ce45a2399c6fef2eacbca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page