CUSTOMER State
SDK code to create CUSTOMER_State¶
Feature description:
State of the customer
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 GROCERYCUSTOMER scd table.
grocerycustomer_view = catalog.get_view("GROCERYCUSTOMER")
# Get view from GROCERYCUSTOMER scd table.
grocerycustomer_view = catalog.get_view("GROCERYCUSTOMER")
In [ ]:
Copied!
# Create lookup feature from State column for customer entity.
customer_state =\
grocerycustomer_view["State"].as_feature("CUSTOMER_State")
# Create lookup feature from State column for customer entity.
customer_state =\
grocerycustomer_view["State"].as_feature("CUSTOMER_State")
Preview feature¶
Read on the feature primary entity concept
Read on the serving entity concept
In [ ]:
Copied!
#Check the primary entity of the feature'
customer_state.primary_entity
#Check the primary entity of the feature'
customer_state.primary_entity
In [ ]:
Copied!
#Get observation table: 'Preview Table with 10 Customers'
preview_table = catalog.get_observation_table(
"Preview Table with 10 Customers"
).to_pandas()
#Get observation table: 'Preview Table with 10 Customers'
preview_table = catalog.get_observation_table(
"Preview Table with 10 Customers"
).to_pandas()
In [ ]:
Copied!
#Preview CUSTOMER_State
customer_state.preview(
preview_table
)
#Preview CUSTOMER_State
customer_state.preview(
preview_table
)
Save feature¶
In [ ]:
Copied!
# Save feature
customer_state.save()
# Save feature
customer_state.save()
Add description and see feature definition file¶
In [ ]:
Copied!
# Add description
customer_state.update_description(
"State of the customer"
)
# See feature definition file
customer_state.definition
# Add description
customer_state.update_description(
"State of the customer"
)
# See feature definition file
customer_state.definition