File size: 3,779 Bytes
4f253a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
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.