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 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, 'e' 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({'e': 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.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

vecsdk-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vecsdk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 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.0.tar.gz
Algorithm Hash digest
SHA256 74bf7dc8ed04e87d9f6b42af2cd4afabf4b1242b3e439a2ceed43b3adf3c37df
MD5 74ab9442c87a09b489121bf72c6beeb8
BLAKE2b-256 fcb370fd1a5bc20587c651059900f14df9123d82d5d14bd99e3f5a10fc532654

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vecsdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 829a4eb3f54975d58f077624fe6cafdc4342664c99fda92dc261e2b17938b75f
MD5 3b12e8773109940ab56119fe304942fa
BLAKE2b-256 4c97465202d88a002a284183bb8eea93ae5bad412ff28c368eb98c93639ae74b

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