Skip to content

Instantly share code, notes, and snippets.

@mikea
Created September 11, 2019 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikea/e01b5d5a66e362e3822f127154cda0a1 to your computer and use it in GitHub Desktop.
Save mikea/e01b5d5a66e362e3822f127154cda0a1 to your computer and use it in GitHub Desktop.
diff --git a/pipeline_v2/feature_schema.py b/pipeline_v2/feature_schema.py
index 680e231..2186c46 100644
--- a/pipeline_v2/feature_schema.py
+++ b/pipeline_v2/feature_schema.py
@@ -55,7 +55,7 @@ column_types = {
'risk_inputs_session_ccn_had_deletion': pd.Int64Dtype(),
'risk_inputs_billing_address_is_commercial': pd.Int64Dtype(),
'risk_inputs_billing_address_resident_is_deceased': pd.Int64Dtype(),
- 'risk_inputs_ip_to_distinct_auth_decline_reasons': pd.Int64Dtype(),
+ 'risk_inputs_ip_to_distinct_auth_decline_reasons': np.str,
'risk_inputs_shipping_address_matches_name': pd.Int64Dtype(),
'risk_inputs_ip_address_distance_from_address': pd.Int64Dtype(),
'risk_inputs_shipping_address_resident_name': pd.Int64Dtype(),
@@ -63,7 +63,7 @@ column_types = {
'risk_inputs_phone_is_valid': pd.Int64Dtype(),
'risk_inputs_email_to_distinct_bin_countries': np.str,
'risk_inputs_insufficient_data': pd.Int64Dtype(),
- 'risk_inputs_discount_amount': pd.Int64Dtype(),
+ 'risk_inputs_discount_amount': np.float64,
'risk_inputs_ip_to_distinct_bin_countries': np.str,
'risk_inputs_shipping_address_type': pd.Int64Dtype(),
'risk_inputs_ip_address_geolocation_country_code': pd.Int64Dtype(),
@@ -73,12 +73,12 @@ column_types = {
'risk_inputs_email_is_valid': pd.Int64Dtype(),
'risk_inputs_ip_address_first_trx': pd.Int64Dtype(),
'risk_inputs_email_num_lost_stolen_card_pickup_attempts': np.str,
- 'risk_inputs_email_to_distinct_auth_decline_reasons': pd.Int64Dtype(),
+ 'risk_inputs_email_to_distinct_auth_decline_reasons': np.str,
'risk_inputs_ip_address_recent_approved': pd.Int64Dtype(),
'risk_inputs_phone_line_type': np.str,
'risk_inputs_ip_address_most_recent_trx': pd.Int64Dtype(),
'risk_inputs_email_recent_decline': pd.Int64Dtype(),
- 'risk_inputs_email_to_distinct_bins': pd.Int64Dtype(),
+ 'risk_inputs_email_to_distinct_bins': np.str,
'risk_inputs_email_pattern_length_domain': pd.Int64Dtype(),
'risk_inputs_phone_is_prepaid': pd.Int64Dtype(),
'risk_inputs_email_num_auth_attempts': pd.Int64Dtype(),
@@ -90,7 +90,7 @@ column_types = {
'risk_inputs_email_pattern_length_local': pd.Int64Dtype(),
'risk_inputs_first_name': np.str,
'risk_inputs_bin_country': np.str,
- 'risk_inputs_shipping_amount': pd.Int64Dtype(),
+ 'risk_inputs_shipping_amount': np.float64,
'risk_inputs_email_variant': pd.Int64Dtype(),
'risk_inputs_created_weekday': np.str,
'risk_inputs_addresses_ship_and_bill_equal': np.str,
@@ -108,7 +108,7 @@ column_types = {
'risk_inputs_bin_bank': np.str,
'risk_inputs_ip_address_geolocation_country_name': pd.Int64Dtype(),
'risk_inputs_ip_address_recent_bolt_rejected': pd.Int64Dtype(),
- 'risk_inputs_amount': pd.Int64Dtype(),
+ 'risk_inputs_amount': np.float64,
'risk_inputs_email_pattern_num_digits': pd.Int64Dtype(),
'risk_inputs_user_agent': np.str,
'risk_inputs_recent_approved': np.str,
@@ -116,8 +116,8 @@ column_types = {
'risk_inputs_ip_to_distinct_cvv_result_codes': np.str,
'risk_inputs_email_root': np.str,
'risk_inputs_num_decline_reasons': pd.Int64Dtype(),
- 'risk_inputs_billing_address_resident_name': pd.Int64Dtype(),
- 'risk_inputs_card_token_to_distinct_auth_decline_reasons': pd.Int64Dtype(),
+ 'risk_inputs_billing_address_resident_name': np.str,
+ 'risk_inputs_card_token_to_distinct_auth_decline_reasons': np.str,
'risk_inputs_ip_address_geolocation': np.str,
'risk_inputs_bin_country_code': np.str,
'risk_inputs_card_token_recent_approved': pd.Int64Dtype(),
@@ -141,7 +141,7 @@ column_types = {
'risk_inputs_email_domain_creation_days': pd.Int64Dtype(),
'risk_inputs_phone_subscriber_is_deceased': np.str,
'risk_inputs_ip_address_num_auth_attempts': pd.Int64Dtype(),
- 'risk_inputs_cvv': pd.Int64Dtype(),
+ 'risk_inputs_cvv': np.str,
'risk_inputs_email_recent_trx': np.str,
'risk_inputs_email_first_trx': np.str,
'risk_inputs_bin_website': np.str,
@@ -176,106 +176,106 @@ column_types = {
'risk_inputs_shipping_country_code': pd.Int64Dtype(),
'risk_inputs_session_time_taken_first_character_to_checkout': pd.Int64Dtype(),
'risk_inputs_session_local_timezone_offset_minutes': pd.Int64Dtype(),
- 'verified_device_status': pd.Int64Dtype(),
- 'is_fraud': pd.Int64Dtype(),
- 'is_disputed': pd.Int64Dtype(),
- 'derived_email_auth_declines_contains_lost_stolen': np.str,
- 'derived_email_auth_declines_contains_call_issuer': np.str,
- 'derived_ip_auth_declines_contains_lost_stolen': np.str,
- 'derived_ip_auth_declines_contains_call_issuer': np.str,
- 'derived_token_auth_declines_contains_lost_stolen': np.str,
- 'derived_token_auth_declines_contains_call_issuer': np.str,
- 'derived_avs_text': np.str,
- 'derived_continent': np.str,
- 'derived_bin_ip_country_match': np.str,
- 'derived_bin_phone_country_match': np.str,
- 'derived_bin_shipping_country_match': np.str,
- 'derived_ip_phone_country_match': np.str,
- 'derived_ip_shipping_country_match': np.str,
- 'derived_phone_shipping_country_match': np.str,
- 'derived_cvv_text': np.str,
- 'derived_email_has_variant': np.str,
- 'derived_email_symbol_structure': np.str,
- 'derived_card_token_has_approval': np.str,
- 'derived_card_token_has_decline': np.str,
- 'derived_email_has_approval': np.str,
- 'derived_ip_has_transaction': np.str,
- 'derived_ip_has_decline': np.str,
- 'derived_email_has_bolt_reject': np.str,
- 'derived_email_has_transaction': np.str,
- 'derived_ip_has_bolt_reject': np.str,
- 'derived_ip_has_approval': np.str,
- 'derived_email_has_decline': np.str,
- 'derived_card_token_has_transaction': np.str,
- 'derived_card_token_has_bolt_reject': np.str,
- 'derived_has_insurance': np.str,
- 'derived_count_ip_distinct_auth_declines': np.str,
- 'derived_count_email_distinct_cvv_results': np.str,
- 'derived_count_email_distinct_bins': np.str,
- 'derived_count_email_distinct_bin_countries': pd.Int64Dtype(),
- 'derived_count_ip_distinct_cvv_results': np.str,
- 'derived_count_token_distinct_auth_declines': np.str,
- 'derived_count_email_distinct_auth_declines': pd.Int64Dtype(),
- 'derived_count_ip_distinct_bins': np.str,
- 'derived_count_email_distinct_postals': np.float64,
- 'derived_count_ip_distinct_bin_countries': np.float64,
- 'derived_count_token_distinct_cvv_results': np.float64,
- 'derived_first_name_in_email': np.str,
- 'derived_last_name_in_email': np.str,
- 'derived_first_name_capitalization': np.str,
- 'derived_first_name_length': np.float64,
- 'derived_first_name_has_number': np.str,
- 'derived_last_name_capitalization': np.str,
- 'derived_last_name_length': np.float64,
- 'derived_last_name_has_number': np.str,
- 'derived_discount_proportion': np.float64,
- 'derived_item_proportion': np.float64,
- 'derived_shipping_proportion': np.float64,
- 'derived_tax_proportion': np.float64,
- 'derived_days_since_card_token_first_trx': np.float64,
- 'derived_days_since_card_token_most_recent_trx': np.float64,
- 'derived_days_since_card_token_recent_approved': np.float64,
- 'derived_days_since_card_token_recent_bolt_rejected': np.float64,
- 'derived_days_since_card_token_recent_decline': np.float64,
- 'derived_days_since_email_first_trx': np.str,
- 'derived_days_since_email_recent_approved': np.str,
- 'derived_days_since_email_recent_bolt_rejected': np.str,
- 'derived_days_since_email_recent_decline': np.str,
- 'derived_days_since_email_recent_trx': np.float64,
- 'derived_days_since_ip_address_first_trx': np.float64,
- 'derived_days_since_ip_address_most_recent_trx': np.float64,
- 'derived_days_since_ip_address_recent_approved': np.float64,
- 'derived_days_since_ip_address_recent_bolt_rejected': np.str,
- 'derived_days_since_ip_address_recent_decline': np.float64,
- 'derived_seconds_since_cart_creation': pd.Int64Dtype(),
- 'derived_device_brand': np.str,
- 'derived_device_family': np.str,
- 'derived_device_model': np.str,
- 'derived_os_family': np.str,
- 'derived_os_major': pd.Int64Dtype(),
- 'derived_os_minor': pd.Int64Dtype(),
- 'derived_os_patch': pd.Int64Dtype(),
- 'derived_os_patch_minor': pd.Int64Dtype(),
- 'derived_user_agent_family': np.str,
- 'derived_user_agent_major': pd.Int64Dtype(),
- 'derived_user_agent_minor': pd.Int64Dtype(),
- 'derived_user_agent_patch': np.float64,
- 'transaction_id': pd.Int64Dtype(),
- 'transaction_amount': pd.Int64Dtype(),
- 'transaction_status': np.str,
- 'transaction_created_at': pd.Int64Dtype(),
- 'transaction_type': np.str,
- 'transaction_review_decision': np.str,
- 'dispute_initiator': pd.Int64Dtype(),
- 'dispute_liability': pd.Int64Dtype(),
- 'dispute_resolution': pd.Int64Dtype(),
- 'dispute_status': pd.Int64Dtype(),
- 'risk_label': pd.Int64Dtype(),
- 'risk_inputs_transaction_id': pd.Int64Dtype(),
- 'risk_inputs_addresses_billing_line1': np.str,
- 'risk_inputs_addresses_shipping_line1': pd.Int64Dtype(),
- 'risk_inputs_email_had_fraudulent_disputes': pd.Int64Dtype(),
- 'risk_inputs_email_had_successful_transactions': pd.Int64Dtype(),
- 'risk_inputs_shipping_region': pd.Int64Dtype(),
- 'risk_inputs_shipping_method': pd.Int64Dtype(),
+ # 'verified_device_status': np.str,
+ # 'is_fraud': pd.Int64Dtype(),
+ # 'is_disputed': pd.Int64Dtype(),
+ # 'derived_email_auth_declines_contains_lost_stolen': np.str,
+ # 'derived_email_auth_declines_contains_call_issuer': np.str,
+ # 'derived_ip_auth_declines_contains_lost_stolen': np.str,
+ # 'derived_ip_auth_declines_contains_call_issuer': np.str,
+ # 'derived_token_auth_declines_contains_lost_stolen': np.str,
+ # 'derived_token_auth_declines_contains_call_issuer': np.str,
+ # 'derived_avs_text': np.str,
+ # 'derived_continent': np.str,
+ # 'derived_bin_ip_country_match': np.str,
+ # 'derived_bin_phone_country_match': np.str,
+ # 'derived_bin_shipping_country_match': np.str,
+ # 'derived_ip_phone_country_match': np.str,
+ # 'derived_ip_shipping_country_match': np.str,
+ # 'derived_phone_shipping_country_match': np.str,
+ # 'derived_cvv_text': np.str,
+ # 'derived_email_has_variant': np.str,
+ # 'derived_email_symbol_structure': np.str,
+ # 'derived_card_token_has_approval': np.str,
+ # 'derived_card_token_has_decline': np.str,
+ # 'derived_email_has_approval': np.str,
+ # 'derived_ip_has_transaction': np.str,
+ # 'derived_ip_has_decline': np.str,
+ # 'derived_email_has_bolt_reject': np.str,
+ # 'derived_email_has_transaction': np.str,
+ # 'derived_ip_has_bolt_reject': np.str,
+ # 'derived_ip_has_approval': np.str,
+ # 'derived_email_has_decline': np.str,
+ # 'derived_card_token_has_transaction': np.str,
+ # 'derived_card_token_has_bolt_reject': np.str,
+ # 'derived_has_insurance': np.str,
+ # 'derived_count_ip_distinct_auth_declines': np.str,
+ # 'derived_count_email_distinct_cvv_results': np.str,
+ # 'derived_count_email_distinct_bins': np.str,
+ # 'derived_count_email_distinct_bin_countries': pd.Int64Dtype(),
+ # 'derived_count_ip_distinct_cvv_results': np.str,
+ # 'derived_count_token_distinct_auth_declines': np.str,
+ # 'derived_count_email_distinct_auth_declines': pd.Int64Dtype(),
+ # 'derived_count_ip_distinct_bins': np.str,
+ # 'derived_count_email_distinct_postals': np.float64,
+ # 'derived_count_ip_distinct_bin_countries': np.float64,
+ # 'derived_count_token_distinct_cvv_results': np.float64,
+ # 'derived_first_name_in_email': np.str,
+ # 'derived_last_name_in_email': np.str,
+ # 'derived_first_name_capitalization': np.str,
+ # 'derived_first_name_length': np.float64,
+ # 'derived_first_name_has_number': np.str,
+ # 'derived_last_name_capitalization': np.str,
+ # 'derived_last_name_length': np.float64,
+ # 'derived_last_name_has_number': np.str,
+ # 'derived_discount_proportion': np.float64,
+ # 'derived_item_proportion': np.float64,
+ # 'derived_shipping_proportion': np.float64,
+ # 'derived_tax_proportion': np.float64,
+ # 'derived_days_since_card_token_first_trx': np.float64,
+ # 'derived_days_since_card_token_most_recent_trx': np.float64,
+ # 'derived_days_since_card_token_recent_approved': np.float64,
+ # 'derived_days_since_card_token_recent_bolt_rejected': np.float64,
+ # 'derived_days_since_card_token_recent_decline': np.float64,
+ # 'derived_days_since_email_first_trx': np.str,
+ # 'derived_days_since_email_recent_approved': np.str,
+ # 'derived_days_since_email_recent_bolt_rejected': np.str,
+ # 'derived_days_since_email_recent_decline': np.str,
+ # 'derived_days_since_email_recent_trx': np.float64,
+ # 'derived_days_since_ip_address_first_trx': np.float64,
+ # 'derived_days_since_ip_address_most_recent_trx': np.float64,
+ # 'derived_days_since_ip_address_recent_approved': np.float64,
+ # 'derived_days_since_ip_address_recent_bolt_rejected': np.str,
+ # 'derived_days_since_ip_address_recent_decline': np.float64,
+ # 'derived_seconds_since_cart_creation': pd.Int64Dtype(),
+ # 'derived_device_brand': np.str,
+ # 'derived_device_family': np.str,
+ # 'derived_device_model': np.str,
+ # 'derived_os_family': np.str,
+ # 'derived_os_major': pd.Int64Dtype(),
+ # 'derived_os_minor': pd.Int64Dtype(),
+ # 'derived_os_patch': pd.Int64Dtype(),
+ # 'derived_os_patch_minor': pd.Int64Dtype(),
+ # 'derived_user_agent_family': np.str,
+ # 'derived_user_agent_major': pd.Int64Dtype(),
+ # 'derived_user_agent_minor': pd.Int64Dtype(),
+ # 'derived_user_agent_patch': np.float64,
+ # 'transaction_id': pd.Int64Dtype(),
+ # 'transaction_amount': pd.Int64Dtype(),
+ # 'transaction_status': np.str,
+ # 'transaction_created_at': pd.Int64Dtype(),
+ # 'transaction_type': np.str,
+ # 'transaction_review_decision': np.str,
+ # 'dispute_initiator': np.str,
+ # 'dispute_liability': np.str,
+ # 'dispute_resolution': np.str,
+ # 'dispute_status': np.str,
+ # 'risk_label': pd.Int64Dtype(),
+ # 'risk_inputs_transaction_id': pd.Int64Dtype(),
+ # 'risk_inputs_addresses_billing_line1': np.str,
+ # 'risk_inputs_addresses_shipping_line1': np.str,
+ # 'risk_inputs_email_had_fraudulent_disputes': pd.Int64Dtype(),
+ # 'risk_inputs_email_had_successful_transactions': pd.Int64Dtype(),
+ # 'risk_inputs_shipping_region': pd.Int64Dtype(),
+ # 'risk_inputs_shipping_method': pd.Int64Dtype(),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment