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 >>>