ITEM Discount
SDK code to create ITEM_Discount¶
Feature description:
Discount of the item
In [ ]:
Copied!
import featurebyte as fb
fb.use_profile("tutorial")
import featurebyte as fb
fb.use_profile("tutorial")
Activate catalog¶
In [ ]:
Copied!
catalog = fb.Catalog.activate("Grocery Dataset Tutorial")
catalog = fb.Catalog.activate("Grocery Dataset Tutorial")
Get view from table¶
In [ ]:
Copied!
# Get view from INVOICEITEMS item table.
invoiceitems_view = catalog.get_view("INVOICEITEMS")
# Get view from INVOICEITEMS item table.
invoiceitems_view = catalog.get_view("INVOICEITEMS")
In [ ]:
Copied!
# Create lookup feature from Discount column for item entity.
item_discount =\
invoiceitems_view["Discount"].as_feature("ITEM_Discount")
# Create lookup feature from Discount column for item entity.
item_discount =\
invoiceitems_view["Discount"].as_feature("ITEM_Discount")
Preview feature¶
Read on the feature primary entity concept
Read on the serving entity concept
In [ ]:
Copied!
#Check the primary entity of the feature'
item_discount.primary_entity
#Check the primary entity of the feature'
item_discount.primary_entity
In [ ]:
Copied!
#Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table(
"Preview Table with 10 items"
).to_pandas()
#Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table(
"Preview Table with 10 items"
).to_pandas()
In [ ]:
Copied!
#Preview ITEM_Discount
item_discount.preview(
preview_table
)
#Preview ITEM_Discount
item_discount.preview(
preview_table
)
Save feature¶
In [ ]:
Copied!
# Save feature
item_discount.save()
# Save feature
item_discount.save()
Add description and see feature definition file¶
In [ ]:
Copied!
# Add description
item_discount.update_description(
"Discount of the item"
)
# See feature definition file
item_discount.definition
# Add description
item_discount.update_description(
"Discount of the item"
)
# See feature definition file
item_discount.definition