From 5e2ff01ed1eb4d5c64c6cedc1cb8d686be4116c0 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Fri, 16 Aug 2024 14:09:01 +0700 Subject: [PATCH] Create fraud_detection.py --- ai_ml/models/fraud_detection.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ai_ml/models/fraud_detection.py diff --git a/ai_ml/models/fraud_detection.py b/ai_ml/models/fraud_detection.py new file mode 100644 index 000000000..b2d5b814d --- /dev/null +++ b/ai_ml/models/fraud_detection.py @@ -0,0 +1,12 @@ +import pandas as pd +from sklearn.ensemble import RandomForestClassifier + +class FraudDetectionModel: + def __init__(self): + self.model = RandomForestClassifier() + + def train(self, dataset): + self.model.fit(dataset.drop('target', axis=1), dataset['target']) + + def predict(self, transaction): + return self.model.predict(transaction)