<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Avijit Aditya.</title>
    <description>The latest articles on DEV Community by Avijit Aditya. (@avijit_aditya_0ab6b2742e).</description>
    <link>https://dev.to/avijit_aditya_0ab6b2742e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4178233%2F5278a630-0e38-49ac-95ea-0136d07e0379.jpg</url>
      <title>DEV Community: Avijit Aditya.</title>
      <link>https://dev.to/avijit_aditya_0ab6b2742e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avijit_aditya_0ab6b2742e"/>
    <language>en</language>
    <item>
      <title>PaySafe India — Real-Time UPI Fraud Detection with Open-Source ML (No Cloud Required)</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 27 Oct 2026 03:09:07 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/paysafe-india-real-time-upi-fraud-detection-with-open-source-ml-no-cloud-required-2oko</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/paysafe-india-real-time-upi-fraud-detection-with-open-source-ml-no-cloud-required-2oko</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PaySafe India&lt;/strong&gt; is an end-to-end UPI transaction fraud detection system powered entirely by open-source machine learning — trained locally, served locally, and explained locally. No cloud API. No data leaving your machine. No monthly bill.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;ghost in the machine&lt;/strong&gt; here is invisible and everywhere: the silent, algorithmic haunting of over a billion digital payments that happen every single day in India through UPI. Most people never think about the unseen intelligence that decides, in milliseconds, whether their ₹500 chai payment is real — or a ghost transaction sliding money out of their account at 2 AM from a device they've never touched.&lt;/p&gt;

&lt;p&gt;This project makes that invisible intelligence &lt;em&gt;visible&lt;/em&gt;, &lt;em&gt;auditable&lt;/em&gt;, and &lt;em&gt;yours&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The spirit of Día de los Muertos — the thin veil between the living and the dead — maps perfectly onto fraud: the ghost of a transaction that &lt;em&gt;looks&lt;/em&gt; legitimate but isn't. PaySafe India lifts that veil in real time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The Flask web app runs locally at &lt;code&gt;http://127.0.0.1:5000&lt;/code&gt; after a one-time training run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Live features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔴 Real-time fraud probability score (0–100%)&lt;/li&gt;
&lt;li&gt;⚠️ Risk band: Low / Medium / High&lt;/li&gt;
&lt;li&gt;🔍 Counterfactual explainability — "which 3 signals drove this score, and by how much?"&lt;/li&gt;
&lt;li&gt;🎛️ Pre-loaded presets: &lt;code&gt;Typical transaction&lt;/code&gt; vs &lt;code&gt;Suspicious transaction&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;📡 REST API endpoint &lt;code&gt;/api/predict&lt;/code&gt; for integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Headline model results on the held-out test set (5,279 transactions):&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Precision&lt;/th&gt;
&lt;th&gt;Recall&lt;/th&gt;
&lt;th&gt;F1&lt;/th&gt;
&lt;th&gt;ROC-AUC&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Logistic Regression&lt;/td&gt;
&lt;td&gt;0.962&lt;/td&gt;
&lt;td&gt;0.884&lt;/td&gt;
&lt;td&gt;0.921&lt;/td&gt;
&lt;td&gt;0.965&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Decision Tree&lt;/td&gt;
&lt;td&gt;0.926&lt;/td&gt;
&lt;td&gt;0.891&lt;/td&gt;
&lt;td&gt;0.908&lt;/td&gt;
&lt;td&gt;0.962&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Random Forest (deployed ✅)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.983&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.879&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.928&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.969&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SVM (RBF)&lt;/td&gt;
&lt;td&gt;0.996&lt;/td&gt;
&lt;td&gt;0.866&lt;/td&gt;
&lt;td&gt;0.926&lt;/td&gt;
&lt;td&gt;0.966&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;A "predict everything legitimate" dummy baseline scores &lt;strong&gt;82.8% accuracy with 0% recall&lt;/strong&gt; — a model that catches &lt;em&gt;zero&lt;/em&gt; fraud. This is why accuracy is not the metric to use for imbalanced fraud data.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The full project is structured as a progressive pipeline of numbered scripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upi_fraud_project/
├── config.py / utils.py          # shared paths, feature list, preprocessing pipeline
├── 00_Dataset_Selection.py       # evidence for dataset choice (baseline on every dataset)
├── 01_NumPy_Foundations.py       # arrays, masks, broadcasting, vectorisation
├── 02_Pandas_DataCleaning.py     # missing values, duplicates, IQR outliers, merge
├── 03_Visualization.py           # 13 chart types
├── 04_Encoding_Preprocessing.py  # leakage audit, encoding, scaling, stratified split
├── 05_KMeans_Unsupervised.py     # elbow, silhouette, PCA, cluster profiles, anomaly score
├── 06_SupervisedModels.py        # 4 models, CV, threshold trade-off, saves deployed model
├── app/
│   ├── app.py                    # Flask web app with REST API
│   └── templates/index.html      # dark-mode UI with counterfactual explainability
└── models/
    ├── fraud_model.joblib        # deployed scikit-learn pipeline
    └── model_meta.json           # feature names, thresholds, medians for defaults
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run it:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &amp;lt;your-repo&amp;gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
python run_all.py        &lt;span class="c"&gt;# trains all models in ~2-3 minutes&lt;/span&gt;
python app/app.py        &lt;span class="c"&gt;# opens http://127.0.0.1:5000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Open-Source Stack
&lt;/h3&gt;

