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})
Release files for vecsdk 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vecsdk-0.1.2.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vecsdk-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / vecsdk-0.1.2.tar.gz
| Download URL | vecsdk-0.1.2.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95717e093b6e19c20544278ef61e17c0dd56cdd92a70f64c8a4ecc0ccf20f148
|
|
BLAKE2b-256 checksum How to use checksums |
87431c00ca709161ae937265cf7608ebac1f842553c4af0c3959529f6848cfc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.20 Darwin/23.1.0
|
Release files / vecsdk-0.1.2-py3-none-any.whl
| Download URL | vecsdk-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e859709587dad7abad3a333a288408cec73c921bc59506ff3af2412767cd42e3
|
|
BLAKE2b-256 checksum How to use checksums |
98ccde3a1f452ff2dd22b4081ef528d7f4e746bc6f835758af877ed7b0948fb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.20 Darwin/23.1.0
|