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
Release history Release notifications | RSS feed
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.14.tar.gz
(169.3 kB
view details)
Built Distribution
nessvec-0.1.14-py3-none-any.whl
(192.7 kB
view details)
File details
Details for the file nessvec-0.1.14.tar.gz
.
File metadata
- Download URL: nessvec-0.1.14.tar.gz
- Upload date:
- Size: 169.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed962f13d5d0eb58a15bc2b079cadf4e4e99cfc86d315e8e00adfe54cee64296 |
|
MD5 | aa25c343ae70f665e0124c188372688a |
|
BLAKE2b-256 | 16570576b2b71d036bd2c13680199a74a775df56569aac2bc41208860ec8f16c |
Provenance
File details
Details for the file nessvec-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: nessvec-0.1.14-py3-none-any.whl
- Upload date:
- Size: 192.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d681013f4b1330b44b1fb3fc6655abec69b78e28d17faccd2f41fcf6f37c01f |
|
MD5 | 0936816851b6040d78590a46c66114ff |
|
BLAKE2b-256 | 2f95346fda2eee11fa41b4ace381cf405e656a9a3aa1600e6d3b9a504c744c19 |