Spaces:
Runtime error
Runtime error
| import pandas as pd | |
| from sklearn.ensemble import RandomForestClassifier | |
| import pickle | |
| # SME-Focused Dataset | |
| data = pd.DataFrame({ | |
| "amount": [500,12000,800,15000,300,20000,600,18000], | |
| "hour": [14,2,13,1,15,3,16,0], | |
| "new_customer": [0,1,0,1,0,1,0,1], | |
| "refund_request": [0,0,1,1,0,1,0,1], | |
| "location_mismatch": [0,1,0,1,0,1,0,1], | |
| "fraud": [0,1,0,1,0,1,0,1] | |
| }) | |
| X = data.drop("fraud", axis=1) | |
| y = data["fraud"] | |
| model = RandomForestClassifier(n_estimators=100) | |
| model.fit(X, y) | |
| pickle.dump(model, open("fraud_model.pkl", "wb")) | |
| print("SME Fraud Model Created Successfully!") |