arun-gharami's picture
Create model.py
5a44788 verified
def predict_fraud(amount, time_hour, transaction_type, merchant_risk, customer_age, previous_transactions):
score = 0
if amount > 500:
score += 25
if time_hour <= 4 or time_hour >= 23:
score += 20
if transaction_type == "online":
score += 15
if merchant_risk > 0.6:
score += 30
if previous_transactions < 10:
score += 10
score = min(score, 100)
if score >= 60:
return "Potential Fraud", score
else:
return "Likely Legitimate", score