A feedforward neural network for autism spectrum disorder (ASD) risk screening using 8 structured clinical input features.
1{
2 "prediction": "Healthy" | "ASD",
3 "probability": 0.0-1.0,
4 "risk_level": "low" | "medium" | "high"
5}
1import json
2import torch
3from pathlib import Path
4from huggingface_hub import snapshot_download
5
6# Download model
7model_dir = Path(snapshot_download("toderian/autism-detector"))
8
9# Load config
10with open(model_dir / "preprocessor_config.json") as f:
11 preprocess_config = json.load(f)
12
13# Load model
14model = torch.jit.load(model_dir / "autism_detector_traced.pt")
15model.eval()
16
17# Preprocessing function
18def preprocess(data, config):
19 features = []
20 for feature_name in config["feature_order"]:
21 if feature_name in config["categorical_features"]:
22 feat_config = config["categorical_features"][feature_name]
23 if feat_config["type"] == "text_binary":
24 value = 0 if data[feature_name].upper() == feat_config["normal_value"] else 1
25 else:
26 value = feat_config["mapping"][data[feature_name]]
27 else:
28 feat_config = config["numeric_features"][feature_name]
29 raw = float(data[feature_name])
30 value = (raw - feat_config["min"]) / (feat_config["max"] - feat_config["min"])
31 features.append(value)
32 return torch.tensor([features], dtype=torch.float32)
33
34# Example inference
35input_data = {
36 "developmental_milestones": "N",
37 "iq_dq": 85,
38 "intellectual_disability": "N",
39 "language_disorder": "N",
40 "language_development": "N",
41 "dysmorphism": "NO",
42 "behaviour_disorder": "N",
43 "neurological_exam": "N"
44}
45
46input_tensor = preprocess(input_data, preprocess_config)
47with torch.no_grad():
48 output = model(input_tensor)
49 probs = torch.softmax(output, dim=-1)
50 asd_probability = probs[0, 1].item()
51
52print(f"ASD Probability: {asd_probability:.2%}")
53print(f"Prediction: {'ASD' if asd_probability > 0.5 else 'Healthy'}")
1@misc{asd_detector_2026,
2 title={Autism Spectrum Disorder Screening Model},
3 year={2026},
4 publisher={Archicava},
5 url={https://huggingface.co/archicava/autism-detector}
6}