&lt;p&gt;Every single component is open-source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;scikit-learn&lt;/strong&gt; — four classifiers (Logistic Regression, Decision Tree, Random Forest, SVM), cross-validation, preprocessing pipelines, and K-Means unsupervised clustering&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pandas&lt;/strong&gt; + &lt;strong&gt;NumPy&lt;/strong&gt; — data cleaning, feature engineering, leakage auditing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;matplotlib&lt;/strong&gt; + &lt;strong&gt;seaborn&lt;/strong&gt; — 13 chart types for EDA and model evaluation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;joblib&lt;/strong&gt; — model serialization for the Flask deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flask&lt;/strong&gt; — lightweight local web server with REST API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No LLM. No cloud ML service. No API keys. Just classical ML running at full speed on a laptop.&lt;/p&gt;

&lt;h3&gt;
  
  
  The ML Pipeline
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Dataset selection with a leakage audit&lt;/strong&gt;&lt;br&gt;
The most important step that most tutorials skip. I evaluated three datasets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;fraud_dataset.csv&lt;/code&gt; (26,393 rows, 17.2% fraud) — chosen ✅ — AUC 0.97 with behavioral features&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;upi_transactions_2024.csv&lt;/code&gt; (250,000 rows, 0.19% fraud) — AUC 0.55, no signal&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;upi_fraud_india_dataset.csv&lt;/code&gt; (1,000 rows, 100% fraud) — impossible to classify against&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Script 04 automates the leakage audit: any single feature with AUC ≥ 0.94 is a leak. Four columns (&lt;code&gt;receiver_account_age&lt;/code&gt;, &lt;code&gt;receiver_transaction_history&lt;/code&gt;, &lt;code&gt;merchant_category_code&lt;/code&gt;, &lt;code&gt;handle_verification_status&lt;/code&gt;) were purged. Without this, Random Forest scores AUC &lt;strong&gt;1.000&lt;/strong&gt; — a model that "cheats" on training data and will fail in production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The feature set that actually generalises&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The deployed model uses 14 numeric + 2 categorical behavioral features:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;NUMERIC_FEATURES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;transaction_time_of_day&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;transaction_amount_vs_sender_history&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;authentication_attempts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;failed_transaction_count&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;unusual_device_flag&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;unusual_ip_flag&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;time_pressure_indicators&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_timing_consistency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pin_entry_speed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;transaction_velocity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;otp_request_frequency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session_duration&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;geographic_disparity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;CATEGORICAL_FEATURES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session_source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pin_entry_method&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are &lt;em&gt;behavioural telemetry&lt;/em&gt; signals — the digital fingerprints of how a human actually interacts with a payment app vs. how a script or social-engineering victim does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Unsupervised pre-check (K-Means)&lt;/strong&gt;&lt;br&gt;
Before any labelled training, K-Means clustering on the full dataset finds one tight cluster that is &lt;strong&gt;100% fraud&lt;/strong&gt;. Ranking transactions by distance-to-centroid puts &lt;strong&gt;99% of all fraud in the top 10% of anomalies&lt;/strong&gt;. This is a free anomaly detection layer that requires no labels at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Four supervised classifiers, chosen by cross-validation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All models are trained inside a unified &lt;code&gt;Pipeline(preprocessor → model)&lt;/code&gt; so that scaling and encoding are always fitted on training data only — no leakage from the test set.&lt;/p&gt;

