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)

# List all available models
print(vectorize.avaliable_models())

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

    # Change the model here...
    model="fasttext",
) 

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.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

vecsdk-0.1.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vecsdk-0.1.2.tar.gz
  • Upload date:
  • Size: 7.4 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.2.tar.gz
Algorithm Hash digest
SHA256 95717e093b6e19c20544278ef61e17c0dd56cdd92a70f64c8a4ecc0ccf20f148
MD5 f7582b8e469198c6dc2e3be77c5b8835
BLAKE2b-256 87431c00ca709161ae937265cf7608ebac1f842553c4af0c3959529f6848cfc4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vecsdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e859709587dad7abad3a333a288408cec73c921bc59506ff3af2412767cd42e3
MD5 02aa121ce0dc9872f401bb05503bf0b3
BLAKE2b-256 98ccde3a1f452ff2dd22b4081ef528d7f4e746bc6f835758af877ed7b0948fb2

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