Skip to main content

Tool for creating document features

Project description

Vectors of Locally Aggregated Concepts (VLAC)

PyPI - Status PyPI - Python PyPI - Python

Purpose

As illustrated in the Figure below, VLAC clusters word embeddings to create k concepts. Due to the high dimensionality of word embeddings (i.e., 300) spherical k-means is used to perform the clustering as applying euclidean distance will result in little difference in the distances between samples. The method works as follows. Let wi be a word embedding of size D assigned to cluster center ck. Then, for each word in a document, VLAC computes the element-wise sum of residuals of each word embedding to its assigned cluster center. This results in k feature vectors, one for each concept, and all of size D. All feature vectors are then concatenated, power normalized, and finally, l2 normalization is applied. For example, if 10 concepts were to be created out of word embeddings of size 300 then the resulting document vector would contain 10 x 300 values.

Usage

Tested in python 3.5.4.

# Train model and transform collection of documents
vlac_model = VLAC(documents=train_docs, model=model, oov=False)
vlac_features, kmeans = vlac_model.fit_transform(num_concepts=30)

# Create features new documents
vlac_model = VLAC(documents=train_docs, model=model, oov=False)
test_features = vlac_model.transform(kmeans=kmeans)

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

Vectors of Locally Aggregate Concepts-0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file Vectors of Locally Aggregate Concepts-0.1.tar.gz.

File metadata

  • Download URL: Vectors of Locally Aggregate Concepts-0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for Vectors of Locally Aggregate Concepts-0.1.tar.gz
Algorithm Hash digest
SHA256 11ec6867b432497dbe42e4b2b79cd6e90929deffae34592fbbaffb2a9e6d8d5b
MD5 fbd22c37b8cfe602b98cb8e8f06901e9
BLAKE2b-256 cfe397582cb32c27e8a0563d5cc64b6f77c08322579faea1ef166197e7759279

See more details on using hashes here.

File details

Details for the file Vectors_of_Locally_Aggregate_Concepts-0.1-py3-none-any.whl.

File metadata

  • Download URL: Vectors_of_Locally_Aggregate_Concepts-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for Vectors_of_Locally_Aggregate_Concepts-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d86a9229135a8f3394a284b8acaf1cdc2a60de9262177f118656aa8069a698b
MD5 b2b69d124be33ece45ec4187c90e28dd
BLAKE2b-256 853eb7888528694ddd21dae631fd257b306c64825fc6d8bf9697daa4feec5f69

See more details on using hashes here.

Supported by

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