Skip to content

Instantly share code, notes, and snippets.

@ntkathole
Last active October 31, 2025 16:51
Show Gist options
  • Select an option

  • Save ntkathole/60d18c3bf8df88f9bca7aaca41e3babe to your computer and use it in GitHub Desktop.

Select an option

Save ntkathole/60d18c3bf8df88f9bca7aaca41e3babe to your computer and use it in GitHub Desktop.
Create new feature and feature view
from feast import FeatureView, Field
from feast.types import Float64, Int64
from datetime import timedelta
# Get references
transaction_source = fs_banking.get_data_source("transaction_data_source")
customer = fs_banking.get_entity("customer")
customer_high_value_txns = FeatureView(
name="customer_high_value_txns",
entities=[customer], # References the customer entity
ttl=timedelta(hours=24), # 24-hour TTL for real-time fraud detection
schema=[
Field(
name="high_value_txn_24h",
dtype=Int64,
description="Count of transactions >$10,000 in last 24 hours - PRIMARY FRAUD INDICATOR"
),
],
source=transaction_source,
tags={
"team": "risk_fraud",
"owner": "risk_fraud_team@bank.com",
"use_case": "fraud_detection_enhancement",
"business_impact": "critical",
"hypothesis": "high_value_txn_count_predicts_fraud",
"model_version": "v2",
"feature_importance": "high",
"data_classification": "confidential",
},
description="High-value transaction features for enhanced fraud detection. Tracks frequency and amounts of transactions over $10,000 in the last 24 hours. Hypothesis: Sudden spikes in high-value transactions indicate fraudulent behavior. Based on analysis showing 114 high-value transactions (0.23%) with 4.39% fraud rate."
)
# Apply to remote registry
fs_banking.apply([customer_high_value_txns])
print("✓ Feature view created and registered\n")
fs_banking.refresh_registry()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment