Skip to content

Architecture Doctor

Automated SNN diagnostics: coding efficiency, hardware fit, spike health, actionable recommendations.

Python
from sc_neurocore.doctor import ArchitectureDoctor

doc = ArchitectureDoctor()
report = doc.diagnose(model)
for issue in report.issues:
    print(f"[{issue.severity}] {issue.message}")

See Tutorial 56: Architecture Doctor.

sc_neurocore.doctor

Automated SNN architecture diagnostics: coding efficiency, hardware fit, spike health, and actionable fix recommendations.

Diagnosis dataclass

Single diagnostic finding.

Source code in src/sc_neurocore/doctor/diagnose.py
Python
34
35
36
37
38
39
40
41
42
@dataclass
class Diagnosis:
    """Single diagnostic finding."""

    category: str
    severity: Severity
    message: str
    suggestion: str
    metric: float = 0.0

DiagnosticReport dataclass

Full diagnostic report for an SNN architecture.

Source code in src/sc_neurocore/doctor/diagnose.py
Python
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
@dataclass
class DiagnosticReport:
    """Full diagnostic report for an SNN architecture."""

    target: str
    findings: list[Diagnosis] = field(default_factory=list)

    def summary(self) -> str:
        lines = [f"SNN Architecture Doctor — target: {self.target}", ""]
        counts = {s: 0 for s in Severity}
        for f in self.findings:
            counts[f.severity] += 1

        lines.append(
            f"  {counts[Severity.CRITICAL]} critical, {counts[Severity.WARNING]} warning, "
            f"{counts[Severity.INFO]} info, {counts[Severity.OK]} ok"
        )
        lines.append("")

        for f in self.findings:
            if f.severity == Severity.OK:
                continue
            lines.append(f"  [{f.severity.value}] {f.category}: {f.message}")
            lines.append(f"    Fix: {f.suggestion}")
        return "\n".join(lines)

    @property
    def has_critical(self) -> bool:
        return any(f.severity == Severity.CRITICAL for f in self.findings)

    @property
    def score(self) -> int:
        """Health score 0-100. 100 = no issues."""
        penalty = sum(
            10 if f.severity == Severity.CRITICAL else 5 if f.severity == Severity.WARNING else 1
            for f in self.findings
            if f.severity != Severity.OK
        )
        return max(0, 100 - penalty)

score property

Health score 0-100. 100 = no issues.