Skip to content

featurebyte.ItemTable.get_view

get_view(
event_suffix: Optional[str]=None,
view_mode: Literal[ViewMode.AUTO, ViewMode.MANUAL]="auto",
drop_column_names: Optional[List[str]]=None,
column_cleaning_operations: Optional[List[ColumnCleaningOperation]]=None,
event_drop_column_names: Optional[List[str]]=None,
event_column_cleaning_operations: Optional[List[ColumnCleaningOperation]]=None,
event_join_column_names: Optional[List[str]]=None
) -> ItemView

Description

Gets an ItemView object from an ItemTable object. Item views are typically used to create Lookup features for the item entity, to create Simple Aggregate features for the event entity or to create Aggregate Over a Window features for other entities.

You have the option to choose between two view construction modes: auto and manual, with auto being the default mode.

When using the auto mode, the data accessed through the view is cleaned based on the default cleaning operations specified in the catalog table and special columns such as the record creation timestamp that are not intended for feature engineering are not included in the view columns.

The event timestamp and event attributes representing entities in the related Event table are also automatically added to the ItemView.

In manual mode, the default cleaning operations are not applied, and you have the flexibility to define your own cleaning operations.

Parameters

  • event_suffix: Optional[str]
    A suffix to append on to the columns from the EventTable. This is useful to prevent column name collisions.

  • view_mode: Literal[ViewMode.AUTO, ViewMode.MANUAL]
    default: "auto"
    View mode to use. When auto, the view will be constructed with cleaning operations from the table, the record creation timestamp column will be dropped and the event timestamp, timezone offset, and columns representing entities from the EventView will be automatically added.

  • drop_column_names: Optional[List[str]]
    List of column names to drop (manual mode only).

  • column_cleaning_operations: Optional[List[ColumnCleaningOperation]]
    List of cleaning operations to apply per column in manual mode only. Each element in the list indicates the cleaning operations for a specific column. The association between this column and the cleaning operations is established via the ColumnCleaningOperation constructor.

  • event_drop_column_names: Optional[List[str]]
    List of column names to drop for the EventView (manual mode only).

  • event_column_cleaning_operations: Optional[List[ColumnCleaningOperation]]
    Column cleaning operations to apply to the EventView (manual mode only).

  • event_join_column_names: Optional[List[str]]
    List of column names to join from the EventView (manual mode only).

Returns

  • ItemView
    ItemView object constructed from the source table.

Examples

Get an ItemView in automated mode.

>>> item_table = catalog.get_table("INVOICEITEMS")
>>> item_view = item_table.get_view()
Get an ItemView in manual mode.

>>> item_table = catalog.get_table("INVOICEITEMS")
>>> item_view = item_table.get_view(
...   event_suffix=None,
...   view_mode="manual",
...   drop_column_names=[],
...   column_cleaning_operations=[
...     fb.ColumnCleaningOperation(
...       column_name="Discount",
...       cleaning_operations=[
...         fb.MissingValueImputation(imputed_value=0),
...         fb.ValueBeyondEndpointImputation(
...           type="less_than", end_point=0, imputed_value=None
...         ),
...       ],
...     )
...   ],
...   event_drop_column_names=["record_available_at"],
...   event_column_cleaning_operations=[],
...   event_join_column_names=[
...     "Timestamp",
...     "GroceryInvoiceGuid",
...     "GroceryCustomerGuid",
...   ],
... )