RKB109 commited on
Commit
0a91de5
·
verified ·
1 Parent(s): 56bf90b

Publish artifacts for audio-event-triage-20260823

Browse files
Files changed (5) hide show
  1. README.md +61 -0
  2. evaluation.json +5 -0
  3. inference.py +80 -0
  4. model.json +163 -0
  5. project.json +52 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: custom
4
+ pipeline_tag: audio-classification
5
+ datasets:
6
+ - RKB109/audio-event-triage-20260823-dataset
7
+ tags:
8
+ - synthetic-data
9
+ - transparent-baseline
10
+ - audio-ml
11
+ - audio-classification
12
+ - automatic-speech-recognition
13
+ - feature-extraction
14
+ - audio-to-audio
15
+ metrics:
16
+ - accuracy
17
+ ---
18
+
19
+ # Audio Event Triage Baseline Baseline Model
20
+
21
+ ## Model Description
22
+
23
+ This repository contains a small, transparent prototype model for
24
+ **Operations teams need an explainable starting point for classifying alarms, machinery noise, and speech-like events.**
25
+
26
+ The model combines per-label token weights with IDF-weighted evidence
27
+ retrieval. It was generated for reproducible architecture demonstrations and
28
+ does not call a hosted LLM.
29
+
30
+ ## Evaluation
31
+
32
+ - Held-out synthetic examples: 4
33
+ - Accuracy: 1
34
+ - Intended metrics: classification_accuracy, macro_recall, review_coverage
35
+
36
+ ## Intended Use
37
+
38
+ - Architecture prototyping
39
+ - CI and evaluation examples
40
+ - Local baseline comparisons
41
+ - Educational experimentation
42
+
43
+ ## Hugging Face Task Coverage
44
+
45
+ - `audio-classification`
46
+ - `automatic-speech-recognition`
47
+ - `feature-extraction`
48
+ - `audio-to-audio`
49
+
50
+ ## Limitations and Risks
51
+
52
+ The included records are synthetic feature vectors and do not replace evaluation on licensed real audio.
53
+
54
+ The dataset is synthetic and small. Do not use this model for consequential
55
+ decisions without representative data, expert review, and production-grade
56
+ evaluation.
57
+
58
+ ## Reproducibility
59
+
60
+ The linked GitHub repository includes `train.py`, the exact dataset split,
61
+ evaluation code, and the model JSON format.
evaluation.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "test_examples": 4,
3
+ "accuracy": 1,
4
+ "synthetic_evaluation": true
5
+ }
inference.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Transparent baseline pipeline for the generated AI project."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import math
7
+ import re
8
+ from pathlib import Path
9
+
10
+
11
+ def tokenize(value: str) -> list[str]:
12
+ return re.findall(r"[a-z0-9]+", value.lower())
13
+
14
+
15
+ class Pipeline:
16
+ def __init__(self, model: dict):
17
+ self.model = model
18
+
19
+ @classmethod
20
+ def from_file(cls, path: str | Path) -> "Pipeline":
21
+ return cls(json.loads(Path(path).read_text(encoding="utf-8")))
22
+
23
+ def classify(self, text: str) -> tuple[str, float]:
24
+ tokens = tokenize(text)
25
+ scores = {
26
+ label: sum(weights.get(token, 0) for token in tokens)
27
+ for label, weights in self.model["prototypes"].items()
28
+ }
29
+ ranked = sorted(scores.items(), key=lambda item: (-item[1], item[0]))
30
+ label, best = ranked[0]
31
+ total = sum(max(score, 0) for _, score in ranked) or 1
32
+ return label, best / total
33
+
34
+ def search(self, query: str, limit: int = 3) -> list[dict]:
35
+ query_tokens = set(tokenize(query))
36
+ ranked = []
37
+ for document in self.model["documents"]:
38
+ document_tokens = set(tokenize(document["text"]))
39
+ lexical = sum(
40
+ self.model["idf"].get(token, 1.0)
41
+ for token in query_tokens & document_tokens
42
+ )
43
+ ranked.append({**document, "score": round(lexical, 6)})
44
+ return sorted(ranked, key=lambda item: (-item["score"], item["id"]))[:limit]
45
+
46
+ def graph_evidence(self, text: str) -> list[dict]:
47
+ tokens = set(tokenize(text))
48
+ matches = []
49
+ for subject, relation, target in self.model.get("graph_edges", []):
50
+ edge_tokens = set(tokenize(f"{subject} {relation} {target}"))
51
+ overlap = len(tokens & edge_tokens)
52
+ if overlap:
53
+ matches.append(
54
+ {
55
+ "subject": subject,
56
+ "relation": relation,
57
+ "target": target,
58
+ "overlap": overlap,
59
+ }
60
+ )
61
+ return sorted(matches, key=lambda item: -item["overlap"])
62
+
63
+ def run(self, text: str) -> dict:
64
+ label, confidence = self.classify(text)
65
+ evidence = self.search(text)
66
+ result = {
67
+ "prediction": label,
68
+ "confidence": round(confidence, 4),
69
+ "requires_review": confidence < self.model["confidence_threshold"],
70
+ "evidence": evidence,
71
+ }
72
+ if self.model["mode"] == "graph":
73
+ result["graph_evidence"] = self.graph_evidence(text)
74
+ if self.model["mode"] == "agent":
75
+ result["proposed_tool"] = label
76
+ result["approval_required"] = label in {
77
+ "request-approval",
78
+ "request-human-help",
79
+ }
80
+ return result
model.json ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "daily-project-prototype-v1",
3
+ "project": "audio-event-triage",
4
+ "title": "Audio Event Triage Baseline",
5
+ "domain": "audio-ml",
6
+ "mode": "classifier",
7
+ "labels": [
8
+ "alarm",
9
+ "machinery",
10
+ "speech"
11
+ ],
12
+ "prototypes": {
13
+ "alarm": {
14
+ "2100": 3,
15
+ "high": 3,
16
+ "energy": 3,
17
+ "repeating": 5,
18
+ "tone": 5,
19
+ "peak": 3,
20
+ "frequency": 3,
21
+ "synthetic": 5,
22
+ "alarm": 3,
23
+ "feature": 5,
24
+ "summary": 5,
25
+ "in": 2,
26
+ "an": 3,
27
+ "operations": 2,
28
+ "review": 2,
29
+ "for": 1,
30
+ "evaluation": 1,
31
+ "case": 1,
32
+ "pulse": 2,
33
+ "bright": 2,
34
+ "spectrum": 2,
35
+ "urgent": 2,
36
+ "alert": 2
37
+ },
38
+ "machinery": {
39
+ "in": 2,
40
+ "an": 4,
41
+ "operations": 2,
42
+ "review": 2,
43
+ "low": 5,
44
+ "frequency": 2,
45
+ "continuous": 2,
46
+ "vibration": 5,
47
+ "high": 2,
48
+ "zero": 2,
49
+ "crossing": 2,
50
+ "stability": 2,
51
+ "synthetic": 5,
52
+ "rotating": 2,
53
+ "equipment": 2,
54
+ "feature": 5,
55
+ "summary": 5,
56
+ "for": 2,
57
+ "evaluation": 2,
58
+ "case": 2,
59
+ "steady": 3,
60
+ "hum": 3,
61
+ "harmonic": 3,
62
+ "pitch": 3,
63
+ "motor": 3
64
+ },
65
+ "speech": {
66
+ "variable": 2,
67
+ "pitch": 4,
68
+ "moderate": 2,
69
+ "energy": 2,
70
+ "speech": 2,
71
+ "cadence": 2,
72
+ "synthetic": 4,
73
+ "spoken": 2,
74
+ "segment": 2,
75
+ "feature": 4,
76
+ "summary": 4,
77
+ "for": 2,
78
+ "an": 3,
79
+ "evaluation": 2,
80
+ "case": 2,
81
+ "in": 1,
82
+ "operations": 1,
83
+ "review": 1,
84
+ "syllabic": 2,
85
+ "rhythm": 2,
86
+ "changing": 2,
87
+ "voice": 4,
88
+ "activity": 2
89
+ }
90
+ },
91
+ "idf": {
92
+ "synthetic": 1,
93
+ "alarm": 2.252763,
94
+ "feature": 1,
95
+ "summary": 1,
96
+ "rotating": 2.252763,
97
+ "equipment": 2.252763,
98
+ "spoken": 2.252763,
99
+ "segment": 2.252763,
100
+ "alert": 2.252763,
101
+ "motor": 2.252763,
102
+ "voice": 2.252763
103
+ },
104
+ "documents": [
105
+ {
106
+ "id": "audio-01",
107
+ "label": "alarm",
108
+ "text": "Synthetic alarm feature summary.",
109
+ "metadata": {
110
+ "synthetic": true,
111
+ "domain": "audio-ml"
112
+ }
113
+ },
114
+ {
115
+ "id": "audio-02",
116
+ "label": "machinery",
117
+ "text": "Synthetic rotating equipment feature summary.",
118
+ "metadata": {
119
+ "synthetic": true,
120
+ "domain": "audio-ml"
121
+ }
122
+ },
123
+ {
124
+ "id": "audio-03",
125
+ "label": "speech",
126
+ "text": "Synthetic spoken segment feature summary.",
127
+ "metadata": {
128
+ "synthetic": true,
129
+ "domain": "audio-ml"
130
+ }
131
+ },
132
+ {
133
+ "id": "audio-04",
134
+ "label": "alarm",
135
+ "text": "Synthetic alert feature summary.",
136
+ "metadata": {
137
+ "synthetic": true,
138
+ "domain": "audio-ml"
139
+ }
140
+ },
141
+ {
142
+ "id": "audio-05",
143
+ "label": "machinery",
144
+ "text": "Synthetic motor feature summary.",
145
+ "metadata": {
146
+ "synthetic": true,
147
+ "domain": "audio-ml"
148
+ }
149
+ },
150
+ {
151
+ "id": "audio-06",
152
+ "label": "speech",
153
+ "text": "Synthetic voice feature summary.",
154
+ "metadata": {
155
+ "synthetic": true,
156
+ "domain": "audio-ml"
157
+ }
158
+ }
159
+ ],
160
+ "graph_edges": [],
161
+ "confidence_threshold": 0.18,
162
+ "trained_on_synthetic_data": true
163
+ }
project.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Audio Event Triage Baseline",
3
+ "problem": "Operations teams need an explainable starting point for classifying alarms, machinery noise, and speech-like events.",
4
+ "domain": "audio-ml",
5
+ "architecture": "classifier",
6
+ "hugging_face_tasks": [
7
+ "audio-classification",
8
+ "automatic-speech-recognition",
9
+ "feature-extraction",
10
+ "audio-to-audio"
11
+ ],
12
+ "recommended_stack": [
13
+ "FastAPI for audio metadata and prediction APIs",
14
+ "Transformers with Wav2Vec2 or audio spectrogram models",
15
+ "librosa or torchaudio for feature extraction",
16
+ "MLflow for experiment and model registry",
17
+ "Object storage for licensed audio",
18
+ "OpenTelemetry for inference latency and error traces"
19
+ ],
20
+ "real_world_data_sources": [
21
+ {
22
+ "name": "Freesound API",
23
+ "url": "https://freesound.org/apiv2/search/text/?query=alarm&page_size=5",
24
+ "purpose": "Licensed public audio search when an API key is configured"
25
+ },
26
+ {
27
+ "name": "Hugging Face Datasets API",
28
+ "url": "https://huggingface.co/api/datasets?search=audio-classification&limit=5",
29
+ "purpose": "Discover public audio datasets and metadata"
30
+ }
31
+ ],
32
+ "job_description_skills": [
33
+ "Audio feature pipelines and model fine-tuning",
34
+ "Class imbalance and macro-metric evaluation",
35
+ "Streaming inference and confidence calibration",
36
+ "Dataset licensing and provenance controls",
37
+ "Model monitoring and human review workflows"
38
+ ],
39
+ "impact_targets": [
40
+ "Reach macro recall >= 0.85 on a licensed evaluation set",
41
+ "Review every prediction below the confidence threshold",
42
+ "Process one minute of audio in under five seconds",
43
+ "Track class-level drift and false-negative rates"
44
+ ],
45
+ "baseline_evaluation": {
46
+ "test_examples": 4,
47
+ "accuracy": 1,
48
+ "synthetic_evaluation": true
49
+ },
50
+ "estimated_delivery": "8-12 weeks for one engineer",
51
+ "generated_baseline_is_production_ready": false
52
+ }