Skip to content

AIstatistican/KAN_STEMI_CIN_risk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KAN-based CIN+ Risk Prediction

This repository trains a KAN model on MAGGIC.xlsx and provides an inference utility to predict per-patient probability of CIN+.

Quickstart

  1. Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
  1. Use the pre-trained model (no training needed)
  • Artifacts are already included in artifacts/: best_kan_model.pth, encoders.joblib, scaler.joblib, feature_config.json, synonyms.json.
  • Go directly to prediction via Python API, CLI, or Gradio UI below.
  1. Predict for a single patient (Python API)
from KAN_app import predict_cin_probability

patient = {
  # Numeric
  "maggic_score": 32,
  "HGB": 11.0,
  "PLT": 210,
  "neutrophils": 6.2,   # alias for NE
  "MO": 0.8,
  "LY": 1.2,
  "RDW": 15.8,
  "CRP": 12.0,
  "troponin": 0.08,      # alias for TROP
  "albumin": 3.1,        # alias for alb
  "LDL": 150,
  "HDL": 35,
  "triglycerides": 220,  # alias for tg
  "stent_diameter": 2.5, # alias for stentdiameter
  "Pain-to-balloon time": 120, # alias for time
  "contrast_volume": 180,# alias for ContrastVolume
  "plasma_osmolality": 300, # alias for plasmaOsm

  # Categorical (english-friendly)
  "hypertension": "Yes",       # alias for HT
  "previous_cad": "Yes",       # alias for previousCAD
  "multiple_lesion": "Yes",    # alias for multiplelesion
  "procedure": "Yes"
}
print(predict_cin_probability(patient))
  1. Predict via CLI for JSON/CSV
python test_kan.py --json /path/to/patient.json
python test_kan.py --csv /path/to/patients.csv --out /path/to/patients_scored.csv

Input Schema

  • Numeric features (case-insensitive, aliases supported as above):
    • MAGGIC_score, HGB, PLT, NE (alias: neutrophils), MO, LY, RDW, CRP, TROP (alias: troponin), alb (alias: albumin), LDL, HDL, tg (alias: triglycerides), stentdiameter (alias: stent_diameter), time (aliases: procedure_time, Pain-to-balloon time), ContrastVolume (alias: contrast_volume), plasmaOsm (aliases: plasma_osm, plasma_osmolality)
  • Categorical features (english-friendly values accepted):
    • HT (aliases: hypertension, high_blood_pressure)
    • previousCAD (aliases: previous_cad, prior_cad, history_of_cad)
    • multiplelesion (aliases: multiple_lesion, multi_lesion)
    • procedure

Accepted categorical values

Yes/No, True/False, 1/0, +/-, Present/Absent, Evet/Hayır, Var/Yok. These are normalized to the classes observed during training using artifacts/synonyms.json.

Notes

  • Gradio web UI (local)

Run a local UI to input values and get probability predictions.

source .venv/bin/activate
python gradio_app.py

Then open the printed local URL (usually http://127.0.0.1:7860) in your browser.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages