Update README.md
Browse files
README.md
CHANGED
|
@@ -54,6 +54,11 @@ This is an ensemble fraud detection system trained on 1.47M e-commerce transacti
|
|
| 54 |
|
| 55 |
### Usage
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
```python
|
| 58 |
import joblib
|
| 59 |
import numpy as np
|
|
@@ -66,15 +71,18 @@ xgb_model = joblib.load("xgb_model.pkl")
|
|
| 66 |
ensemble_model = joblib.load("ensemble_model.pkl")
|
| 67 |
scaler = joblib.load("scaler.pkl")
|
| 68 |
|
| 69 |
-
# Prepare your data
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
|
| 75 |
# Predict with ensemble
|
| 76 |
-
fraud_proba = ensemble_model.predict_proba(
|
| 77 |
-
fraud_pred = ensemble_model.predict(
|
|
|
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
### License
|
|
|
|
| 54 |
|
| 55 |
### Usage
|
| 56 |
|
| 57 |
+
```python
|
| 58 |
+
### Usage
|
| 59 |
+
|
| 60 |
+
## Warning: Need GPU environment with CUDA installed
|
| 61 |
+
|
| 62 |
```python
|
| 63 |
import joblib
|
| 64 |
import numpy as np
|
|
|
|
| 71 |
ensemble_model = joblib.load("ensemble_model.pkl")
|
| 72 |
scaler = joblib.load("scaler.pkl")
|
| 73 |
|
| 74 |
+
# Prepare your data
|
| 75 |
+
df = ...
|
| 76 |
|
| 77 |
+
X = df[df.columns.difference(['Is Fraudulent'])].copy()
|
| 78 |
+
y = df['Is Fraudulent'].copy()
|
| 79 |
|
| 80 |
# Predict with ensemble
|
| 81 |
+
fraud_proba = ensemble_model.predict_proba(X)[:, 1]
|
| 82 |
+
fraud_pred = ensemble_model.predict(X)
|
| 83 |
+
|
| 84 |
+
# Evaluate predictions
|
| 85 |
+
evaluate_models([lr_model, rf_model, nn_model, xgb_model, ensemble_model], X, y, ['Logistic Regression', 'Random Forest', 'Neural Network', 'XGBoost', 'Stacking Ensemble'])
|
| 86 |
```
|
| 87 |
|
| 88 |
### License
|