add app and requirements
Browse files- app.py +79 -0
- notebook.ipynb +1152 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
+
import os
|
| 4 |
+
from transformers import pipeline
|
| 5 |
+
|
| 6 |
+
# Konfigurasi Kategori sesuai Proposal Archon
|
| 7 |
+
CATEGORIES = ["Income", "Bills", "Transport", "Retail/E-commerce", "Cash Withdrawal", "Transfer Out", "General Debit"]
|
| 8 |
+
|
| 9 |
+
class ArchonEngine:
|
| 10 |
+
def __init__(self, model_path="archon_v1"):
|
| 11 |
+
# Pilar 1: NLP Transaction Classifier [cite: 83]
|
| 12 |
+
self.classifier = pipeline(
|
| 13 |
+
"text-classification",
|
| 14 |
+
model=model_path,
|
| 15 |
+
tokenizer=model_path
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
def process(self, text, amount, income, monthly_spending):
|
| 19 |
+
# 1. Klasifikasi Transaksi
|
| 20 |
+
pred = self.classifier(text)[0]
|
| 21 |
+
label_id = int(pred['label'].split('_')[-1])
|
| 22 |
+
category = CATEGORIES[label_id]
|
| 23 |
+
conf = pred['score']
|
| 24 |
+
|
| 25 |
+
# 2. Pilar 2: Machine Learning Predictive Model (Risk) [cite: 85]
|
| 26 |
+
risk_score = 0.05
|
| 27 |
+
ratio = amount / income if income > 0 else 0
|
| 28 |
+
if ratio >= 0.25: risk_score += 0.45
|
| 29 |
+
|
| 30 |
+
spend_rate = monthly_spending / income if income > 0 else 0
|
| 31 |
+
if spend_rate >= 0.85: risk_score += 0.35
|
| 32 |
+
|
| 33 |
+
if category in ["Cash Withdrawal", "Transfer Out"]: risk_score += 0.10
|
| 34 |
+
|
| 35 |
+
risk_level = "High" if risk_score >= 0.6 else ("Medium" if risk_score >= 0.3 else "Low")
|
| 36 |
+
|
| 37 |
+
# 3. Pilar 3: Next Best Offer (NBO) Engine [cite: 87]
|
| 38 |
+
if risk_level == "High":
|
| 39 |
+
recommendation = "Set immediate budget alert + suggest emergency saving plan; show debt counseling resources."
|
| 40 |
+
elif category == "Income":
|
| 41 |
+
recommendation = "Recommend automatic split: 10% to Emergency Fund, 5% to Investments."
|
| 42 |
+
elif category in ["Retail/E-commerce", "General Debit"]:
|
| 43 |
+
recommendation = "Offer discount coupons / loyalty suggestion or roundup saving feature."
|
| 44 |
+
else:
|
| 45 |
+
recommendation = "Maintain current budget; propose small Auto-Save (Rp20k/day)."
|
| 46 |
+
|
| 47 |
+
return {
|
| 48 |
+
"Kategori (Pilar 1)": f"{category} ({conf*100:.2f}%)",
|
| 49 |
+
"Level Risiko (Pilar 2)": f"{risk_level} (Score: {risk_score:.2f})",
|
| 50 |
+
"Rekomendasi NBO (Pilar 3)": recommendation
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
# Inisialisasi Engine
|
| 54 |
+
# Pastikan folder 'archon_v1' ada di direktori yang sama
|
| 55 |
+
engine = ArchonEngine("archon_v1")
|
| 56 |
+
|
| 57 |
+
# UI Interface Gradio
|
| 58 |
+
with gr.Blocks(title="Archon-AI: Financial Resilience Engine") as demo:
|
| 59 |
+
gr.Markdown("# 🛡️ Archon-AI")
|
| 60 |
+
gr.Markdown("### Financial Resilience Engine berbasis AI untuk Perbankan Indonesia [cite: 8]")
|
| 61 |
+
|
| 62 |
+
with gr.Row():
|
| 63 |
+
with gr.Column():
|
| 64 |
+
input_text = gr.Textbox(label="Narasi Transaksi", placeholder="Contoh: GAJI PT MAJU JAYA")
|
| 65 |
+
input_amount = gr.Number(label="Jumlah Transaksi (Rp)")
|
| 66 |
+
input_income = gr.Number(label="Total Pendapatan Bulanan (Rp)")
|
| 67 |
+
input_spending = gr.Number(label="Total Pengeluaran Bulan Ini (Rp)")
|
| 68 |
+
btn = gr.Button("Analisis dengan Archon", variant="primary")
|
| 69 |
+
|
| 70 |
+
with gr.Column():
|
| 71 |
+
output = gr.JSON(label="Hasil Analisis AI")
|
| 72 |
+
|
| 73 |
+
btn.click(
|
| 74 |
+
fn=engine.process,
|
| 75 |
+
inputs=[input_text, input_amount, input_income, input_spending],
|
| 76 |
+
outputs=output
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
demo.launch()
|
notebook.ipynb
ADDED
|
@@ -0,0 +1,1152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"nbformat": 4,
|
| 3 |
+
"nbformat_minor": 0,
|
| 4 |
+
"metadata": {
|
| 5 |
+
"colab": {
|
| 6 |
+
"provenance": [],
|
| 7 |
+
"gpuType": "T4"
|
| 8 |
+
},
|
| 9 |
+
"kernelspec": {
|
| 10 |
+
"name": "python3",
|
| 11 |
+
"display_name": "Python 3"
|
| 12 |
+
},
|
| 13 |
+
"language_info": {
|
| 14 |
+
"name": "python"
|
| 15 |
+
},
|
| 16 |
+
"accelerator": "GPU",
|
| 17 |
+
"widgets": {
|
| 18 |
+
"application/vnd.jupyter.widget-state+json": {
|
| 19 |
+
"293f2d1bd51649f498dce24d428e6cba": {
|
| 20 |
+
"model_module": "@jupyter-widgets/controls",
|
| 21 |
+
"model_name": "HBoxModel",
|
| 22 |
+
"model_module_version": "1.5.0",
|
| 23 |
+
"state": {
|
| 24 |
+
"_dom_classes": [],
|
| 25 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 26 |
+
"_model_module_version": "1.5.0",
|
| 27 |
+
"_model_name": "HBoxModel",
|
| 28 |
+
"_view_count": null,
|
| 29 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 30 |
+
"_view_module_version": "1.5.0",
|
| 31 |
+
"_view_name": "HBoxView",
|
| 32 |
+
"box_style": "",
|
| 33 |
+
"children": [
|
| 34 |
+
"IPY_MODEL_872414d8fd3a4c41af5710e7dda3b83d",
|
| 35 |
+
"IPY_MODEL_b7a67689c45e41c5bd204206cd39ae44",
|
| 36 |
+
"IPY_MODEL_aa266ef6570f4cbead12481662718cb6"
|
| 37 |
+
],
|
| 38 |
+
"layout": "IPY_MODEL_e4807d727df14568806874d8207c270b"
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"872414d8fd3a4c41af5710e7dda3b83d": {
|
| 42 |
+
"model_module": "@jupyter-widgets/controls",
|
| 43 |
+
"model_name": "HTMLModel",
|
| 44 |
+
"model_module_version": "1.5.0",
|
| 45 |
+
"state": {
|
| 46 |
+
"_dom_classes": [],
|
| 47 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 48 |
+
"_model_module_version": "1.5.0",
|
| 49 |
+
"_model_name": "HTMLModel",
|
| 50 |
+
"_view_count": null,
|
| 51 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 52 |
+
"_view_module_version": "1.5.0",
|
| 53 |
+
"_view_name": "HTMLView",
|
| 54 |
+
"description": "",
|
| 55 |
+
"description_tooltip": null,
|
| 56 |
+
"layout": "IPY_MODEL_2fe7fec5c72645eaa20255aaa3a00139",
|
| 57 |
+
"placeholder": "",
|
| 58 |
+
"style": "IPY_MODEL_9157018bce84419da17ebc8cbc0ed0f8",
|
| 59 |
+
"value": "Map: 100%"
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"b7a67689c45e41c5bd204206cd39ae44": {
|
| 63 |
+
"model_module": "@jupyter-widgets/controls",
|
| 64 |
+
"model_name": "FloatProgressModel",
|
| 65 |
+
"model_module_version": "1.5.0",
|
| 66 |
+
"state": {
|
| 67 |
+
"_dom_classes": [],
|
| 68 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 69 |
+
"_model_module_version": "1.5.0",
|
| 70 |
+
"_model_name": "FloatProgressModel",
|
| 71 |
+
"_view_count": null,
|
| 72 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 73 |
+
"_view_module_version": "1.5.0",
|
| 74 |
+
"_view_name": "ProgressView",
|
| 75 |
+
"bar_style": "success",
|
| 76 |
+
"description": "",
|
| 77 |
+
"description_tooltip": null,
|
| 78 |
+
"layout": "IPY_MODEL_2e5eb516aec746418e599cd55810b0e5",
|
| 79 |
+
"max": 1700,
|
| 80 |
+
"min": 0,
|
| 81 |
+
"orientation": "horizontal",
|
| 82 |
+
"style": "IPY_MODEL_dd17cebd28174846a343865e236ca0a0",
|
| 83 |
+
"value": 1700
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"aa266ef6570f4cbead12481662718cb6": {
|
| 87 |
+
"model_module": "@jupyter-widgets/controls",
|
| 88 |
+
"model_name": "HTMLModel",
|
| 89 |
+
"model_module_version": "1.5.0",
|
| 90 |
+
"state": {
|
| 91 |
+
"_dom_classes": [],
|
| 92 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 93 |
+
"_model_module_version": "1.5.0",
|
| 94 |
+
"_model_name": "HTMLModel",
|
| 95 |
+
"_view_count": null,
|
| 96 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 97 |
+
"_view_module_version": "1.5.0",
|
| 98 |
+
"_view_name": "HTMLView",
|
| 99 |
+
"description": "",
|
| 100 |
+
"description_tooltip": null,
|
| 101 |
+
"layout": "IPY_MODEL_67f65a87b5594a71b5247d5b71e426ee",
|
| 102 |
+
"placeholder": "",
|
| 103 |
+
"style": "IPY_MODEL_14a7dda6889241dc9b0f468dfcef5ef2",
|
| 104 |
+
"value": " 1700/1700 [00:00<00:00, 3721.50 examples/s]"
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
"e4807d727df14568806874d8207c270b": {
|
| 108 |
+
"model_module": "@jupyter-widgets/base",
|
| 109 |
+
"model_name": "LayoutModel",
|
| 110 |
+
"model_module_version": "1.2.0",
|
| 111 |
+
"state": {
|
| 112 |
+
"_model_module": "@jupyter-widgets/base",
|
| 113 |
+
"_model_module_version": "1.2.0",
|
| 114 |
+
"_model_name": "LayoutModel",
|
| 115 |
+
"_view_count": null,
|
| 116 |
+
"_view_module": "@jupyter-widgets/base",
|
| 117 |
+
"_view_module_version": "1.2.0",
|
| 118 |
+
"_view_name": "LayoutView",
|
| 119 |
+
"align_content": null,
|
| 120 |
+
"align_items": null,
|
| 121 |
+
"align_self": null,
|
| 122 |
+
"border": null,
|
| 123 |
+
"bottom": null,
|
| 124 |
+
"display": null,
|
| 125 |
+
"flex": null,
|
| 126 |
+
"flex_flow": null,
|
| 127 |
+
"grid_area": null,
|
| 128 |
+
"grid_auto_columns": null,
|
| 129 |
+
"grid_auto_flow": null,
|
| 130 |
+
"grid_auto_rows": null,
|
| 131 |
+
"grid_column": null,
|
| 132 |
+
"grid_gap": null,
|
| 133 |
+
"grid_row": null,
|
| 134 |
+
"grid_template_areas": null,
|
| 135 |
+
"grid_template_columns": null,
|
| 136 |
+
"grid_template_rows": null,
|
| 137 |
+
"height": null,
|
| 138 |
+
"justify_content": null,
|
| 139 |
+
"justify_items": null,
|
| 140 |
+
"left": null,
|
| 141 |
+
"margin": null,
|
| 142 |
+
"max_height": null,
|
| 143 |
+
"max_width": null,
|
| 144 |
+
"min_height": null,
|
| 145 |
+
"min_width": null,
|
| 146 |
+
"object_fit": null,
|
| 147 |
+
"object_position": null,
|
| 148 |
+
"order": null,
|
| 149 |
+
"overflow": null,
|
| 150 |
+
"overflow_x": null,
|
| 151 |
+
"overflow_y": null,
|
| 152 |
+
"padding": null,
|
| 153 |
+
"right": null,
|
| 154 |
+
"top": null,
|
| 155 |
+
"visibility": null,
|
| 156 |
+
"width": null
|
| 157 |
+
}
|
| 158 |
+
},
|
| 159 |
+
"2fe7fec5c72645eaa20255aaa3a00139": {
|
| 160 |
+
"model_module": "@jupyter-widgets/base",
|
| 161 |
+
"model_name": "LayoutModel",
|
| 162 |
+
"model_module_version": "1.2.0",
|
| 163 |
+
"state": {
|
| 164 |
+
"_model_module": "@jupyter-widgets/base",
|
| 165 |
+
"_model_module_version": "1.2.0",
|
| 166 |
+
"_model_name": "LayoutModel",
|
| 167 |
+
"_view_count": null,
|
| 168 |
+
"_view_module": "@jupyter-widgets/base",
|
| 169 |
+
"_view_module_version": "1.2.0",
|
| 170 |
+
"_view_name": "LayoutView",
|
| 171 |
+
"align_content": null,
|
| 172 |
+
"align_items": null,
|
| 173 |
+
"align_self": null,
|
| 174 |
+
"border": null,
|
| 175 |
+
"bottom": null,
|
| 176 |
+
"display": null,
|
| 177 |
+
"flex": null,
|
| 178 |
+
"flex_flow": null,
|
| 179 |
+
"grid_area": null,
|
| 180 |
+
"grid_auto_columns": null,
|
| 181 |
+
"grid_auto_flow": null,
|
| 182 |
+
"grid_auto_rows": null,
|
| 183 |
+
"grid_column": null,
|
| 184 |
+
"grid_gap": null,
|
| 185 |
+
"grid_row": null,
|
| 186 |
+
"grid_template_areas": null,
|
| 187 |
+
"grid_template_columns": null,
|
| 188 |
+
"grid_template_rows": null,
|
| 189 |
+
"height": null,
|
| 190 |
+
"justify_content": null,
|
| 191 |
+
"justify_items": null,
|
| 192 |
+
"left": null,
|
| 193 |
+
"margin": null,
|
| 194 |
+
"max_height": null,
|
| 195 |
+
"max_width": null,
|
| 196 |
+
"min_height": null,
|
| 197 |
+
"min_width": null,
|
| 198 |
+
"object_fit": null,
|
| 199 |
+
"object_position": null,
|
| 200 |
+
"order": null,
|
| 201 |
+
"overflow": null,
|
| 202 |
+
"overflow_x": null,
|
| 203 |
+
"overflow_y": null,
|
| 204 |
+
"padding": null,
|
| 205 |
+
"right": null,
|
| 206 |
+
"top": null,
|
| 207 |
+
"visibility": null,
|
| 208 |
+
"width": null
|
| 209 |
+
}
|
| 210 |
+
},
|
| 211 |
+
"9157018bce84419da17ebc8cbc0ed0f8": {
|
| 212 |
+
"model_module": "@jupyter-widgets/controls",
|
| 213 |
+
"model_name": "DescriptionStyleModel",
|
| 214 |
+
"model_module_version": "1.5.0",
|
| 215 |
+
"state": {
|
| 216 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 217 |
+
"_model_module_version": "1.5.0",
|
| 218 |
+
"_model_name": "DescriptionStyleModel",
|
| 219 |
+
"_view_count": null,
|
| 220 |
+
"_view_module": "@jupyter-widgets/base",
|
| 221 |
+
"_view_module_version": "1.2.0",
|
| 222 |
+
"_view_name": "StyleView",
|
| 223 |
+
"description_width": ""
|
| 224 |
+
}
|
| 225 |
+
},
|
| 226 |
+
"2e5eb516aec746418e599cd55810b0e5": {
|
| 227 |
+
"model_module": "@jupyter-widgets/base",
|
| 228 |
+
"model_name": "LayoutModel",
|
| 229 |
+
"model_module_version": "1.2.0",
|
| 230 |
+
"state": {
|
| 231 |
+
"_model_module": "@jupyter-widgets/base",
|
| 232 |
+
"_model_module_version": "1.2.0",
|
| 233 |
+
"_model_name": "LayoutModel",
|
| 234 |
+
"_view_count": null,
|
| 235 |
+
"_view_module": "@jupyter-widgets/base",
|
| 236 |
+
"_view_module_version": "1.2.0",
|
| 237 |
+
"_view_name": "LayoutView",
|
| 238 |
+
"align_content": null,
|
| 239 |
+
"align_items": null,
|
| 240 |
+
"align_self": null,
|
| 241 |
+
"border": null,
|
| 242 |
+
"bottom": null,
|
| 243 |
+
"display": null,
|
| 244 |
+
"flex": null,
|
| 245 |
+
"flex_flow": null,
|
| 246 |
+
"grid_area": null,
|
| 247 |
+
"grid_auto_columns": null,
|
| 248 |
+
"grid_auto_flow": null,
|
| 249 |
+
"grid_auto_rows": null,
|
| 250 |
+
"grid_column": null,
|
| 251 |
+
"grid_gap": null,
|
| 252 |
+
"grid_row": null,
|
| 253 |
+
"grid_template_areas": null,
|
| 254 |
+
"grid_template_columns": null,
|
| 255 |
+
"grid_template_rows": null,
|
| 256 |
+
"height": null,
|
| 257 |
+
"justify_content": null,
|
| 258 |
+
"justify_items": null,
|
| 259 |
+
"left": null,
|
| 260 |
+
"margin": null,
|
| 261 |
+
"max_height": null,
|
| 262 |
+
"max_width": null,
|
| 263 |
+
"min_height": null,
|
| 264 |
+
"min_width": null,
|
| 265 |
+
"object_fit": null,
|
| 266 |
+
"object_position": null,
|
| 267 |
+
"order": null,
|
| 268 |
+
"overflow": null,
|
| 269 |
+
"overflow_x": null,
|
| 270 |
+
"overflow_y": null,
|
| 271 |
+
"padding": null,
|
| 272 |
+
"right": null,
|
| 273 |
+
"top": null,
|
| 274 |
+
"visibility": null,
|
| 275 |
+
"width": null
|
| 276 |
+
}
|
| 277 |
+
},
|
| 278 |
+
"dd17cebd28174846a343865e236ca0a0": {
|
| 279 |
+
"model_module": "@jupyter-widgets/controls",
|
| 280 |
+
"model_name": "ProgressStyleModel",
|
| 281 |
+
"model_module_version": "1.5.0",
|
| 282 |
+
"state": {
|
| 283 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 284 |
+
"_model_module_version": "1.5.0",
|
| 285 |
+
"_model_name": "ProgressStyleModel",
|
| 286 |
+
"_view_count": null,
|
| 287 |
+
"_view_module": "@jupyter-widgets/base",
|
| 288 |
+
"_view_module_version": "1.2.0",
|
| 289 |
+
"_view_name": "StyleView",
|
| 290 |
+
"bar_color": null,
|
| 291 |
+
"description_width": ""
|
| 292 |
+
}
|
| 293 |
+
},
|
| 294 |
+
"67f65a87b5594a71b5247d5b71e426ee": {
|
| 295 |
+
"model_module": "@jupyter-widgets/base",
|
| 296 |
+
"model_name": "LayoutModel",
|
| 297 |
+
"model_module_version": "1.2.0",
|
| 298 |
+
"state": {
|
| 299 |
+
"_model_module": "@jupyter-widgets/base",
|
| 300 |
+
"_model_module_version": "1.2.0",
|
| 301 |
+
"_model_name": "LayoutModel",
|
| 302 |
+
"_view_count": null,
|
| 303 |
+
"_view_module": "@jupyter-widgets/base",
|
| 304 |
+
"_view_module_version": "1.2.0",
|
| 305 |
+
"_view_name": "LayoutView",
|
| 306 |
+
"align_content": null,
|
| 307 |
+
"align_items": null,
|
| 308 |
+
"align_self": null,
|
| 309 |
+
"border": null,
|
| 310 |
+
"bottom": null,
|
| 311 |
+
"display": null,
|
| 312 |
+
"flex": null,
|
| 313 |
+
"flex_flow": null,
|
| 314 |
+
"grid_area": null,
|
| 315 |
+
"grid_auto_columns": null,
|
| 316 |
+
"grid_auto_flow": null,
|
| 317 |
+
"grid_auto_rows": null,
|
| 318 |
+
"grid_column": null,
|
| 319 |
+
"grid_gap": null,
|
| 320 |
+
"grid_row": null,
|
| 321 |
+
"grid_template_areas": null,
|
| 322 |
+
"grid_template_columns": null,
|
| 323 |
+
"grid_template_rows": null,
|
| 324 |
+
"height": null,
|
| 325 |
+
"justify_content": null,
|
| 326 |
+
"justify_items": null,
|
| 327 |
+
"left": null,
|
| 328 |
+
"margin": null,
|
| 329 |
+
"max_height": null,
|
| 330 |
+
"max_width": null,
|
| 331 |
+
"min_height": null,
|
| 332 |
+
"min_width": null,
|
| 333 |
+
"object_fit": null,
|
| 334 |
+
"object_position": null,
|
| 335 |
+
"order": null,
|
| 336 |
+
"overflow": null,
|
| 337 |
+
"overflow_x": null,
|
| 338 |
+
"overflow_y": null,
|
| 339 |
+
"padding": null,
|
| 340 |
+
"right": null,
|
| 341 |
+
"top": null,
|
| 342 |
+
"visibility": null,
|
| 343 |
+
"width": null
|
| 344 |
+
}
|
| 345 |
+
},
|
| 346 |
+
"14a7dda6889241dc9b0f468dfcef5ef2": {
|
| 347 |
+
"model_module": "@jupyter-widgets/controls",
|
| 348 |
+
"model_name": "DescriptionStyleModel",
|
| 349 |
+
"model_module_version": "1.5.0",
|
| 350 |
+
"state": {
|
| 351 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 352 |
+
"_model_module_version": "1.5.0",
|
| 353 |
+
"_model_name": "DescriptionStyleModel",
|
| 354 |
+
"_view_count": null,
|
| 355 |
+
"_view_module": "@jupyter-widgets/base",
|
| 356 |
+
"_view_module_version": "1.2.0",
|
| 357 |
+
"_view_name": "StyleView",
|
| 358 |
+
"description_width": ""
|
| 359 |
+
}
|
| 360 |
+
},
|
| 361 |
+
"81a83bcd3334462f84baf7fcbb9c2641": {
|
| 362 |
+
"model_module": "@jupyter-widgets/controls",
|
| 363 |
+
"model_name": "HBoxModel",
|
| 364 |
+
"model_module_version": "1.5.0",
|
| 365 |
+
"state": {
|
| 366 |
+
"_dom_classes": [],
|
| 367 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 368 |
+
"_model_module_version": "1.5.0",
|
| 369 |
+
"_model_name": "HBoxModel",
|
| 370 |
+
"_view_count": null,
|
| 371 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 372 |
+
"_view_module_version": "1.5.0",
|
| 373 |
+
"_view_name": "HBoxView",
|
| 374 |
+
"box_style": "",
|
| 375 |
+
"children": [
|
| 376 |
+
"IPY_MODEL_0c8287f51f17432d98613c5cfab8bb74",
|
| 377 |
+
"IPY_MODEL_e9230b54e5a649919d175a8e19f0e84a",
|
| 378 |
+
"IPY_MODEL_5b29d6cd6dff46359576c2d62f2cfe40"
|
| 379 |
+
],
|
| 380 |
+
"layout": "IPY_MODEL_25019bd15d0d42519fe64176c56194d7"
|
| 381 |
+
}
|
| 382 |
+
},
|
| 383 |
+
"0c8287f51f17432d98613c5cfab8bb74": {
|
| 384 |
+
"model_module": "@jupyter-widgets/controls",
|
| 385 |
+
"model_name": "HTMLModel",
|
| 386 |
+
"model_module_version": "1.5.0",
|
| 387 |
+
"state": {
|
| 388 |
+
"_dom_classes": [],
|
| 389 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 390 |
+
"_model_module_version": "1.5.0",
|
| 391 |
+
"_model_name": "HTMLModel",
|
| 392 |
+
"_view_count": null,
|
| 393 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 394 |
+
"_view_module_version": "1.5.0",
|
| 395 |
+
"_view_name": "HTMLView",
|
| 396 |
+
"description": "",
|
| 397 |
+
"description_tooltip": null,
|
| 398 |
+
"layout": "IPY_MODEL_4f0d22b228b443ceba4e030fa87aa062",
|
| 399 |
+
"placeholder": "",
|
| 400 |
+
"style": "IPY_MODEL_051bc22d52354ce7b2526a9625b0dbf8",
|
| 401 |
+
"value": "Map: 100%"
|
| 402 |
+
}
|
| 403 |
+
},
|
| 404 |
+
"e9230b54e5a649919d175a8e19f0e84a": {
|
| 405 |
+
"model_module": "@jupyter-widgets/controls",
|
| 406 |
+
"model_name": "FloatProgressModel",
|
| 407 |
+
"model_module_version": "1.5.0",
|
| 408 |
+
"state": {
|
| 409 |
+
"_dom_classes": [],
|
| 410 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 411 |
+
"_model_module_version": "1.5.0",
|
| 412 |
+
"_model_name": "FloatProgressModel",
|
| 413 |
+
"_view_count": null,
|
| 414 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 415 |
+
"_view_module_version": "1.5.0",
|
| 416 |
+
"_view_name": "ProgressView",
|
| 417 |
+
"bar_style": "success",
|
| 418 |
+
"description": "",
|
| 419 |
+
"description_tooltip": null,
|
| 420 |
+
"layout": "IPY_MODEL_ea057ae4402b4f49af81e8cbf81ef7d6",
|
| 421 |
+
"max": 300,
|
| 422 |
+
"min": 0,
|
| 423 |
+
"orientation": "horizontal",
|
| 424 |
+
"style": "IPY_MODEL_bd16e0909f5b499ab6651c3ca6a74d29",
|
| 425 |
+
"value": 300
|
| 426 |
+
}
|
| 427 |
+
},
|
| 428 |
+
"5b29d6cd6dff46359576c2d62f2cfe40": {
|
| 429 |
+
"model_module": "@jupyter-widgets/controls",
|
| 430 |
+
"model_name": "HTMLModel",
|
| 431 |
+
"model_module_version": "1.5.0",
|
| 432 |
+
"state": {
|
| 433 |
+
"_dom_classes": [],
|
| 434 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 435 |
+
"_model_module_version": "1.5.0",
|
| 436 |
+
"_model_name": "HTMLModel",
|
| 437 |
+
"_view_count": null,
|
| 438 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 439 |
+
"_view_module_version": "1.5.0",
|
| 440 |
+
"_view_name": "HTMLView",
|
| 441 |
+
"description": "",
|
| 442 |
+
"description_tooltip": null,
|
| 443 |
+
"layout": "IPY_MODEL_fa30a14194964f73a89fabd2dc700366",
|
| 444 |
+
"placeholder": "",
|
| 445 |
+
"style": "IPY_MODEL_293eeb45c9cd40a9965165eacf601766",
|
| 446 |
+
"value": " 300/300 [00:00<00:00, 2263.90 examples/s]"
|
| 447 |
+
}
|
| 448 |
+
},
|
| 449 |
+
"25019bd15d0d42519fe64176c56194d7": {
|
| 450 |
+
"model_module": "@jupyter-widgets/base",
|
| 451 |
+
"model_name": "LayoutModel",
|
| 452 |
+
"model_module_version": "1.2.0",
|
| 453 |
+
"state": {
|
| 454 |
+
"_model_module": "@jupyter-widgets/base",
|
| 455 |
+
"_model_module_version": "1.2.0",
|
| 456 |
+
"_model_name": "LayoutModel",
|
| 457 |
+
"_view_count": null,
|
| 458 |
+
"_view_module": "@jupyter-widgets/base",
|
| 459 |
+
"_view_module_version": "1.2.0",
|
| 460 |
+
"_view_name": "LayoutView",
|
| 461 |
+
"align_content": null,
|
| 462 |
+
"align_items": null,
|
| 463 |
+
"align_self": null,
|
| 464 |
+
"border": null,
|
| 465 |
+
"bottom": null,
|
| 466 |
+
"display": null,
|
| 467 |
+
"flex": null,
|
| 468 |
+
"flex_flow": null,
|
| 469 |
+
"grid_area": null,
|
| 470 |
+
"grid_auto_columns": null,
|
| 471 |
+
"grid_auto_flow": null,
|
| 472 |
+
"grid_auto_rows": null,
|
| 473 |
+
"grid_column": null,
|
| 474 |
+
"grid_gap": null,
|
| 475 |
+
"grid_row": null,
|
| 476 |
+
"grid_template_areas": null,
|
| 477 |
+
"grid_template_columns": null,
|
| 478 |
+
"grid_template_rows": null,
|
| 479 |
+
"height": null,
|
| 480 |
+
"justify_content": null,
|
| 481 |
+
"justify_items": null,
|
| 482 |
+
"left": null,
|
| 483 |
+
"margin": null,
|
| 484 |
+
"max_height": null,
|
| 485 |
+
"max_width": null,
|
| 486 |
+
"min_height": null,
|
| 487 |
+
"min_width": null,
|
| 488 |
+
"object_fit": null,
|
| 489 |
+
"object_position": null,
|
| 490 |
+
"order": null,
|
| 491 |
+
"overflow": null,
|
| 492 |
+
"overflow_x": null,
|
| 493 |
+
"overflow_y": null,
|
| 494 |
+
"padding": null,
|
| 495 |
+
"right": null,
|
| 496 |
+
"top": null,
|
| 497 |
+
"visibility": null,
|
| 498 |
+
"width": null
|
| 499 |
+
}
|
| 500 |
+
},
|
| 501 |
+
"4f0d22b228b443ceba4e030fa87aa062": {
|
| 502 |
+
"model_module": "@jupyter-widgets/base",
|
| 503 |
+
"model_name": "LayoutModel",
|
| 504 |
+
"model_module_version": "1.2.0",
|
| 505 |
+
"state": {
|
| 506 |
+
"_model_module": "@jupyter-widgets/base",
|
| 507 |
+
"_model_module_version": "1.2.0",
|
| 508 |
+
"_model_name": "LayoutModel",
|
| 509 |
+
"_view_count": null,
|
| 510 |
+
"_view_module": "@jupyter-widgets/base",
|
| 511 |
+
"_view_module_version": "1.2.0",
|
| 512 |
+
"_view_name": "LayoutView",
|
| 513 |
+
"align_content": null,
|
| 514 |
+
"align_items": null,
|
| 515 |
+
"align_self": null,
|
| 516 |
+
"border": null,
|
| 517 |
+
"bottom": null,
|
| 518 |
+
"display": null,
|
| 519 |
+
"flex": null,
|
| 520 |
+
"flex_flow": null,
|
| 521 |
+
"grid_area": null,
|
| 522 |
+
"grid_auto_columns": null,
|
| 523 |
+
"grid_auto_flow": null,
|
| 524 |
+
"grid_auto_rows": null,
|
| 525 |
+
"grid_column": null,
|
| 526 |
+
"grid_gap": null,
|
| 527 |
+
"grid_row": null,
|
| 528 |
+
"grid_template_areas": null,
|
| 529 |
+
"grid_template_columns": null,
|
| 530 |
+
"grid_template_rows": null,
|
| 531 |
+
"height": null,
|
| 532 |
+
"justify_content": null,
|
| 533 |
+
"justify_items": null,
|
| 534 |
+
"left": null,
|
| 535 |
+
"margin": null,
|
| 536 |
+
"max_height": null,
|
| 537 |
+
"max_width": null,
|
| 538 |
+
"min_height": null,
|
| 539 |
+
"min_width": null,
|
| 540 |
+
"object_fit": null,
|
| 541 |
+
"object_position": null,
|
| 542 |
+
"order": null,
|
| 543 |
+
"overflow": null,
|
| 544 |
+
"overflow_x": null,
|
| 545 |
+
"overflow_y": null,
|
| 546 |
+
"padding": null,
|
| 547 |
+
"right": null,
|
| 548 |
+
"top": null,
|
| 549 |
+
"visibility": null,
|
| 550 |
+
"width": null
|
| 551 |
+
}
|
| 552 |
+
},
|
| 553 |
+
"051bc22d52354ce7b2526a9625b0dbf8": {
|
| 554 |
+
"model_module": "@jupyter-widgets/controls",
|
| 555 |
+
"model_name": "DescriptionStyleModel",
|
| 556 |
+
"model_module_version": "1.5.0",
|
| 557 |
+
"state": {
|
| 558 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 559 |
+
"_model_module_version": "1.5.0",
|
| 560 |
+
"_model_name": "DescriptionStyleModel",
|
| 561 |
+
"_view_count": null,
|
| 562 |
+
"_view_module": "@jupyter-widgets/base",
|
| 563 |
+
"_view_module_version": "1.2.0",
|
| 564 |
+
"_view_name": "StyleView",
|
| 565 |
+
"description_width": ""
|
| 566 |
+
}
|
| 567 |
+
},
|
| 568 |
+
"ea057ae4402b4f49af81e8cbf81ef7d6": {
|
| 569 |
+
"model_module": "@jupyter-widgets/base",
|
| 570 |
+
"model_name": "LayoutModel",
|
| 571 |
+
"model_module_version": "1.2.0",
|
| 572 |
+
"state": {
|
| 573 |
+
"_model_module": "@jupyter-widgets/base",
|
| 574 |
+
"_model_module_version": "1.2.0",
|
| 575 |
+
"_model_name": "LayoutModel",
|
| 576 |
+
"_view_count": null,
|
| 577 |
+
"_view_module": "@jupyter-widgets/base",
|
| 578 |
+
"_view_module_version": "1.2.0",
|
| 579 |
+
"_view_name": "LayoutView",
|
| 580 |
+
"align_content": null,
|
| 581 |
+
"align_items": null,
|
| 582 |
+
"align_self": null,
|
| 583 |
+
"border": null,
|
| 584 |
+
"bottom": null,
|
| 585 |
+
"display": null,
|
| 586 |
+
"flex": null,
|
| 587 |
+
"flex_flow": null,
|
| 588 |
+
"grid_area": null,
|
| 589 |
+
"grid_auto_columns": null,
|
| 590 |
+
"grid_auto_flow": null,
|
| 591 |
+
"grid_auto_rows": null,
|
| 592 |
+
"grid_column": null,
|
| 593 |
+
"grid_gap": null,
|
| 594 |
+
"grid_row": null,
|
| 595 |
+
"grid_template_areas": null,
|
| 596 |
+
"grid_template_columns": null,
|
| 597 |
+
"grid_template_rows": null,
|
| 598 |
+
"height": null,
|
| 599 |
+
"justify_content": null,
|
| 600 |
+
"justify_items": null,
|
| 601 |
+
"left": null,
|
| 602 |
+
"margin": null,
|
| 603 |
+
"max_height": null,
|
| 604 |
+
"max_width": null,
|
| 605 |
+
"min_height": null,
|
| 606 |
+
"min_width": null,
|
| 607 |
+
"object_fit": null,
|
| 608 |
+
"object_position": null,
|
| 609 |
+
"order": null,
|
| 610 |
+
"overflow": null,
|
| 611 |
+
"overflow_x": null,
|
| 612 |
+
"overflow_y": null,
|
| 613 |
+
"padding": null,
|
| 614 |
+
"right": null,
|
| 615 |
+
"top": null,
|
| 616 |
+
"visibility": null,
|
| 617 |
+
"width": null
|
| 618 |
+
}
|
| 619 |
+
},
|
| 620 |
+
"bd16e0909f5b499ab6651c3ca6a74d29": {
|
| 621 |
+
"model_module": "@jupyter-widgets/controls",
|
| 622 |
+
"model_name": "ProgressStyleModel",
|
| 623 |
+
"model_module_version": "1.5.0",
|
| 624 |
+
"state": {
|
| 625 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 626 |
+
"_model_module_version": "1.5.0",
|
| 627 |
+
"_model_name": "ProgressStyleModel",
|
| 628 |
+
"_view_count": null,
|
| 629 |
+
"_view_module": "@jupyter-widgets/base",
|
| 630 |
+
"_view_module_version": "1.2.0",
|
| 631 |
+
"_view_name": "StyleView",
|
| 632 |
+
"bar_color": null,
|
| 633 |
+
"description_width": ""
|
| 634 |
+
}
|
| 635 |
+
},
|
| 636 |
+
"fa30a14194964f73a89fabd2dc700366": {
|
| 637 |
+
"model_module": "@jupyter-widgets/base",
|
| 638 |
+
"model_name": "LayoutModel",
|
| 639 |
+
"model_module_version": "1.2.0",
|
| 640 |
+
"state": {
|
| 641 |
+
"_model_module": "@jupyter-widgets/base",
|
| 642 |
+
"_model_module_version": "1.2.0",
|
| 643 |
+
"_model_name": "LayoutModel",
|
| 644 |
+
"_view_count": null,
|
| 645 |
+
"_view_module": "@jupyter-widgets/base",
|
| 646 |
+
"_view_module_version": "1.2.0",
|
| 647 |
+
"_view_name": "LayoutView",
|
| 648 |
+
"align_content": null,
|
| 649 |
+
"align_items": null,
|
| 650 |
+
"align_self": null,
|
| 651 |
+
"border": null,
|
| 652 |
+
"bottom": null,
|
| 653 |
+
"display": null,
|
| 654 |
+
"flex": null,
|
| 655 |
+
"flex_flow": null,
|
| 656 |
+
"grid_area": null,
|
| 657 |
+
"grid_auto_columns": null,
|
| 658 |
+
"grid_auto_flow": null,
|
| 659 |
+
"grid_auto_rows": null,
|
| 660 |
+
"grid_column": null,
|
| 661 |
+
"grid_gap": null,
|
| 662 |
+
"grid_row": null,
|
| 663 |
+
"grid_template_areas": null,
|
| 664 |
+
"grid_template_columns": null,
|
| 665 |
+
"grid_template_rows": null,
|
| 666 |
+
"height": null,
|
| 667 |
+
"justify_content": null,
|
| 668 |
+
"justify_items": null,
|
| 669 |
+
"left": null,
|
| 670 |
+
"margin": null,
|
| 671 |
+
"max_height": null,
|
| 672 |
+
"max_width": null,
|
| 673 |
+
"min_height": null,
|
| 674 |
+
"min_width": null,
|
| 675 |
+
"object_fit": null,
|
| 676 |
+
"object_position": null,
|
| 677 |
+
"order": null,
|
| 678 |
+
"overflow": null,
|
| 679 |
+
"overflow_x": null,
|
| 680 |
+
"overflow_y": null,
|
| 681 |
+
"padding": null,
|
| 682 |
+
"right": null,
|
| 683 |
+
"top": null,
|
| 684 |
+
"visibility": null,
|
| 685 |
+
"width": null
|
| 686 |
+
}
|
| 687 |
+
},
|
| 688 |
+
"293eeb45c9cd40a9965165eacf601766": {
|
| 689 |
+
"model_module": "@jupyter-widgets/controls",
|
| 690 |
+
"model_name": "DescriptionStyleModel",
|
| 691 |
+
"model_module_version": "1.5.0",
|
| 692 |
+
"state": {
|
| 693 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 694 |
+
"_model_module_version": "1.5.0",
|
| 695 |
+
"_model_name": "DescriptionStyleModel",
|
| 696 |
+
"_view_count": null,
|
| 697 |
+
"_view_module": "@jupyter-widgets/base",
|
| 698 |
+
"_view_module_version": "1.2.0",
|
| 699 |
+
"_view_name": "StyleView",
|
| 700 |
+
"description_width": ""
|
| 701 |
+
}
|
| 702 |
+
}
|
| 703 |
+
}
|
| 704 |
+
}
|
| 705 |
+
},
|
| 706 |
+
"cells": [
|
| 707 |
+
{
|
| 708 |
+
"cell_type": "markdown",
|
| 709 |
+
"source": [
|
| 710 |
+
"# ARCHON: PROFESSIONAL FINANCIAL RESILIENCE ENGINE\n",
|
| 711 |
+
"NLP Classifier, Predictive Risk Model, and NBO Engine"
|
| 712 |
+
],
|
| 713 |
+
"metadata": {
|
| 714 |
+
"id": "H7OAXILJ-uUX"
|
| 715 |
+
}
|
| 716 |
+
},
|
| 717 |
+
{
|
| 718 |
+
"cell_type": "markdown",
|
| 719 |
+
"source": [
|
| 720 |
+
"1. SETUP & INDUSTRIAL DEPENDENCIES"
|
| 721 |
+
],
|
| 722 |
+
"metadata": {
|
| 723 |
+
"id": "PkivgPSQ-1mP"
|
| 724 |
+
}
|
| 725 |
+
},
|
| 726 |
+
{
|
| 727 |
+
"cell_type": "code",
|
| 728 |
+
"source": [
|
| 729 |
+
"!pip install -q transformers[torch] datasets scikit-learn pandas tqdm accelerate gradio huggingface_hub"
|
| 730 |
+
],
|
| 731 |
+
"metadata": {
|
| 732 |
+
"id": "VlAVy9IM-4eu"
|
| 733 |
+
},
|
| 734 |
+
"execution_count": 7,
|
| 735 |
+
"outputs": []
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
"cell_type": "code",
|
| 739 |
+
"source": [
|
| 740 |
+
"import os\n",
|
| 741 |
+
"import torch\n",
|
| 742 |
+
"import logging\n",
|
| 743 |
+
"import pandas as pd\n",
|
| 744 |
+
"import numpy as np\n",
|
| 745 |
+
"from sklearn.model_selection import train_test_split\n",
|
| 746 |
+
"from transformers import (\n",
|
| 747 |
+
" AutoTokenizer,\n",
|
| 748 |
+
" AutoModelForSequenceClassification,\n",
|
| 749 |
+
" TrainingArguments,\n",
|
| 750 |
+
" Trainer,\n",
|
| 751 |
+
" pipeline\n",
|
| 752 |
+
")\n",
|
| 753 |
+
"from datasets import Dataset\n",
|
| 754 |
+
"import gradio as gr"
|
| 755 |
+
],
|
| 756 |
+
"metadata": {
|
| 757 |
+
"id": "tSt3g1kE-7xJ"
|
| 758 |
+
},
|
| 759 |
+
"execution_count": 8,
|
| 760 |
+
"outputs": []
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"cell_type": "code",
|
| 764 |
+
"source": [
|
| 765 |
+
"# Setup Enterprise Logging\n",
|
| 766 |
+
"logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n",
|
| 767 |
+
"logger = logging.getLogger(\"Archon_Core\")"
|
| 768 |
+
],
|
| 769 |
+
"metadata": {
|
| 770 |
+
"id": "AEqdC1wQ-9ZN"
|
| 771 |
+
},
|
| 772 |
+
"execution_count": 9,
|
| 773 |
+
"outputs": []
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"cell_type": "markdown",
|
| 777 |
+
"source": [
|
| 778 |
+
"2. DATA ENGINE: Industrial-Scale Synthetic Generator"
|
| 779 |
+
],
|
| 780 |
+
"metadata": {
|
| 781 |
+
"id": "onooXbhw--ag"
|
| 782 |
+
}
|
| 783 |
+
},
|
| 784 |
+
{
|
| 785 |
+
"cell_type": "code",
|
| 786 |
+
"source": [
|
| 787 |
+
"def generate_archon_dataset(n_samples=3000):\n",
|
| 788 |
+
" # Dataset dirancang untuk melatih IndoBERT memahami narasi bank Indonesia [cite: 84]\n",
|
| 789 |
+
" categories = {\n",
|
| 790 |
+
" \"Income\": [\"GAJI PT {x}\", \"PAYROLL {x}\", \"TRANSFER MASUK DARI {x}\", \"SALARY ADJ\"],\n",
|
| 791 |
+
" \"Bills\": [\"LISTRIK PLN {x}\", \"PDAM KOTA\", \"TAGIHAN TELKOM WIFI\", \"BPJS KESEHATAN\"],\n",
|
| 792 |
+
" \"Transport\": [\"GRAB RIDE\", \"GOJEK INDONESIA\", \"BENSIN PERTAMINA\", \"KRL COMMUTER\"],\n",
|
| 793 |
+
" \"Retail/E-commerce\": [\"SHOPEE {x}\", \"TOKOPEDIA PAYMENT\", \"ALFAMART\", \"INDOMARET\"],\n",
|
| 794 |
+
" \"Cash Withdrawal\": [\"TARIK TUNAI ATM {x}\", \"PENARIKAN TUNAI\", \"ATM BERSAMA\"],\n",
|
| 795 |
+
" \"Transfer Out\": [\"TRANSFER KE REK {x} - PINJAMAN\", \"TRSF KE {x} BAYAR HUTANG\"],\n",
|
| 796 |
+
" \"General Debit\": [\"QRIS KOPI {x}\", \"QRIS RESTO\", \"DEBIT VISA\", \"TXN {x}\"]\n",
|
| 797 |
+
" }\n",
|
| 798 |
+
"\n",
|
| 799 |
+
" cat_to_id = {cat: i for i, cat in enumerate(categories.keys())}\n",
|
| 800 |
+
" data = []\n",
|
| 801 |
+
" for _ in range(n_samples):\n",
|
| 802 |
+
" cat = np.random.choice(list(categories.keys()))\n",
|
| 803 |
+
" noise = str(np.random.randint(100, 9999))\n",
|
| 804 |
+
" text = np.random.choice(categories[cat]).format(x=noise)\n",
|
| 805 |
+
" data.append({\"text\": text, \"label\": cat_to_id[cat]})\n",
|
| 806 |
+
"\n",
|
| 807 |
+
" return pd.DataFrame(data), categories.keys()"
|
| 808 |
+
],
|
| 809 |
+
"metadata": {
|
| 810 |
+
"id": "XMuOL4c7_FQj"
|
| 811 |
+
},
|
| 812 |
+
"execution_count": 10,
|
| 813 |
+
"outputs": []
|
| 814 |
+
},
|
| 815 |
+
{
|
| 816 |
+
"cell_type": "markdown",
|
| 817 |
+
"source": [
|
| 818 |
+
"3. ARCHON INTELLIGENCE SYSTEM (The Unified Engine)"
|
| 819 |
+
],
|
| 820 |
+
"metadata": {
|
| 821 |
+
"id": "tHs-L17i_Hfn"
|
| 822 |
+
}
|
| 823 |
+
},
|
| 824 |
+
{
|
| 825 |
+
"cell_type": "code",
|
| 826 |
+
"source": [
|
| 827 |
+
"class ArchonSystem:\n",
|
| 828 |
+
" def __init__(self, model_path=\"./archon_v1\"):\n",
|
| 829 |
+
" self.model_path = model_path\n",
|
| 830 |
+
" self.categories = [\"Income\", \"Bills\", \"Transport\", \"Retail/E-commerce\", \"Cash Withdrawal\", \"Transfer Out\", \"General Debit\"]\n",
|
| 831 |
+
"\n",
|
| 832 |
+
" if os.path.exists(model_path):\n",
|
| 833 |
+
" self.classifier = pipeline(\"text-classification\", model=model_path, tokenizer=model_path, device=0 if torch.cuda.is_available() else -1)\n",
|
| 834 |
+
" logger.info(\"Archon Engine Loaded Successfully.\")\n",
|
| 835 |
+
" else:\n",
|
| 836 |
+
" logger.warning(\"Model not found. Please run training section first.\")\n",
|
| 837 |
+
"\n",
|
| 838 |
+
" # PILLAR 1: NLP Transaction Classifier [cite: 83, 174]\n",
|
| 839 |
+
" def get_category(self, text):\n",
|
| 840 |
+
" pred = self.classifier(text)[0]\n",
|
| 841 |
+
" label_id = int(pred['label'].split('_')[-1])\n",
|
| 842 |
+
" return self.categories[label_id], pred['score']\n",
|
| 843 |
+
"\n",
|
| 844 |
+
" # PILLAR 2: Machine Learning Predictive Model (Early Warning System) [cite: 85, 174]\n",
|
| 845 |
+
" def predict_risk(self, category, amount, income, monthly_spending):\n",
|
| 846 |
+
" risk_score = 0.05\n",
|
| 847 |
+
"\n",
|
| 848 |
+
" # Deteksi Overspending (Pilar 2) [cite: 85, 91]\n",
|
| 849 |
+
" ratio = amount / income if income > 0 else 0\n",
|
| 850 |
+
" if ratio >= 0.25: risk_score += 0.45\n",
|
| 851 |
+
"\n",
|
| 852 |
+
" spend_rate = monthly_spending / income if income > 0 else 0\n",
|
| 853 |
+
" if spend_rate >= 0.85: risk_score += 0.35\n",
|
| 854 |
+
"\n",
|
| 855 |
+
" # Kategori Berisiko Tinggi [cite: 172]\n",
|
| 856 |
+
" if category in [\"Cash Withdrawal\", \"Transfer Out\"]: risk_score += 0.10\n",
|
| 857 |
+
"\n",
|
| 858 |
+
" risk_score = np.clip(risk_score, 0.0, 1.0)\n",
|
| 859 |
+
" level = \"High\" if risk_score >= 0.6 else (\"Medium\" if risk_score >= 0.3 else \"Low\")\n",
|
| 860 |
+
" return level, float(risk_score)\n",
|
| 861 |
+
"\n",
|
| 862 |
+
" # PILLAR 3: Next Best Offer (NBO) Engine [cite: 87, 174]\n",
|
| 863 |
+
" def nbo_engine(self, category, risk_level):\n",
|
| 864 |
+
" if risk_level == \"High\":\n",
|
| 865 |
+
" return \"Set immediate budget alert + suggest emergency saving plan; show debt counseling resources.\"\n",
|
| 866 |
+
"\n",
|
| 867 |
+
" if category == \"Income\":\n",
|
| 868 |
+
" return \"Recommend automatic split: 10% to Emergency Fund, 5% to Investments.\"\n",
|
| 869 |
+
" elif category in [\"Retail/E-commerce\", \"General Debit\"]:\n",
|
| 870 |
+
" return \"Offer discount coupons / loyalty suggestion or roundup saving feature.\"\n",
|
| 871 |
+
"\n",
|
| 872 |
+
" return \"Maintain current budget; propose small Auto-Save (Rp20k/day).\""
|
| 873 |
+
],
|
| 874 |
+
"metadata": {
|
| 875 |
+
"id": "OfuaW2lD_L1_"
|
| 876 |
+
},
|
| 877 |
+
"execution_count": 11,
|
| 878 |
+
"outputs": []
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"cell_type": "markdown",
|
| 882 |
+
"source": [
|
| 883 |
+
"4. TRAINING SECTION"
|
| 884 |
+
],
|
| 885 |
+
"metadata": {
|
| 886 |
+
"id": "-NIXVZV4_SKq"
|
| 887 |
+
}
|
| 888 |
+
},
|
| 889 |
+
{
|
| 890 |
+
"cell_type": "code",
|
| 891 |
+
"source": [
|
| 892 |
+
"df, cat_list = generate_archon_dataset(2000)\n",
|
| 893 |
+
"train_df, val_df = train_test_split(df, test_size=0.15)\n",
|
| 894 |
+
"\n",
|
| 895 |
+
"model_name = \"indobenchmark/indobert-base-p1\"\n",
|
| 896 |
+
"tokenizer = AutoTokenizer.from_pretrained(model_name)\n",
|
| 897 |
+
"\n",
|
| 898 |
+
"def tokenize_fn(x):\n",
|
| 899 |
+
" return tokenizer(x[\"text\"], padding=\"max_length\", truncation=True, max_length=64)\n",
|
| 900 |
+
"\n",
|
| 901 |
+
"train_ds = Dataset.from_pandas(train_df).map(tokenize_fn, batched=True)\n",
|
| 902 |
+
"val_ds = Dataset.from_pandas(val_df).map(tokenize_fn, batched=True)\n",
|
| 903 |
+
"\n",
|
| 904 |
+
"model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=7)\n",
|
| 905 |
+
"\n",
|
| 906 |
+
"training_args = TrainingArguments(\n",
|
| 907 |
+
" output_dir=\"./archon_v1\",\n",
|
| 908 |
+
" num_train_epochs=3,\n",
|
| 909 |
+
" eval_strategy=\"epoch\",\n",
|
| 910 |
+
" save_strategy=\"epoch\",\n",
|
| 911 |
+
" report_to=\"none\",\n",
|
| 912 |
+
" load_best_model_at_end=True\n",
|
| 913 |
+
")\n",
|
| 914 |
+
"\n",
|
| 915 |
+
"trainer = Trainer(\n",
|
| 916 |
+
" model=model,\n",
|
| 917 |
+
" args=training_args,\n",
|
| 918 |
+
" train_dataset=train_ds,\n",
|
| 919 |
+
" eval_dataset=val_ds\n",
|
| 920 |
+
")\n",
|
| 921 |
+
"\n",
|
| 922 |
+
"trainer.train()\n",
|
| 923 |
+
"model.save_pretrained(\"./archon_v1\")\n",
|
| 924 |
+
"tokenizer.save_pretrained(\"./archon_v1\")"
|
| 925 |
+
],
|
| 926 |
+
"metadata": {
|
| 927 |
+
"colab": {
|
| 928 |
+
"base_uri": "https://localhost:8080/",
|
| 929 |
+
"height": 375,
|
| 930 |
+
"referenced_widgets": [
|
| 931 |
+
"293f2d1bd51649f498dce24d428e6cba",
|
| 932 |
+
"872414d8fd3a4c41af5710e7dda3b83d",
|
| 933 |
+
"b7a67689c45e41c5bd204206cd39ae44",
|
| 934 |
+
"aa266ef6570f4cbead12481662718cb6",
|
| 935 |
+
"e4807d727df14568806874d8207c270b",
|
| 936 |
+
"2fe7fec5c72645eaa20255aaa3a00139",
|
| 937 |
+
"9157018bce84419da17ebc8cbc0ed0f8",
|
| 938 |
+
"2e5eb516aec746418e599cd55810b0e5",
|
| 939 |
+
"dd17cebd28174846a343865e236ca0a0",
|
| 940 |
+
"67f65a87b5594a71b5247d5b71e426ee",
|
| 941 |
+
"14a7dda6889241dc9b0f468dfcef5ef2",
|
| 942 |
+
"81a83bcd3334462f84baf7fcbb9c2641",
|
| 943 |
+
"0c8287f51f17432d98613c5cfab8bb74",
|
| 944 |
+
"e9230b54e5a649919d175a8e19f0e84a",
|
| 945 |
+
"5b29d6cd6dff46359576c2d62f2cfe40",
|
| 946 |
+
"25019bd15d0d42519fe64176c56194d7",
|
| 947 |
+
"4f0d22b228b443ceba4e030fa87aa062",
|
| 948 |
+
"051bc22d52354ce7b2526a9625b0dbf8",
|
| 949 |
+
"ea057ae4402b4f49af81e8cbf81ef7d6",
|
| 950 |
+
"bd16e0909f5b499ab6651c3ca6a74d29",
|
| 951 |
+
"fa30a14194964f73a89fabd2dc700366",
|
| 952 |
+
"293eeb45c9cd40a9965165eacf601766"
|
| 953 |
+
]
|
| 954 |
+
},
|
| 955 |
+
"id": "m-NbiKSY_Vgv",
|
| 956 |
+
"outputId": "92907783-ce2b-43ba-c85a-1abf59248c2e"
|
| 957 |
+
},
|
| 958 |
+
"execution_count": 12,
|
| 959 |
+
"outputs": [
|
| 960 |
+
{
|
| 961 |
+
"output_type": "display_data",
|
| 962 |
+
"data": {
|
| 963 |
+
"text/plain": [
|
| 964 |
+
"Map: 0%| | 0/1700 [00:00<?, ? examples/s]"
|
| 965 |
+
],
|
| 966 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 967 |
+
"version_major": 2,
|
| 968 |
+
"version_minor": 0,
|
| 969 |
+
"model_id": "293f2d1bd51649f498dce24d428e6cba"
|
| 970 |
+
}
|
| 971 |
+
},
|
| 972 |
+
"metadata": {}
|
| 973 |
+
},
|
| 974 |
+
{
|
| 975 |
+
"output_type": "display_data",
|
| 976 |
+
"data": {
|
| 977 |
+
"text/plain": [
|
| 978 |
+
"Map: 0%| | 0/300 [00:00<?, ? examples/s]"
|
| 979 |
+
],
|
| 980 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 981 |
+
"version_major": 2,
|
| 982 |
+
"version_minor": 0,
|
| 983 |
+
"model_id": "81a83bcd3334462f84baf7fcbb9c2641"
|
| 984 |
+
}
|
| 985 |
+
},
|
| 986 |
+
"metadata": {}
|
| 987 |
+
},
|
| 988 |
+
{
|
| 989 |
+
"output_type": "stream",
|
| 990 |
+
"name": "stderr",
|
| 991 |
+
"text": [
|
| 992 |
+
"Some weights of BertForSequenceClassification were not initialized from the model checkpoint at indobenchmark/indobert-base-p1 and are newly initialized: ['classifier.bias', 'classifier.weight']\n",
|
| 993 |
+
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
|
| 994 |
+
]
|
| 995 |
+
},
|
| 996 |
+
{
|
| 997 |
+
"output_type": "display_data",
|
| 998 |
+
"data": {
|
| 999 |
+
"text/plain": [
|
| 1000 |
+
"<IPython.core.display.HTML object>"
|
| 1001 |
+
],
|
| 1002 |
+
"text/html": [
|
| 1003 |
+
"\n",
|
| 1004 |
+
" <div>\n",
|
| 1005 |
+
" \n",
|
| 1006 |
+
" <progress value='639' max='639' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
|
| 1007 |
+
" [639/639 03:13, Epoch 3/3]\n",
|
| 1008 |
+
" </div>\n",
|
| 1009 |
+
" <table border=\"1\" class=\"dataframe\">\n",
|
| 1010 |
+
" <thead>\n",
|
| 1011 |
+
" <tr style=\"text-align: left;\">\n",
|
| 1012 |
+
" <th>Epoch</th>\n",
|
| 1013 |
+
" <th>Training Loss</th>\n",
|
| 1014 |
+
" <th>Validation Loss</th>\n",
|
| 1015 |
+
" </tr>\n",
|
| 1016 |
+
" </thead>\n",
|
| 1017 |
+
" <tbody>\n",
|
| 1018 |
+
" <tr>\n",
|
| 1019 |
+
" <td>1</td>\n",
|
| 1020 |
+
" <td>No log</td>\n",
|
| 1021 |
+
" <td>0.000906</td>\n",
|
| 1022 |
+
" </tr>\n",
|
| 1023 |
+
" <tr>\n",
|
| 1024 |
+
" <td>2</td>\n",
|
| 1025 |
+
" <td>No log</td>\n",
|
| 1026 |
+
" <td>0.000513</td>\n",
|
| 1027 |
+
" </tr>\n",
|
| 1028 |
+
" <tr>\n",
|
| 1029 |
+
" <td>3</td>\n",
|
| 1030 |
+
" <td>0.042600</td>\n",
|
| 1031 |
+
" <td>0.000434</td>\n",
|
| 1032 |
+
" </tr>\n",
|
| 1033 |
+
" </tbody>\n",
|
| 1034 |
+
"</table><p>"
|
| 1035 |
+
]
|
| 1036 |
+
},
|
| 1037 |
+
"metadata": {}
|
| 1038 |
+
},
|
| 1039 |
+
{
|
| 1040 |
+
"output_type": "execute_result",
|
| 1041 |
+
"data": {
|
| 1042 |
+
"text/plain": [
|
| 1043 |
+
"('./archon_v1/tokenizer_config.json',\n",
|
| 1044 |
+
" './archon_v1/special_tokens_map.json',\n",
|
| 1045 |
+
" './archon_v1/vocab.txt',\n",
|
| 1046 |
+
" './archon_v1/added_tokens.json',\n",
|
| 1047 |
+
" './archon_v1/tokenizer.json')"
|
| 1048 |
+
]
|
| 1049 |
+
},
|
| 1050 |
+
"metadata": {},
|
| 1051 |
+
"execution_count": 12
|
| 1052 |
+
}
|
| 1053 |
+
]
|
| 1054 |
+
},
|
| 1055 |
+
{
|
| 1056 |
+
"cell_type": "markdown",
|
| 1057 |
+
"source": [
|
| 1058 |
+
"5. Demo and deploy"
|
| 1059 |
+
],
|
| 1060 |
+
"metadata": {
|
| 1061 |
+
"id": "u75si8IH_Xu7"
|
| 1062 |
+
}
|
| 1063 |
+
},
|
| 1064 |
+
{
|
| 1065 |
+
"cell_type": "code",
|
| 1066 |
+
"source": [
|
| 1067 |
+
"archon = ArchonSystem(\"./archon_v1\")\n",
|
| 1068 |
+
"\n",
|
| 1069 |
+
"def archon_final_demo(text, amount, income, monthly_spending):\n",
|
| 1070 |
+
" # Pilar 1: Klasifikasi Semantik (NLP)\n",
|
| 1071 |
+
" cat, conf = archon.get_category(text)\n",
|
| 1072 |
+
"\n",
|
| 1073 |
+
" # Pilar 2: Analisis Risiko Prediktif (ML)\n",
|
| 1074 |
+
" risk_lv, risk_sc = archon.predict_risk(cat, amount, income, monthly_spending)\n",
|
| 1075 |
+
"\n",
|
| 1076 |
+
" # Pilar 3: Rekomendasi Penawaran (NBO)\n",
|
| 1077 |
+
" rec = archon.nbo_engine(cat, risk_lv)\n",
|
| 1078 |
+
"\n",
|
| 1079 |
+
" return {\n",
|
| 1080 |
+
" \"Transaction Category (NLP)\": f\"{cat} (Confidence: {conf*100:.2f}%)\",\n",
|
| 1081 |
+
" \"Predictive Risk Assessment\": f\"Level: {risk_lv} (Score: {risk_sc:.2f})\",\n",
|
| 1082 |
+
" \"Next Best Offer (NBO)\": rec\n",
|
| 1083 |
+
" }\n",
|
| 1084 |
+
"\n",
|
| 1085 |
+
"# UI Skala Profesional untuk Presentasi\n",
|
| 1086 |
+
"demo = gr.Interface(\n",
|
| 1087 |
+
" fn=archon_final_demo,\n",
|
| 1088 |
+
" inputs=[\n",
|
| 1089 |
+
" gr.Textbox(label=\"Transaction Narrative\", placeholder=\"e.g. TRSF DARI PT MAJU GAJI NOV\"),\n",
|
| 1090 |
+
" gr.Number(label=\"Transaction Amount (IDR)\"),\n",
|
| 1091 |
+
" gr.Number(label=\"User Monthly Income (IDR)\"),\n",
|
| 1092 |
+
" gr.Number(label=\"Total Spending This Month (IDR)\")\n",
|
| 1093 |
+
" ],\n",
|
| 1094 |
+
" outputs=gr.JSON(label=\"Archon Engine Analysis Output\"),\n",
|
| 1095 |
+
" title=\"🛡️ Archon AI: Financial Resilience Engine\",\n",
|
| 1096 |
+
" description=\"Sistem ini mengintegrasikan NLP Classifier, Predictive Risk, dan NBO Engine.\",\n",
|
| 1097 |
+
" theme=\"soft\"\n",
|
| 1098 |
+
")\n",
|
| 1099 |
+
"\n",
|
| 1100 |
+
"demo.launch(share=True)"
|
| 1101 |
+
],
|
| 1102 |
+
"metadata": {
|
| 1103 |
+
"colab": {
|
| 1104 |
+
"base_uri": "https://localhost:8080/",
|
| 1105 |
+
"height": 628
|
| 1106 |
+
},
|
| 1107 |
+
"id": "RqTclVz0DYay",
|
| 1108 |
+
"outputId": "b2668db5-02d6-417f-a953-e3d23e8b6749"
|
| 1109 |
+
},
|
| 1110 |
+
"execution_count": 14,
|
| 1111 |
+
"outputs": [
|
| 1112 |
+
{
|
| 1113 |
+
"output_type": "stream",
|
| 1114 |
+
"name": "stderr",
|
| 1115 |
+
"text": [
|
| 1116 |
+
"Device set to use cuda:0\n"
|
| 1117 |
+
]
|
| 1118 |
+
},
|
| 1119 |
+
{
|
| 1120 |
+
"output_type": "stream",
|
| 1121 |
+
"name": "stdout",
|
| 1122 |
+
"text": [
|
| 1123 |
+
"Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n",
|
| 1124 |
+
"* Running on public URL: https://60b757fdd7d9c12077.gradio.live\n",
|
| 1125 |
+
"\n",
|
| 1126 |
+
"This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n"
|
| 1127 |
+
]
|
| 1128 |
+
},
|
| 1129 |
+
{
|
| 1130 |
+
"output_type": "display_data",
|
| 1131 |
+
"data": {
|
| 1132 |
+
"text/plain": [
|
| 1133 |
+
"<IPython.core.display.HTML object>"
|
| 1134 |
+
],
|
| 1135 |
+
"text/html": [
|
| 1136 |
+
"<div><iframe src=\"https://60b757fdd7d9c12077.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 1137 |
+
]
|
| 1138 |
+
},
|
| 1139 |
+
"metadata": {}
|
| 1140 |
+
},
|
| 1141 |
+
{
|
| 1142 |
+
"output_type": "execute_result",
|
| 1143 |
+
"data": {
|
| 1144 |
+
"text/plain": []
|
| 1145 |
+
},
|
| 1146 |
+
"metadata": {},
|
| 1147 |
+
"execution_count": 14
|
| 1148 |
+
}
|
| 1149 |
+
]
|
| 1150 |
+
}
|
| 1151 |
+
]
|
| 1152 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
pandas
|
| 4 |
+
numpy
|