Skip to main content

No project description provided

Project description

What this is

This is a special vectorization process and helper, using the vectorization-server as BE. It takes any arbitrary dictionary object and vectorizes all properties. index property is a string or integer value. The top index value, and input to vectorize function, is the name of the object you send in. If you don't want to specify anything specific then just leave it. It doesn't affect anything.

How to install

pip install -U vecsdk

How to use

from vecsdk import VectorizationServer, VectorGroup

vectorize = VectorizationServer(host="...", port=5678)
vector_group: VectorGroup = vectorize(
    data={
        'a': {
            'c': "hello",
            'd': 1.0,
        }, 
        'b': [
            {
                'e': "world",
                'f': 2.0,
            },
            {
                'g': "!",
                'h': 2.0,
            },
        ],
    },
    index="my_object",
) 

vector_group is a VectorGroup object which has the aggregate function. So to get one single vector representing the whole object you'll use vector_group.aggregate().

# Aggregate into a single vector representing the whole object
single_vector = vector_group.aggregate()

The aggregate function takes a weight dictionary object where you could weight certain properties to increase or decrease. The default aggregate function is the np.mean, but you can use whatever fits you.

# Adding some bias/weights to the final single vector representation
# In the end, 'a' aggregated vector property will have less effect on the final vector whereas 'g' will have large effect. Default weight value is 1.0.
biased_single_vector = vector_group.aggregate({'a': 0.2, 'g': 3})

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

vecsdk-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

vecsdk-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file vecsdk-0.1.1.tar.gz.

File metadata

  • Download URL: vecsdk-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Darwin/23.1.0

File hashes

Hashes for vecsdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2653f229a9973893130c43653af1700ff8ba4f2907502934b557908964053c64
MD5 cb268824377bf40e423aab625387f211
BLAKE2b-256 16788e03a6782d390f1bfeeffdb9f48b8642f797df0f76a1aa31f50e595840ac

See more details on using hashes here.

File details

Details for the file vecsdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vecsdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.20 Darwin/23.1.0

File hashes

Hashes for vecsdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8679ec734d8270229ad4a8822219c0f853ea9e7bccc14205c808d78dda7343eb
MD5 ff9ee1ea581276af8cf06edf6d0ab97e
BLAKE2b-256 64f1a0ca6b9f506d7583bea4c99d2c4e77ada8fd164e71f10963b62cdf51fcfb

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