&lt;p&gt;The deployed model is chosen by &lt;strong&gt;5-fold stratified CV F1 on the training set&lt;/strong&gt;, not by test-set performance. Peeking at the test set to pick a model is a form of overfitting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;best&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;deployable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cv_f1_mean&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;idxmax&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Counterfactual explainability in the Flask app&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The hardest part — and the most useful one. For every scored transaction, the app shows &lt;em&gt;why&lt;/em&gt; it was flagged:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;drivers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;How much would the score drop if this ONE input were typical?&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;FIELDS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;alt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;default&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# reset to legit median
&lt;/span&gt;        &lt;span class="n"&gt;drop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;base_p&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;drop&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;label&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;drop&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])[:&lt;/span&gt;&lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is &lt;strong&gt;counterfactual attribution&lt;/strong&gt;: for each signal, ask "if this were normal, how much would the risk score fall?" The top three drivers are shown to the user in plain English — not just a probability, but a reason.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Your payment data never leaves your machine
&lt;/h3&gt;

&lt;p&gt;This is a fraud detector. The inputs are transaction amounts, authentication attempts, device anomalies, and geographic disparity. In India, sending this data to a third-party cloud API is not just a privacy concern — it is a regulatory one. PaySafe India runs entirely on-device. The model is a &lt;code&gt;fraud_model.joblib&lt;/code&gt; file. No HTTP call is ever made to score a transaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. You own the model — and can change what it flags
&lt;/h3&gt;

&lt;p&gt;With a closed API, fraud thresholds are decided by whoever runs the service. With PaySafe India, you can retrain with &lt;code&gt;python run_all.py&lt;/code&gt;, adjust the threshold trade-off table printed by Script 06, and redeploy in minutes. The threshold is a business decision, not a black-box setting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;threshold  precision  recall  f1   missed_fraud  false_alarms
  0.2       0.854     0.969  0.908      28          132
  0.5       0.983     0.879  0.928     110           14
  0.8       0.996     0.700  0.821     272            3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bank might accept 132 false alarms to miss only 28 frauds. A startup might flip the tradeoff. &lt;strong&gt;You decide.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. It works with the internet off
&lt;/h3&gt;

&lt;p&gt;No API keys. No model download at runtime. No cloud inference. Train once, run forever, offline. In a country where rural internet connectivity is still unreliable, this matters.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The leakage audit is part of the open process
&lt;/h3&gt;

&lt;p&gt;Open-source ML means you &lt;em&gt;see&lt;/em&gt; the audit trail. Script 04 explicitly prints every feature it tests, every one it rejects, and why. Script 00 runs every dataset through a baseline model and reports AUC, so you can defend your dataset choice. This kind of transparency is not possible with a closed API — you just get a score and a label.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. The ghost cannot be locked in a box
&lt;/h3&gt;

&lt;p&gt;Fraud detection built on a closed API disappears the day the service shuts down, pivots, or raises its price. This project — the data pipeline, the trained weights, the Flask app — lives on a filesystem. It is version-controlled. It can be forked, fine-tuned, and kept alive indefinitely.&lt;/p&gt;

&lt;p&gt;That is the open-source answer to the ghost-in-the-machine problem: the ghost is ours now, and it doesn't vanish at someone else's discretion.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;p&gt;For the 600 million Indians who actively use UPI, a fraudulent transaction is not an abstract data-science problem. It is rent money gone at 2 AM. It is a retirement fund drained while someone sleeps.&lt;/p&gt;

&lt;p&gt;The "ghost in the machine" is exactly right: there is already an invisible intelligence inside every payment system, deciding in milliseconds what passes and what gets blocked. Most people never see it, never understand it, and never get to question its decisions.&lt;/p&gt;

&lt;p&gt;Building this with open-source tools — and making the explainability layer front-and-center in the UI — is a small act of making that ghost &lt;em&gt;visible&lt;/em&gt;. Not spooky. Understood.&lt;/p&gt;

&lt;p&gt;The moment it landed for me was running the leakage audit for the first time and watching a Random Forest score AUC 1.000 on a training set — a perfect score that was a lie. The ghost had been cheating, and the open code showed exactly how.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Ghost in the Machine — Open-Source AI Challenge, Week 4&lt;/em&gt;&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>4th</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 27 Oct 2026 03:00:48 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/4th-2imj</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/4th-2imj</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>w4</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 27 Oct 2026 02:58:24 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/w4-5dpp</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/w4-5dpp</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>weak4</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 27 Oct 2026 02:57:39 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/weak4-31fe</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/weak4-31fe</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>4</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 27 Oct 2026 02:56:32 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/4-4ak8</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/4-4ak8</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>2</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:13:46 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/2-1iod</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/2-1iod</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>second</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:11:14 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/second-22dh</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/second-22dh</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>second one</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 20 Oct 2026 04:10:46 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/second-one-1c15</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/second-one-1c15</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>1st project</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Tue, 13 Oct 2026 17:18:46 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/1st-project-5e15</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/1st-project-5e15</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week2-2026-10-12"&gt;Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My First User
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>New here</title>
      <dc:creator>Avijit Aditya.</dc:creator>
      <pubDate>Mon, 12 Oct 2026 03:55:37 +0000</pubDate>
      <link>https://dev.to/avijit_aditya_0ab6b2742e/new-here-hn5</link>
      <guid>https://dev.to/avijit_aditya_0ab6b2742e/new-here-hn5</guid>
      <description>&lt;p&gt;Hello people..&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
