Upload trained reconciliation model artifacts
Browse files- README.md +14 -3
- best_model.joblib +3 -0
- feature_schema.json +26 -0
- inference_helper.py +18 -0
- metrics.json +18 -0
README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reconciliation Break Classifier
|
| 2 |
+
|
| 3 |
+
This Space hosts a trained **ML-based reconciliation break classifier**.
|
| 4 |
+
|
| 5 |
+
## Artifacts
|
| 6 |
+
- `best_model.joblib` – trained ML pipeline
|
| 7 |
+
- `feature_schema.json` – input feature definition
|
| 8 |
+
- `metrics.json` – evaluation metrics
|
| 9 |
+
|
| 10 |
+
## Usage
|
| 11 |
+
Load using `joblib.load()` and apply on canonical reconciliation features.
|
| 12 |
+
|
| 13 |
+
## Domain
|
| 14 |
+
Finance · Banking · Transaction Reconciliation · Fraud Detection
|
best_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:15a1156f016317b3ccb2479e49bf8304601ec0b431a5079eec0ee22c0cdd24f4
|
| 3 |
+
size 3242
|
feature_schema.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"feature_cols": [
|
| 3 |
+
"amt_diff",
|
| 4 |
+
"amt_ratio",
|
| 5 |
+
"amt_pct",
|
| 6 |
+
"currency_match",
|
| 7 |
+
"time_gap_hours",
|
| 8 |
+
"settlement_gap_days",
|
| 9 |
+
"is_weekend",
|
| 10 |
+
"is_night"
|
| 11 |
+
],
|
| 12 |
+
"numeric_features": [
|
| 13 |
+
"amt_diff",
|
| 14 |
+
"amt_ratio",
|
| 15 |
+
"amt_pct",
|
| 16 |
+
"currency_match",
|
| 17 |
+
"time_gap_hours",
|
| 18 |
+
"settlement_gap_days",
|
| 19 |
+
"is_weekend",
|
| 20 |
+
"is_night"
|
| 21 |
+
],
|
| 22 |
+
"categorical_features": [],
|
| 23 |
+
"target_col": "label",
|
| 24 |
+
"created_at": "2025-12-24 04:59:44.498105+00:00",
|
| 25 |
+
"best_model_name": "logreg"
|
| 26 |
+
}
|
inference_helper.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import joblib
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
def load_model(model_dir):
|
| 6 |
+
model = joblib.load(f"{model_dir}/best_model.joblib")
|
| 7 |
+
with open(f"{model_dir}/feature_schema.json") as f:
|
| 8 |
+
schema = json.load(f)
|
| 9 |
+
return model, schema
|
| 10 |
+
|
| 11 |
+
def predict(df: pd.DataFrame, model, schema):
|
| 12 |
+
X = df[schema['feature_cols']].copy()
|
| 13 |
+
proba = model.predict_proba(X)[:, 1]
|
| 14 |
+
pred = (proba >= 0.5).astype(int)
|
| 15 |
+
out = df.copy()
|
| 16 |
+
out['pred_label'] = pred
|
| 17 |
+
out['pred_probability'] = proba
|
| 18 |
+
return out
|
metrics.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"logreg": {
|
| 3 |
+
"roc_auc": 1.0,
|
| 4 |
+
"pr_auc": 1.0
|
| 5 |
+
},
|
| 6 |
+
"random_forest": {
|
| 7 |
+
"roc_auc": 1.0,
|
| 8 |
+
"pr_auc": 1.0
|
| 9 |
+
},
|
| 10 |
+
"gradient_boosting": {
|
| 11 |
+
"roc_auc": 1.0,
|
| 12 |
+
"pr_auc": 1.0
|
| 13 |
+
},
|
| 14 |
+
"mlp_nn": {
|
| 15 |
+
"roc_auc": 0.9999879737703119,
|
| 16 |
+
"pr_auc": 0.9996221454837869
|
| 17 |
+
}
|
| 18 |
+
}
|