9. Create Window Aggregates from Event Table
Creating Features from the Event Table¶
In this step, we define 21 features by aggregating events from the PRIOR_APPLICATIONS table within a 104-week window, after applying filters on the CONTRACT_STATUS and CONTRACT_TYPE columns.
1. Statistical Aggregations (Avg, Max, Min, Pct)¶
These features summarize prior applications using basic statistical functions:
Average (Avg)¶
CLIENT_Avg_of_Prior_Applications_CNT_PAYMENTs_104w
CLIENT_Avg_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w
CLIENT_Avg_of_Approved_Status_Prior_Applications_CNT_PAYMENTs_104w
Percentage (Pct)¶
CLIENT_Pct_of_Prior_Applications_is_Refused_Status_52w
CLIENT_Pct_of_Prior_Applications_is_Refused_Status_Cash_loans_Contract_type_104w
Maximum (Max)¶
CLIENT_Max_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w
CLIENT_Max_of_Prior_Applications_AMT_CREDIT_To_AMT_APPLICATIONs_104w
CLIENT_Max_of_Prior_Applications_Application-Credit_Gaps_104w
CLIENT_Max_of_Prior_Applications_CNT_PAYMENTs_104w
Minimum (Min)¶
CLIENT_Min_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_AMT_ANNUITY_To_AMT_CREDITs_104w
CLIENT_Min_of_Cash_loans_Contract_type_Prior_Applications_CNT_PAYMENTs_104w
2. Features Based on Latest Events and Time Since Last Event¶
These features track the most recent events and the time elapsed since the last recorded event:
Latest Event Values¶
CLIENT_Latest_Refused_Status_Cash_loans_Contract_type_Prior_Application_YIELD_GROUP_104w
CLIENT_Latest_Revolving_loans_Contract_type_Prior_Application_AMT_APPLICATION_104w
Time Since Latest Event¶
CLIENT_Time_Since_Latest_Prior_Application_DECISION_DATE_104w
3. Features Based on Inter-Event Time¶
These features measure the time intervals between successive prior applications:
CLIENT_Max_of_Time_between_2_Approved_Status_Prior_Applications_for_the_Client_104w
CLIENT_Max_of_Time_between_2_Prior_Applications_for_the_Client_104w
4. Aggregations Across YIELD_GROUP
¶
These features aggregate prior applications based on the YIELD_GROUP
category:
CLIENT_Approved_Status_Prior_Applications_AMT_CREDITs_by_Prior_Application_YIELD_GROUP_104w
CLIENT_Count_of_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w
CLIENT_Count_of_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w
5. Features Derived from Two Other Features¶
These features are computed as ratios or comparisons between two aggregated features:
CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_To_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w
CLIENT_vs_OVERALL_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w
Activate catalog¶
import featurebyte as fb
# Set your profile to the tutorial environment
fb.use_profile("tutorial")
catalog_name = "Credit Default Dataset SDK Tutorial"
catalog = fb.Catalog.activate(catalog_name)
16:42:02 | WARNING | Service endpoint is inaccessible: http://featurebyte-server:8088/ 16:42:02 | INFO | Using profile: tutorial 16:42:02 | INFO | Using configuration file at: /Users/gxav/.featurebyte/config.yaml 16:42:02 | INFO | Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) 16:42:02 | INFO | SDK version: 2.1.0.dev113 16:42:02 | INFO | No catalog activated. 16:42:02 | INFO | Catalog activated: Credit Default Dataset SDK Tutorial
Get view from table¶
# Get view from PRIOR_APPLICATIONS event table.
prior_applications_view = catalog.get_view("PRIOR_APPLICATIONS")
Create ratio and difference columns¶
prior_applications_view["AMT_ANNUITY To AMT_CREDIT"] = (
prior_applications_view["AMT_ANNUITY"] / prior_applications_view["AMT_CREDIT"]
)
prior_applications_view["AMT_CREDIT To AMT_APPLICATION"] = (
prior_applications_view["AMT_CREDIT"] / prior_applications_view["AMT_APPLICATION"]
)
prior_applications_view["Application-Credit Gap"] = (
prior_applications_view["AMT_APPLICATION"] - prior_applications_view["AMT_CREDIT"]
)
Filter View¶
Read on view subsetting
# Filter prior_applications_view with CONTRACT_STATUS equal to Approved.
cond = prior_applications_view["CONTRACT_STATUS"] == "Approved"
prior_applications_approved_status_view = prior_applications_view[cond]
# Filter prior_applications_view with CONTRACT_TYPE equal to Revolving loans.
cond = prior_applications_view["CONTRACT_TYPE"] == "Revolving loans"
prior_applications_revolving_loans_contract_type_view = prior_applications_view[cond]
# Filter prior_applications_view with CONTRACT_TYPE equal to Cash loans.
cond = prior_applications_view["CONTRACT_TYPE"] == "Cash loans"
prior_applications_cash_loans_contract_type_view = prior_applications_view[cond]
# Filter prior_applications_view with CONTRACT_STATUS equal to Refused.
cond = prior_applications_view["CONTRACT_STATUS"] == "Refused"
prior_applications_view["is Refused Status"] = cond.astype(int)
# Filter prior_applications_view with CONTRACT_STATUS equal to Approved and CONTRACT_TYPE equal to Cash loans.
cond = prior_applications_view["CONTRACT_STATUS"] == "Approved"
cond &= prior_applications_view["CONTRACT_TYPE"] == "Cash loans"
prior_applications_approved_status_cash_loans_contract_type_view = prior_applications_view[cond]
# Filter prior_applications_view with CONTRACT_STATUS equal to Refused and CONTRACT_TYPE equal to Cash loans.
cond = prior_applications_view["CONTRACT_STATUS"] == "Refused"
cond &= prior_applications_view["CONTRACT_TYPE"] == "Cash loans"
prior_applications_refused_status_cash_loans_contract_type_view = prior_applications_view[cond]
Create Flag column¶
# Flag CONTRACT_STATUS equal to Refused and CONTRACT_TYPE equal to Cash loans.
cond = prior_applications_view["CONTRACT_STATUS"] == "Refused"
cond &= prior_applications_view["CONTRACT_TYPE"] == "Cash loans"
prior_applications_view["is Refused Status Cash loans Contract_type"] = cond.astype(int)
Derive Inter-Event Time columns¶
# Extract InterEventTime by Client
prior_applications_view["Time between 2 Prior Applications for the Client"] = (
prior_applications_view["DECISION_DATE"]
- prior_applications_view["DECISION_DATE"].lag("CLIENT_ID")
).dt.day
# Extract InterEventTime by Client
prior_applications_approved_status_view[
"Time between 2 Approved Status Prior Applications for the Client"
] = (
prior_applications_approved_status_view["DECISION_DATE"]
- prior_applications_approved_status_view["DECISION_DATE"].lag("CLIENT_ID")
).dt.day
Do window aggregation from PRIOR_APPLICATIONS¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group PRIOR_APPLICATIONS view by Client entity (CLIENT_ID).
prior_applications_view_by_client = prior_applications_view.groupby(["CLIENT_ID"])
# Get Latest Prior Application's DECISION_DATE for the Client over a 104w period.
client_latest_prior_application_decision_date_104w = (
prior_applications_view_by_client.aggregate_over(
"DECISION_DATE",
method="latest",
feature_names=["CLIENT_Latest_Prior_Application_DECISION_DATE_104w"],
windows=["104w"],
)["CLIENT_Latest_Prior_Application_DECISION_DATE_104w"]
)
# Get Avg of CNT_PAYMENT for the Client over time.
client_avg_of_prior_applications_cnt_payments_104w = (
prior_applications_view_by_client.aggregate_over(
"CNT_PAYMENT",
method="avg",
feature_names=["CLIENT_Avg_of_Prior_Applications_CNT_PAYMENTs_104w"],
windows=["104w"],
)["CLIENT_Avg_of_Prior_Applications_CNT_PAYMENTs_104w"]
)
# Get Max of CNT_PAYMENT for the Client over time.
client_max_of_prior_applications_cnt_payments_104w = (
prior_applications_view_by_client.aggregate_over(
"CNT_PAYMENT",
method="max",
feature_names=["CLIENT_Max_of_Prior_Applications_CNT_PAYMENTs_104w"],
windows=["104w"],
)["CLIENT_Max_of_Prior_Applications_CNT_PAYMENTs_104w"]
)
# Get Max of AMT_CREDIT To AMT_APPLICATION for the Client over time.
client_max_of_prior_applications_amt_credit_to_amt_applications_104w = (
prior_applications_view_by_client.aggregate_over(
"AMT_CREDIT To AMT_APPLICATION",
method="max",
feature_names=[
"CLIENT_Max_of_Prior_Applications_AMT_CREDIT_To_AMT_APPLICATIONs_104w"
],
windows=["104w"],
)["CLIENT_Max_of_Prior_Applications_AMT_CREDIT_To_AMT_APPLICATIONs_104w"]
)
# Get Max of Application-Credit Gap for the Client over time.
client_max_of_prior_applications_application_credit_gaps_104w = (
prior_applications_view_by_client.aggregate_over(
"Application-Credit Gap",
method="max",
feature_names=["CLIENT_Max_of_Prior_Applications_Application-Credit_Gaps_104w"],
windows=["104w"],
)["CLIENT_Max_of_Prior_Applications_Application-Credit_Gaps_104w"]
)
# Get Pct of is Refused Status for the Client over time.
client_pct_of_prior_applications_is_refused_status_52w = (
prior_applications_view_by_client.aggregate_over(
"is Refused Status",
method="avg",
feature_names=["CLIENT_Pct_of_Prior_Applications_is_Refused_Status_52w"],
windows=["52w"],
)["CLIENT_Pct_of_Prior_Applications_is_Refused_Status_52w"]
)
# Get Pct of is Refused Status Cash loans Contract_type for the Client over time.
client_pct_of_prior_applications_is_refused_status_cash_loans_contract_type_104w = (
prior_applications_view_by_client.aggregate_over(
"is Refused Status Cash loans Contract_type",
method="avg",
feature_names=[
"CLIENT_Pct_of_Prior_Applications_is_Refused_Status_Cash_loans_Contract_type_104w"
],
windows=["104w"],
)["CLIENT_Pct_of_Prior_Applications_is_Refused_Status_Cash_loans_Contract_type_104w"]
)
# Group PRIOR_APPLICATIONS view by Client entity (CLIENT_ID) across different YIELD_GROUPs.
prior_applications_view_by_client_across_yield_groups = prior_applications_view.groupby(
["CLIENT_ID"], category="YIELD_GROUP"
)
# Count Prior Applications across different YIELD_GROUPs for the Client over time.
client_count_of_prior_applications_by_prior_application_yield_group_104w = (
prior_applications_view_by_client_across_yield_groups.aggregate_over(
None,
method="count",
feature_names=[
"CLIENT_Count_of_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w"
],
windows=["104w"],
)["CLIENT_Count_of_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w"]
)
Do window aggregation from prior_applications_approved_status_cash_loans_contract_type_view¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group prior_applications_approved_status_cash_loans_contract_type_view view by Client entity (CLIENT_ID).
prior_applications_approved_status_cash_loans_contract_type_view_by_client = (
prior_applications_approved_status_cash_loans_contract_type_view.groupby(
["CLIENT_ID"]
)
)
# Get Min of Approved Status Cash loans Contract_type AMT_ANNUITY To AMT_CREDIT for the Client over
# time.
client_min_of_approved_status_cash_loans_contract_type_prior_applications_amt_annuity_to_amt_credits_104w = (
prior_applications_approved_status_cash_loans_contract_type_view_by_client.aggregate_over(
"AMT_ANNUITY To AMT_CREDIT",
method="min",
feature_names=[
"CLIENT_Min_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_AMT_ANNUITY_To_AMT_CREDITs_104w"
],
windows=["104w"],
)["CLIENT_Min_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_AMT_ANNUITY_To_AMT_CREDITs_104w"]
)
# Group prior_applications_approved_status_cash_loans_contract_type_view view by Client entity
# (CLIENT_ID) across different PRODUCT_COMBINATIONs.
prior_applications_approved_status_cash_loans_contract_type_view_by_client_across_product_combinations = (
prior_applications_approved_status_cash_loans_contract_type_view.groupby(
["CLIENT_ID"], category="PRODUCT_COMBINATION"
)
)
# Count Approved Status Cash loans Contract_type Prior Applications across different
# PRODUCT_COMBINATIONs for the Client over time.
client_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w = (
prior_applications_approved_status_cash_loans_contract_type_view_by_client_across_product_combinations.aggregate_over(
None,
method="count",
feature_names=[
"CLIENT_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w"
],
windows=["104w"],
)["CLIENT_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w"]
)
# Group prior_applications_approved_status_cash_loans_contract_type_view view across different
# PRODUCT_COMBINATIONs.
prior_applications_approved_status_cash_loans_contract_type_view_by_overall_across_product_combinations = (
prior_applications_approved_status_cash_loans_contract_type_view.groupby(
[], category="PRODUCT_COMBINATION"
)
)
# Count Approved Status Cash loans Contract_type Prior Applications across different
# PRODUCT_COMBINATIONs over time.
overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w = (
prior_applications_approved_status_cash_loans_contract_type_view_by_overall_across_product_combinations.aggregate_over(
None,
method="count",
feature_names=[
"OVERALL_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w"
],
windows=["104w"],
)["OVERALL_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w"]
)
Do window aggregation from prior_applications_approved_status_view¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group prior_applications_approved_status_view view by Client entity (CLIENT_ID).
prior_applications_approved_status_view_by_client = (
prior_applications_approved_status_view.groupby(["CLIENT_ID"])
)
# Get Avg of Approved Status AMT_ANNUITY for the Client over time.
client_avg_of_approved_status_prior_applications_amt_annuitys_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"AMT_ANNUITY",
method="avg",
feature_names=[
"CLIENT_Avg_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"
],
windows=["104w"],
)["CLIENT_Avg_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"]
)
# Get Max of Approved Status AMT_ANNUITY for the Client over time.
client_max_of_approved_status_prior_applications_amt_annuitys_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"AMT_ANNUITY",
method="max",
feature_names=[
"CLIENT_Max_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"
],
windows=["104w"],
)["CLIENT_Max_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"]
)
# Get Sum of Approved Status AMT_ANNUITY for the Client over time.
client_sum_of_approved_status_prior_applications_amt_annuitys_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"AMT_ANNUITY",
method="sum",
feature_names=[
"CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"
],
windows=["104w"],
)["CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w"]
)
# Get Sum of Approved Status AMT_CREDIT for the Client over time.
client_sum_of_approved_status_prior_applications_amt_credits_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"AMT_CREDIT",
method="sum",
feature_names=[
"CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w"
],
windows=["104w"],
)["CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w"]
)
# Get Avg of Approved Status CNT_PAYMENT for the Client over time.
client_avg_of_approved_status_prior_applications_cnt_payments_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"CNT_PAYMENT",
method="avg",
feature_names=[
"CLIENT_Avg_of_Approved_Status_Prior_Applications_CNT_PAYMENTs_104w"
],
windows=["104w"],
)["CLIENT_Avg_of_Approved_Status_Prior_Applications_CNT_PAYMENTs_104w"]
)
# Group prior_applications_approved_status_view view by Client entity (CLIENT_ID) across different
# YIELD_GROUPs.
prior_applications_approved_status_view_by_client_across_yield_groups = (
prior_applications_approved_status_view.groupby(
["CLIENT_ID"], category="YIELD_GROUP"
)
)
# Distribution of the total AMT_CREDITs of Approved Status Prior Applications, segmented by Prior
# Application's YIELD_GROUP for the Client over time.
client_approved_status_prior_applications_amt_credits_by_prior_application_yield_group_104w = (
prior_applications_approved_status_view_by_client_across_yield_groups.aggregate_over(
"AMT_CREDIT",
method="sum",
feature_names=[
"CLIENT_Approved_Status_Prior_Applications_AMT_CREDITs_by_Prior_Application_YIELD_GROUP_104w"
],
windows=["104w"],
)["CLIENT_Approved_Status_Prior_Applications_AMT_CREDITs_by_Prior_Application_YIELD_GROUP_104w"]
)
Do window aggregation from prior_applications_refused_status_cash_loans_contract_type_view¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group prior_applications_refused_status_cash_loans_contract_type_view view by Client entity
# (CLIENT_ID).
prior_applications_refused_status_cash_loans_contract_type_view_by_client = (
prior_applications_refused_status_cash_loans_contract_type_view.groupby(
["CLIENT_ID"]
)
)
# Get Latest Refused Status Cash loans Contract_type Prior Application's YIELD_GROUP for the Client
# over a 104w period.
client_latest_refused_status_cash_loans_contract_type_prior_application_yield_group_104w = (
prior_applications_refused_status_cash_loans_contract_type_view_by_client.aggregate_over(
"YIELD_GROUP",
method="latest",
feature_names=[
"CLIENT_Latest_Refused_Status_Cash_loans_Contract_type_Prior_Application_YIELD_GROUP_104w"
],
windows=["104w"],
)["CLIENT_Latest_Refused_Status_Cash_loans_Contract_type_Prior_Application_YIELD_GROUP_104w"]
)
Do window aggregation from prior_applications_revolving_loans_contract_type_view¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group prior_applications_revolving_loans_contract_type_view view by Client entity (CLIENT_ID).
prior_applications_revolving_loans_contract_type_view_by_client = (
prior_applications_revolving_loans_contract_type_view.groupby(["CLIENT_ID"])
)
# Get Latest Revolving loans Contract_type Prior Application's AMT_APPLICATION for the Client over
# a 104w period.
client_latest_revolving_loans_contract_type_prior_application_amt_application_104w = (
prior_applications_revolving_loans_contract_type_view_by_client.aggregate_over(
"AMT_APPLICATION",
method="latest",
feature_names=[
"CLIENT_Latest_Revolving_loans_Contract_type_Prior_Application_AMT_APPLICATION_104w"
],
windows=["104w"],
)["CLIENT_Latest_Revolving_loans_Contract_type_Prior_Application_AMT_APPLICATION_104w"]
)
Do window aggregation from prior_applications_cash_loans_contract_type_view¶
See SDK reference for features
See SDK reference to groupby a view
See SDK reference to do aggregation over time
# Group prior_applications_cash_loans_contract_type_view view by Client entity (CLIENT_ID).
prior_applications_cash_loans_contract_type_view_by_client = (
prior_applications_cash_loans_contract_type_view.groupby(["CLIENT_ID"])
)
# Get Min of Cash loans Contract_type CNT_PAYMENT for the Client over time.
client_min_of_cash_loans_contract_type_prior_applications_cnt_payments_104w = (
prior_applications_cash_loans_contract_type_view_by_client.aggregate_over(
"CNT_PAYMENT",
method="min",
feature_names=[
"CLIENT_Min_of_Cash_loans_Contract_type_Prior_Applications_CNT_PAYMENTs_104w"
],
windows=["104w"],
)["CLIENT_Min_of_Cash_loans_Contract_type_Prior_Applications_CNT_PAYMENTs_104w"]
)
# Group prior_applications_cash_loans_contract_type_view view by Client entity (CLIENT_ID) across
# different YIELD_GROUPs.
prior_applications_cash_loans_contract_type_view_by_client_across_yield_groups = (
prior_applications_cash_loans_contract_type_view.groupby(
["CLIENT_ID"], category="YIELD_GROUP"
)
)
# Count Cash loans Contract_type Prior Applications across different YIELD_GROUPs for the Client
# over time.
client_count_of_cash_loans_contract_type_prior_applications_by_prior_application_yield_group_104w = (
prior_applications_cash_loans_contract_type_view_by_client_across_yield_groups.aggregate_over(
None,
method="count",
feature_names=[
"CLIENT_Count_of_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w"
],
windows=["104w"],
)["CLIENT_Count_of_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_YIELD_GROUP_104w"]
)
Derive Time Since feature from latest timestamp¶
# Compare CLIENT_Latest_Prior_Application_DECISION_DATE_104w with point-in-time in days
client_time_since_latest_prior_application_decision_date_104w = (
fb.RequestColumn.point_in_time()
- client_latest_prior_application_decision_date_104w
).dt.day
# Give a name to new feature
client_time_since_latest_prior_application_decision_date_104w.name = (
"CLIENT_Time_Since_Latest_Prior_Application_DECISION_DATE_104w"
)
Derive A Ratio from two features¶
# Get the Ratio of CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w To
# CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w
client_sum_of_approved_status_prior_applications_amt_annuitys_to_sum_of_approved_status_prior_applications_amt_credits_104w = (
client_sum_of_approved_status_prior_applications_amt_annuitys_104w
/ client_sum_of_approved_status_prior_applications_amt_credits_104w
)
# Give a name to new feature
client_sum_of_approved_status_prior_applications_amt_annuitys_to_sum_of_approved_status_prior_applications_amt_credits_104w.name = (
"CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_To_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w"
)
Derive Similarity feature across entities¶
# Derive Similarity feature from cosine similarity between
# CLIENT_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w
# and OVERALL_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w
client_vs_overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w = (
client_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w.cd.cosine_similarity(
overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w
)
)
# Give a name to new feature
client_vs_overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w.name = (
"CLIENT_vs_OVERALL_Count_of_Approved_Status_Cash_loans_Contract_type_Prior_Applications_by_Prior_Application_PRODUCT_COMBINATION_104w"
)
Create feature from Inter-Event Time¶
# Get Max of Time between 2 Prior Applications for the Client over time.
client_max_of_time_between_2_prior_applications_for_the_client_104w = (
prior_applications_view_by_client.aggregate_over(
"Time between 2 Prior Applications for the Client",
method="max",
feature_names=[
"CLIENT_Max_of_Time_between_2_Prior_Applications_for_the_Client_104w"
],
windows=["104w"],
)["CLIENT_Max_of_Time_between_2_Prior_Applications_for_the_Client_104w"]
)
# Get Max of Time between 2 Approved Status Prior Applications for the Client over time.
client_max_of_time_between_2_approved_status_prior_applications_for_the_client_104w = (
prior_applications_approved_status_view_by_client.aggregate_over(
"Time between 2 Approved Status Prior Applications for the Client",
method="max",
feature_names=[
"CLIENT_Max_of_Time_between_2_Approved_Status_Prior_Applications_for_the_Client_104w"
],
windows=["104w"],
)["CLIENT_Max_of_Time_between_2_Approved_Status_Prior_Applications_for_the_Client_104w"]
)
fb.FeatureGroup(
[
client_vs_overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w,
client_time_since_latest_prior_application_decision_date_104w,
client_sum_of_approved_status_prior_applications_amt_annuitys_to_sum_of_approved_status_prior_applications_amt_credits_104w,
client_pct_of_prior_applications_is_refused_status_cash_loans_contract_type_104w,
client_pct_of_prior_applications_is_refused_status_52w,
client_max_of_prior_applications_cnt_payments_104w,
client_max_of_prior_applications_application_credit_gaps_104w,
client_max_of_prior_applications_amt_credit_to_amt_applications_104w,
client_min_of_cash_loans_contract_type_prior_applications_cnt_payments_104w,
client_max_of_approved_status_prior_applications_amt_annuitys_104w,
client_min_of_approved_status_cash_loans_contract_type_prior_applications_amt_annuity_to_amt_credits_104w,
client_latest_revolving_loans_contract_type_prior_application_amt_application_104w,
client_max_of_time_between_2_prior_applications_for_the_client_104w,
client_max_of_time_between_2_approved_status_prior_applications_for_the_client_104w,
client_latest_refused_status_cash_loans_contract_type_prior_application_yield_group_104w,
client_count_of_prior_applications_by_prior_application_yield_group_104w,
client_count_of_cash_loans_contract_type_prior_applications_by_prior_application_yield_group_104w,
client_avg_of_prior_applications_cnt_payments_104w,
client_avg_of_approved_status_prior_applications_cnt_payments_104w,
client_avg_of_approved_status_prior_applications_amt_annuitys_104w,
client_approved_status_prior_applications_amt_credits_by_prior_application_yield_group_104w,
]
).save()
Done! |████████████████████████████████████████| 100% in 12.2s (0.08%/s) Done! |████████████████████████████████████████| 100% in 6.1s (0.17%/s) Loading Feature(s) |████████████████████████████████████████| 21/21 [100%] in 0.
Add description¶
client_vs_overall_count_of_approved_status_cash_loans_contract_type_prior_applications_by_prior_application_product_combination_104w.update_description(
"Similarity between an individual Client and other Clients by "
"calculating the Cosine Similarity between the Count of Approved Status"
" Cash loans Contract_type Prior Applications across different Prior "
"Application PRODUCT_COMBINATION categories for both the Client and all"
" Clients over a 104w period."
)
client_time_since_latest_prior_application_decision_date_104w.update_description(
"Time (in days) Since Latest Prior Application's DECISION_DATE for the "
"Client over a 104w period."
)
client_sum_of_approved_status_prior_applications_amt_annuitys_to_sum_of_approved_status_prior_applications_amt_credits_104w.update_description(
"Ratio of "
"CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_ANNUITYs_104w To "
"CLIENT_Sum_of_Approved_Status_Prior_Applications_AMT_CREDITs_104w"
)
client_pct_of_prior_applications_is_refused_status_cash_loans_contract_type_104w.update_description(
"Pct of Prior Applications is Refused Status Cash loans Contract_type "
"for the Client over a 104w period."
)
client_pct_of_prior_applications_is_refused_status_52w.update_description(
"Pct of Prior Applications is Refused Status for the Client over a 52w " "period."
)
client_max_of_prior_applications_cnt_payments_104w.update_description(
"Max of Prior Applications CNT_PAYMENTs for the Client over a 104w " "period."
)
client_max_of_prior_applications_application_credit_gaps_104w.update_description(
"Max of Prior Applications Application-Credit Gaps for the Client over "
"a 104w period."
)
client_max_of_prior_applications_amt_credit_to_amt_applications_104w.update_description(
"Max of Prior Applications AMT_CREDIT To AMT_APPLICATIONs for the "
"Client over a 104w period."
)
client_min_of_cash_loans_contract_type_prior_applications_cnt_payments_104w.update_description(
"Min of Cash loans Contract_type Prior Applications CNT_PAYMENTs for "
"the Client over a 104w period."
)
client_max_of_approved_status_prior_applications_amt_annuitys_104w.update_description(
"Max of Approved Status Prior Applications AMT_ANNUITYs for the Client "
"over a 104w period."
)
client_min_of_approved_status_cash_loans_contract_type_prior_applications_amt_annuity_to_amt_credits_104w.update_description(
"Min of Approved Status Cash loans Contract_type Prior Applications "
"AMT_ANNUITY To AMT_CREDITs for the Client over a 104w period."
)
client_latest_revolving_loans_contract_type_prior_application_amt_application_104w.update_description(
"Latest Revolving loans Contract_type Prior Application's "
"AMT_APPLICATION for the Client over a 104w period."
)
client_max_of_time_between_2_prior_applications_for_the_client_104w.update_description(
"Max of Time between 2 Prior Applications for the Client over a 104w " "period."
)
client_max_of_time_between_2_approved_status_prior_applications_for_the_client_104w.update_description(
"Max of Time between 2 Approved Status Prior Applications for the "
"Client over a 104w period."
)
client_latest_refused_status_cash_loans_contract_type_prior_application_yield_group_104w.update_description(
"Latest Refused Status Cash loans Contract_type Prior Application's "
"YIELD_GROUP for the Client over a 104w period."
)
client_count_of_prior_applications_by_prior_application_yield_group_104w.update_description(
"Count of Prior Applications across different Prior Application "
"YIELD_GROUP categories for the Client over a 104w period. It provides "
"a detailed breakdown in the form of a dictionary, where each key "
"represents a unique YIELD_GROUP. The corresponding value for each key "
"is the count within that YIELD_GROUP. This distribution offers "
"insights into the spread across different YIELD_GROUPs for the Client."
)
client_count_of_cash_loans_contract_type_prior_applications_by_prior_application_yield_group_104w.update_description(
"Count of Cash loans Contract_type Prior Applications across different "
"Prior Application YIELD_GROUP categories for the Client over a 104w "
"period. It provides a detailed breakdown in the form of a dictionary, "
"where each key represents a unique YIELD_GROUP. The corresponding "
"value for each key is the count within that YIELD_GROUP. This "
"distribution offers insights into the spread across different "
"YIELD_GROUPs for the Client."
)
client_avg_of_prior_applications_cnt_payments_104w.update_description(
"Avg of Prior Applications CNT_PAYMENTs for the Client over a 104w " "period."
)
client_avg_of_approved_status_prior_applications_cnt_payments_104w.update_description(
"Avg of Approved Status Prior Applications CNT_PAYMENTs for the Client "
"over a 104w period."
)
client_avg_of_approved_status_prior_applications_amt_annuitys_104w.update_description(
"Avg of Approved Status Prior Applications AMT_ANNUITYs for the Client "
"over a 104w period."
)
client_approved_status_prior_applications_amt_credits_by_prior_application_yield_group_104w.update_description(
"Distribution of the total AMT_CREDITs of Approved Status Prior "
"Applications, segmented by Prior Application's YIELD_GROUP for the "
"Client over a 104w period. It provides a detailed breakdown in the "
"form of a dictionary, where each key represents a unique YIELD_GROUP. "
"The corresponding value for each key is the cumulative sum of "
"AMT_CREDITs within that YIELD_GROUP. This distribution offers insights"
" into the AMT_CREDIT spread across different YIELD_GROUPs for the "
"Client."
)