Features
Registering an Entity
Feature
Feature registration object.
Example
@ff.entity
class Customer:
# Register a column from a transformation as a feature
transaction_amount = ff.Feature(
fare_per_family_member[["CustomerID", "Amount", "Transaction Time"]],
variant="quickstart",
type=ff.Float64,
inference_store=redis,
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transformation_args |
tuple
|
A transformation or source function and the columns name in the format: |
required |
variant |
str
|
An optional variant name for the feature. |
''
|
type |
Union[ScalarType, str]
|
The type of the value in for the feature. |
required |
inference_store |
Union[str, OnlineProvider, FileStoreProvider]
|
Where to store for online serving. |
''
|
MultiFeature
Registering multiple features from the same table. The name of each feature is the name of the column in the table.
Example
# Register a file or table from an offline provider as a dataset
client = ff.Client()
df = client.dataframe(dataset)
@ff.entity
class Customer:
# Register multiple columns from a dataset as features
transaction_features = ff.MultiFeature(
dataset,
df,
variant="quickstart",
inference_store=redis,
entity_column="CustomerID",
timestamp_column="Timestamp",
exclude_columns=["TransactionID", "IsFraud"],
inference_store=redis,
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
SourceVariant
|
The dataset to register features from |
required |
df |
DataFrame
|
The client.dataframe to register features from |
required |
include_columns |
List[str]
|
List of columns to be registered as features |
None
|
exclude_columns |
List[str]
|
List of columns to be excluded from registration |
None
|
entity_column |
Union[Entity, str]
|
The name of the column in the source to be used as the entity |
required |
variant |
str
|
An optional variant name for the feature. |
''
|
inference_store |
Union[str, OnlineProvider, FileStoreProvider]
|
Where to store for online serving. |
''
|
Label
Label registration object.
Example
@ff.entity
class Customer:
# Register a column from a transformation as a label
transaction_amount = ff.Label(
fare_per_family_member[["CustomerID", "Amount", "Transaction Time"]],
variant="quickstart",
type=ff.Float64
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transformation_args |
tuple
|
A transformation or source function and the columns name in the format: |
required |
variant |
str
|
An optional variant name for the label. |
''
|
type |
Union[ScalarType, str]
|
The type of the value in for the label. |
required |
Embedding
Embedding Feature registration object.
Example
@ff.entity
class Speaker:
# Register a column from a transformation as a label
transaction_amount = ff.Embedding(
vectorize_comments[["PK", "Vector"]],
dims=384,
vector_db=pinecone,
description="Embeddings created from speakers' comments in episodes",
variant="v1"
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transformation_args |
tuple
|
A transformation or source function and the columns name in the format: |
required |
dims |
int
|
Dimensionality of the embedding. |
required |
vector_db |
Union[str, OnlineProvider]
|
The name of the vector database to store the embeddings in. |
required |
variant |
str
|
An optional variant name for the feature. |
''
|
description |
str
|
An optional description for the feature. |
''
|