Health / README.md
Av1447's picture
Upload folder using huggingface_hub
4f253a5 verified
|
Raw History Blame Contribute Delete
3.78 kB
---
language:
- en
license: mit
library_name: sklearn
tags:
- tabular-classification
- healthcare
- medical
- disease-prediction
- ensemble
- scikit-learn
metrics:
- accuracy
model-index:
- name: AI-Driven Healthcare Disease Prediction Ensemble
results:
- task:
type: tabular-classification
name: Disease Classification
metrics:
- type: accuracy
value: 0.1333
name: Test Accuracy
---
# ๐Ÿฉบ AI-Driven Healthcare Disease Prediction Ensemble
A multi-model ensemble classifier built with **Scikit-Learn** combining **Random Forest**, **Support Vector Machines (RBF Kernel)**, and **Gaussian Naive Bayes** to predict clinical pathologies from patient symptom indicators.
## ๐Ÿš€ Model Details
- **Architecture**: `VotingClassifier` with soft probability voting
- **Sub-Estimators**:
- `RandomForestClassifier` (100 estimators, Gini criterion) โ€” Weight: `0.40`
- `SVC` (Radial Basis Function Kernel, probability=True) โ€” Weight: `0.35`
- `GaussianNB` (Multinomial Prior Likelihood) โ€” Weight: `0.25`
- **Number of Symptom Features**: 180 binary indicators (0 = absent, 1 = present)
- **Number of Disease Classes**: 10 target pathologies
- **Test Accuracy**: **13.33%** on independent clinical testing cohort
---
## ๐Ÿ“ฆ Files in this Repository
| File | Description |
| :--- | :--- |
| **`model.joblib`** | The complete trained `VotingClassifier` ensemble pipeline. |
| **`symptoms.json`** | Array of 180 symptom feature names in exact column sequence. |
| **`diseases.json`** | List of all 10 prognostic disease labels. |
| **`prescriptions.json`** | Clinical treatment and prescription mapping for predicted pathologies. |
---
## ๐Ÿ’ป Quickstart Inference (Python)
```python
import joblib
import json
import numpy as np
import pandas as pd
from huggingface_hub import hf_hub_download
# 1. Download model and feature list from Hugging Face
REPO_ID = "YOUR_USERNAME/YOUR_MODEL_NAME" # e.g., "Av1447/disease-prediction-ensemble"
model_path = hf_hub_download(repo_id=REPO_ID, filename="model.joblib")
symptoms_path = hf_hub_download(repo_id=REPO_ID, filename="symptoms.json")
model = joblib.load(model_path)
with open(symptoms_path, "r") as f:
symptom_features = json.load(f)
# 2. Build input vector for patient symptoms
# Example: Patient has Headache and Sensitivity to Light
patient_symptoms = ["Headache", "Sensitivity to Light", "Sensitivity to Sound"]
# Binary vector (1 if symptom is present, 0 otherwise)
input_vector = [1 if feature in patient_symptoms else 0 for feature in symptom_features]
input_df = pd.DataFrame([input_vector], columns=symptom_features)
# 3. Predict disease and probability
probabilities = model.predict_proba(input_df)[0]
top_idx = probabilities.argmax()
predicted_disease = model.classes_[top_idx]
confidence = probabilities[top_idx] * 100
print(f"Predicted Diagnosis: {predicted_disease} ({confidence:.1f}% confidence)")
```
---
## ๐ŸŒ Serverless Inference API / Web Usage
You can query this model directly via Hugging Face Serverless Inference API or via client-side web applications hosted on Vercel or GitHub Pages.
```javascript
// Example JavaScript fetch from your frontend
const response = await fetch(
"https://api-inference.huggingface.co/models/YOUR_USERNAME/YOUR_MODEL_NAME",
{
headers: {
Authorization: "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({ inputs: [inputVector] }),
}
);
const result = await response.json();
```
---
## โš–๏ธ Intended Use & Disclaimer
This model is developed for research, education, triage assistance, and prototyping. It is not intended to replace professional medical diagnosis, laboratory testing, or clinical consultation.