Hemaclass AI Diagnostics: Clinical Decision Support System
An explainable ensemble-based diagnostic tool optimized for Malaria, Sickle Cell Anemia (SCA), and Co-infection classification in Western Kenya.
π¬ Model Details
- Architecture: Stacking Ensemble (RF, SVM, XGBoost) with a Logistic Regression Meta-Learner.
- Explainability: Integrated SHAP waterfall plots for local feature importance.
- Preprocessing: MICE Imputation, SMOTE balancing, and Z-Score Normalization.
π Quick Usage (Inference Code)
To use this model programmatically, ensure you have your .pkl artifacts in the local directory.
import joblib
import pandas as pd
import numpy as np
# 1. Load Artifacts
model = joblib.load('ensemble_model.pkl')
scaler = joblib.load('scaler.pkl')
imputer = joblib.load('imputer.pkl')
FEATURES = joblib.load('feature_names.pkl')
target_names = ['Negative', 'Malaria', 'SCA', 'Co-infection']
def predict_patient(data_dict):
"""
Input: Dictionary of patient vitals/labs
Output: Predicted Diagnosis and Confidence
"""
# Create DataFrame and align features
df = pd.DataFrame([data_dict])
for col in set(FEATURES) - set(df.columns):
df[col] = np.nan
df = df[FEATURES]
# Preprocess
X_imp = imputer.transform(df)
X_scaled = scaler.transform(X_imp)
# Inference
pred = model.predict(X_scaled)
prob = np.max(model.predict_proba(X_scaled))
return {
"Diagnosis": target_names[pred],
"Confidence": f"{prob*100:.2f}%"
}
# Example Usage:
patient_data = {'age': 25, 'hb': 10.5, 'temp': 38.5, 'malaria_rdt': 1}
print(predict_patient(patient_data))
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support