Decomposition of word embeddings (word vectors) into qualities ("ness"es) of interest
Project description
nessvec
Installation
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 nessvec3 'python==3.9.7'
$ conda env update -n nessvec -f environment.yml
$ pip install -e .
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.0.11rc0.tar.gz
(45.6 kB
view details)
Built Distribution
File details
Details for the file nessvec-0.0.11rc0.tar.gz
.
File metadata
- Download URL: nessvec-0.0.11rc0.tar.gz
- Upload date:
- Size: 45.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.23.0 setuptools/59.8.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f70d9bea0069bd28691cdfbf43890413a71ef3309e6696c0c1cef15a655c9b02 |
|
MD5 | 8bbbfeb07e4916e8bef6013ba8234b1c |
|
BLAKE2b-256 | 115d3c9e26c0b9f980ad50778921b9a4add05179dea841f74ca141245e463357 |
Provenance
File details
Details for the file nessvec-0.0.11rc0-py2.py3-none-any.whl
.
File metadata
- Download URL: nessvec-0.0.11rc0-py2.py3-none-any.whl
- Upload date:
- Size: 50.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.23.0 setuptools/59.8.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fce95ec17070c1ffc1fd37ef4a7e887d7ced522f356499786dfc7e0e3d328b54 |
|
MD5 | d9e5b8666eb12d85534fddd963810a89 |
|
BLAKE2b-256 | 779cb1e9fdcbfaf5ffe7c9140c6830d295947c1c5e0ad14617c3a53f83b0e664 |