Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define Embedding logical type for vector data #1871

Open
Rhett-Ying opened this issue Aug 8, 2024 · 0 comments
Open

Define Embedding logical type for vector data #1871

Rhett-Ying opened this issue Aug 8, 2024 · 0 comments

Comments

@Rhett-Ying
Copy link

Hi,

I am wondering if it's possible to add self-defined Embedding logical type into ww which represents vector data? I tried with below code but failed.

import pandas as pd
import numpy as np
import woodwork as ww
from woodwork.logical_types import LogicalType

class Embedding(LogicalType):
    primary_dtype = 'object'
    standard_tags = {'embedding', 'numeric'}

ww.type_system.add_type(Embedding)

df = pd.DataFrame(
    {
        "id": [0, 1, 2, 3],
        "code": ["012345412359", "122345712358", "012345412359", "012345412359"],
        'embedding_0': [np.array([1, 2, 3]), np.array([2, 3, 4]), np.array([3, 4, 5]), np.array([4, 5, 6])],
        'embedding_1': [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6]],
    }
)

with ww.config.with_options():
    df.ww.init()
df.ww
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant