Add a component to FeatureStore | Teradata Package for Python - Add a component to FeatureStore - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
December 2024
ft:locale
en-US
ft:lastEdition
2025-01-23
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Use the apply() method to register the Feature, Entity, DataSource or FeatureGroup to a repo.

  • If you add FeatureGroup to FeatureStore, the underlying Features, Entity and DataSource are also added.
  • If any of the components already exists, then apply method updates the corresponding component properties.

Example: Adding a Feature to FeatureStore

Create a Feature for column 'Feb' from 'sales' DataFrame and register with repo 'vfs_v1'.

>>> from teradataml import Feature, FeatureStore
>>> feature = Feature('sales:Feb', df.Feb)
>>> fs = FeatureStore('vfs_v1')
>>> fs.apply(feature)
True
>>>

Example: Adding an Entity to FeatureStore

Create an Entity for 'sales' DataFrame and register with repo 'vfs_v1'.

>>> from teradataml import Entity, FeatureStore
>>> entity = Entity('sales:accounts', df.accounts)
>>> fs = FeatureStore('vfs_v1')
>>> fs.apply(entity)
True
>>>

Example: Adding a DataSource to FeatureStore

Create a DataSource for 'sales' DataFrame and register with repo 'vfs_v1'.

>>> from teradataml import DataSource, FeatureStore
>>> ds = DataSource('Sales_Data', df)
>>> fs = FeatureStore('vfs_v1')
>>> fs.apply(ds)
True
>>>

Example: Adding a FeatureGroup to FeatureStore

Create a FeatureStore with all objects created using the components in the previous examples and register with repo 'vfs_v1'.

>>> from teradataml import FeatureGroup, FeatureStore
>>> fg = FeatureGroup('Sales',
...                   features=feature,
...                   entity=entity,
...                   data_source=data_source)
>>> fs = FeatureStore('vfs_v1')
>>> fs.apply(fg)
True
>>>

Example: Create a Feature Group and add the Feature Group and associated Components to a FeatureStore

>>> load_example_data("byom", "iris_test")
>>> iris_df = DataFrame("iris_test")
>>> from teradataml import FeatureGroup, FeatureStore
>>> fg = FeatureGroup.from_DataFrame('iris_data', df=iris_df, entity_columns='id')
>>> fs = FeatureStore('vfs_v1')
>>> fs.apply(fg)
True
>>>