Av1447 commited on
Commit
4f253a5
ยท
verified ยท
1 Parent(s): e3c68bc

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +113 -0
  2. diseases.json +12 -0
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ library_name: sklearn
6
+ tags:
7
+ - tabular-classification
8
+ - healthcare
9
+ - medical
10
+ - disease-prediction
11
+ - ensemble
12
+ - scikit-learn
13
+ metrics:
14
+ - accuracy
15
+ model-index:
16
+ - name: AI-Driven Healthcare Disease Prediction Ensemble
17
+ results:
18
+ - task:
19
+ type: tabular-classification
20
+ name: Disease Classification
21
+ metrics:
22
+ - type: accuracy
23
+ value: 0.1333
24
+ name: Test Accuracy
25
+ ---
26
+
27
+ # ๐Ÿฉบ AI-Driven Healthcare Disease Prediction Ensemble
28
+
29
+ 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.
30
+
31
+ ## ๐Ÿš€ Model Details
32
+ - **Architecture**: `VotingClassifier` with soft probability voting
33
+ - **Sub-Estimators**:
34
+ - `RandomForestClassifier` (100 estimators, Gini criterion) โ€” Weight: `0.40`
35
+ - `SVC` (Radial Basis Function Kernel, probability=True) โ€” Weight: `0.35`
36
+ - `GaussianNB` (Multinomial Prior Likelihood) โ€” Weight: `0.25`
37
+ - **Number of Symptom Features**: 180 binary indicators (0 = absent, 1 = present)
38
+ - **Number of Disease Classes**: 10 target pathologies
39
+ - **Test Accuracy**: **13.33%** on independent clinical testing cohort
40
+
41
+ ---
42
+
43
+ ## ๐Ÿ“ฆ Files in this Repository
44
+ | File | Description |
45
+ | :--- | :--- |
46
+ | **`model.joblib`** | The complete trained `VotingClassifier` ensemble pipeline. |
47
+ | **`symptoms.json`** | Array of 180 symptom feature names in exact column sequence. |
48
+ | **`diseases.json`** | List of all 10 prognostic disease labels. |
49
+ | **`prescriptions.json`** | Clinical treatment and prescription mapping for predicted pathologies. |
50
+
51
+ ---
52
+
53
+ ## ๐Ÿ’ป Quickstart Inference (Python)
54
+
55
+ ```python
56
+ import joblib
57
+ import json
58
+ import numpy as np
59
+ import pandas as pd
60
+ from huggingface_hub import hf_hub_download
61
+
62
+ # 1. Download model and feature list from Hugging Face
63
+ REPO_ID = "YOUR_USERNAME/YOUR_MODEL_NAME" # e.g., "Av1447/disease-prediction-ensemble"
64
+
65
+ model_path = hf_hub_download(repo_id=REPO_ID, filename="model.joblib")
66
+ symptoms_path = hf_hub_download(repo_id=REPO_ID, filename="symptoms.json")
67
+
68
+ model = joblib.load(model_path)
69
+ with open(symptoms_path, "r") as f:
70
+ symptom_features = json.load(f)
71
+
72
+ # 2. Build input vector for patient symptoms
73
+ # Example: Patient has Headache and Sensitivity to Light
74
+ patient_symptoms = ["Headache", "Sensitivity to Light", "Sensitivity to Sound"]
75
+
76
+ # Binary vector (1 if symptom is present, 0 otherwise)
77
+ input_vector = [1 if feature in patient_symptoms else 0 for feature in symptom_features]
78
+ input_df = pd.DataFrame([input_vector], columns=symptom_features)
79
+
80
+ # 3. Predict disease and probability
81
+ probabilities = model.predict_proba(input_df)[0]
82
+ top_idx = probabilities.argmax()
83
+ predicted_disease = model.classes_[top_idx]
84
+ confidence = probabilities[top_idx] * 100
85
+
86
+ print(f"Predicted Diagnosis: {predicted_disease} ({confidence:.1f}% confidence)")
87
+ ```
88
+
89
+ ---
90
+
91
+ ## ๐ŸŒ Serverless Inference API / Web Usage
92
+ You can query this model directly via Hugging Face Serverless Inference API or via client-side web applications hosted on Vercel or GitHub Pages.
93
+
94
+ ```javascript
95
+ // Example JavaScript fetch from your frontend
96
+ const response = await fetch(
97
+ "https://api-inference.huggingface.co/models/YOUR_USERNAME/YOUR_MODEL_NAME",
98
+ {
99
+ headers: {
100
+ Authorization: "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
101
+ "Content-Type": "application/json",
102
+ },
103
+ method: "POST",
104
+ body: JSON.stringify({ inputs: [inputVector] }),
105
+ }
106
+ );
107
+ const result = await response.json();
108
+ ```
109
+
110
+ ---
111
+
112
+ ## โš–๏ธ Intended Use & Disclaimer
113
+ 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.
diseases.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "Asthma",
3
+ "COVID-19",
4
+ "Cold",
5
+ "Diabetes",
6
+ "Flu",
7
+ "Hypertension",
8
+ "Malaria",
9
+ "Migraine",
10
+ "Pneumonia",
11
+ "Tuberculosis"
12
+ ]