toderian commited on
Commit
5cf3cc7
·
verified ·
1 Parent(s): 293d9b9

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +178 -0
README.md ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: mit
4
+ tags:
5
+ - tabular
6
+ - structured-data
7
+ - binary-classification
8
+ - medical
9
+ - autism
10
+ - screening
11
+ language:
12
+ - en
13
+ metrics:
14
+ - accuracy
15
+ - f1
16
+ - roc_auc
17
+ ---
18
+
19
+ # Autism Spectrum Disorder Screening Model
20
+
21
+ ## Model Description
22
+
23
+ A feedforward neural network for autism spectrum disorder (ASD) risk screening using 8 structured clinical input features.
24
+
25
+ **Important:** This is a screening tool, NOT a diagnostic instrument. Results must be interpreted by qualified healthcare professionals.
26
+
27
+ ## Intended Use
28
+
29
+ - **Primary use:** Clinical decision support for ASD screening
30
+ - **Users:** Healthcare professionals, clinical software systems
31
+ - **Out of scope:** Self-diagnosis, definitive diagnosis
32
+
33
+ ## Input Features
34
+
35
+ | Field | Type | Valid Values | Description |
36
+ |-------|------|--------------|-------------|
37
+ | `developmental_milestones` | categorical | `N`, `G`, `M`, `C` | Normal, Global delay, Motor delay, Cognitive delay |
38
+ | `iq_dq` | numeric | 20-150 | IQ or Developmental Quotient |
39
+ | `intellectual_disability` | categorical | `N`, `F70.0`, `F71`, `F72` | None, Mild, Moderate, Severe (ICD-10) |
40
+ | `language_disorder` | binary | `N`, `Y` | No / Yes |
41
+ | `language_development` | categorical | `N`, `delay`, `A` | Normal, Delayed, Absent |
42
+ | `dysmorphism` | binary | `NO`, `Y` | No / Yes |
43
+ | `behaviour_disorder` | binary | `N`, `Y` | No / Yes |
44
+ | `neurological_exam` | text | non-empty string | `N` for normal, or description |
45
+
46
+ ## Output
47
+
48
+ ```json
49
+ {
50
+ "prediction": "Healthy" | "ASD",
51
+ "probability": 0.0-1.0,
52
+ "risk_level": "low" | "medium" | "high"
53
+ }
54
+ ```
55
+
56
+ ### Risk Level Thresholds
57
+ - **Low:** probability < 0.4
58
+ - **Medium:** 0.4 ≤ probability < 0.7
59
+ - **High:** probability ≥ 0.7
60
+
61
+ ## How to Use
62
+
63
+ ```python
64
+ import json
65
+ import torch
66
+ from pathlib import Path
67
+ from huggingface_hub import snapshot_download
68
+
69
+ # Download model
70
+ model_dir = Path(snapshot_download("toderian/autism-detector"))
71
+
72
+ # Load config
73
+ with open(model_dir / "preprocessor_config.json") as f:
74
+ preprocess_config = json.load(f)
75
+
76
+ # Load model
77
+ model = torch.jit.load(model_dir / "autism_detector_traced.pt")
78
+ model.eval()
79
+
80
+ # Preprocessing function
81
+ def preprocess(data, config):
82
+ features = []
83
+ for feature_name in config["feature_order"]:
84
+ if feature_name in config["categorical_features"]:
85
+ feat_config = config["categorical_features"][feature_name]
86
+ if feat_config["type"] == "text_binary":
87
+ value = 0 if data[feature_name].upper() == feat_config["normal_value"] else 1
88
+ else:
89
+ value = feat_config["mapping"][data[feature_name]]
90
+ else:
91
+ feat_config = config["numeric_features"][feature_name]
92
+ raw = float(data[feature_name])
93
+ value = (raw - feat_config["min"]) / (feat_config["max"] - feat_config["min"])
94
+ features.append(value)
95
+ return torch.tensor([features], dtype=torch.float32)
96
+
97
+ # Example inference
98
+ input_data = {
99
+ "developmental_milestones": "N",
100
+ "iq_dq": 85,
101
+ "intellectual_disability": "N",
102
+ "language_disorder": "N",
103
+ "language_development": "N",
104
+ "dysmorphism": "NO",
105
+ "behaviour_disorder": "N",
106
+ "neurological_exam": "N"
107
+ }
108
+
109
+ input_tensor = preprocess(input_data, preprocess_config)
110
+ with torch.no_grad():
111
+ output = model(input_tensor)
112
+ probs = torch.softmax(output, dim=-1)
113
+ asd_probability = probs[0, 1].item()
114
+
115
+ print(f"ASD Probability: {asd_probability:.2%}")
116
+ print(f"Prediction: {'ASD' if asd_probability > 0.5 else 'Healthy'}")
117
+ ```
118
+
119
+ ## Training Details
120
+
121
+ - **Dataset:** 315 ASD patients + 100 healthy controls (415 total)
122
+ - **Preprocessing:** Min-max normalization for numeric, label encoding for categorical
123
+ - **Architecture:** Feedforward NN (input → 64 → 32 → 2)
124
+ - **Loss:** Cross-entropy
125
+ - **Optimizer:** Adam (lr=0.001)
126
+
127
+ ## Evaluation
128
+
129
+ | Metric | Value |
130
+ |--------|-------|
131
+ | Accuracy | 0.9759 |
132
+ | F1 Score | 0.9839 |
133
+ | ROC-AUC | 0.9913 |
134
+ | Sensitivity | 0.9683 |
135
+ | Specificity | 1.0000 |
136
+
137
+ ### Confusion Matrix (Test Set, n=83)
138
+
139
+ | | Predicted Healthy | Predicted ASD |
140
+ |--|-------------------|---------------|
141
+ | Actual Healthy | 20 | 0 |
142
+ | Actual ASD | 2 | 61 |
143
+
144
+ ## Limitations
145
+
146
+ - Trained on limited dataset (415 samples)
147
+ - Healthy controls are synthetically generated
148
+ - Not validated across diverse populations
149
+ - Screening tool only, not diagnostic
150
+ - Requires all 8 input fields
151
+
152
+ ## Ethical Considerations
153
+
154
+ - Results should always be reviewed by qualified professionals
155
+ - Should not be used as sole basis for clinical decisions
156
+ - Model performance may vary across different populations
157
+ - False negatives (2 in test set) may delay intervention
158
+
159
+ ## Files
160
+
161
+ | File | Description |
162
+ |------|-------------|
163
+ | `autism_detector_traced.pt` | TorchScript model (load with `torch.jit.load()`) |
164
+ | `config.json` | Model architecture configuration |
165
+ | `preprocessor_config.json` | Feature preprocessing rules (JSON, no pickle) |
166
+ | `model.py` | Model class definition |
167
+ | `requirements.txt` | Python dependencies |
168
+
169
+ ## Citation
170
+
171
+ ```bibtex
172
+ @misc{asd_detector_2026,
173
+ title={Autism Spectrum Disorder Screening Model},
174
+ year={2026},
175
+ publisher={Archicava},
176
+ url={https://huggingface.co/archicava/autism-detector}
177
+ }
178
+ ```