File size: 2,755 Bytes
7b011ad
 
 
 
5ed0996
7b011ad
 
 
 
 
 
 
 
 
5ed0996
7b011ad
 
 
 
 
5ed0996
 
 
7b011ad
 
 
 
5ed0996
7b011ad
 
3460779
7b011ad
5ed0996
7b011ad
 
 
 
5ed0996
7b011ad
 
5ed0996
7b011ad
 
 
 
 
 
5ed0996
7b011ad
 
 
 
5ed0996
7b011ad
 
 
 
5ed0996
7b011ad
 
3460779
7b011ad
5ed0996
7b011ad
 
 
 
5ed0996
7b011ad
 
5ed0996
7b011ad
5ed0996
 
 
 
 
 
7b011ad
5ed0996
 
 
 
7b011ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4991385a-1cc9-4cd7-b144-36dc0478fafe",
   "metadata": {},
   "outputs": [],
   "source": [
    "#!pip install renumics-spotlight datasets[audio]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a32c61a3-b0f8-430b-9c4d-ff27a1a7942e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import datasets\n",
    "from renumics import spotlight\n",
    "\n",
    "from renumics.spotlight.layouts import debug_classification"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fada8bfa-c2ea-441a-9d07-f67fa8047138",
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset = datasets.load_dataset(\"renumics/speech_commands_enrichment_only\", \"raw_and_enrichment_combined\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7e486382-31cd-4b69-8a9e-fe3d7ac94b41",
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ddda31eb-fdab-4ed3-81cc-88506ae0d7d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "joined_dataset = datasets.concatenate_datasets([dataset[\"train\"], dataset[\"validation\"], dataset[\"test\"]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b8918a3-5037-4062-b9cd-40b4a8a4d6c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "joined_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a11fefeb-9fd1-4500-9b9f-3275207b1cde",
   "metadata": {},
   "outputs": [],
   "source": [
    "layout = debug_classification(label='label_string', prediction='prediction', embedding='embedding_reduced', \n",
    "                                    features=[\"label\", \"prediction\", \"probability\"], inspect={'audio': spotlight.Audio})\n",
    "dtypes = {\n",
    "    \"audio\": spotlight.Audio,\n",
    "    \"embedding_reduced\": spotlight.Embedding\n",
    "}\n",
    "spotlight.show(\n",
    "    joined_dataset,\n",
    "    dtype=dtypes,\n",
    "    layout= layout\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f1e38449-7bc1-4ae5-a754-a914a808a534",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}