-
Notifications
You must be signed in to change notification settings - Fork 1
/
AI-Lab1.html
414 lines (389 loc) · 18.7 KB
/
AI-Lab1.html
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-154262640-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-154262640-1');
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The Black Prism</title>
<meta name="description" content="some very important website">
<meta name="author" content="TheBlackPrism">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="./css/styles.css">
<link rel="stylesheet" href="css/fancybox.min.css">
<link rel="stylesheet" href="./css/gallery-style.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link href='https://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' type='text/css'>
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<meta property="og:title" content="The Black Prism" />
<meta property="og:url" content="https://theblackprism.ch" />
<meta property="og:image" content="https://theblackprism.ch/images/Black-Prism_Logo_V05_Black.png" />
</head>
<body>
<!-- Preloader -->
<div class="preloader d-flex align-items-center justify-content-center">
<div class="lds-ellipsis">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<!-- ##### Header Area Start ##### -->
<!-- ##### Header Area Start ##### -->
<header class="header-area">
<!-- Navbar Area -->
<div class="newsbox-main-menu">
<div class="classy-nav-container breakpoint-off">
<div class="container-fluid">
<!-- Menu -->
<nav class="classy-navbar justify-content-between" id="newsboxNav">
<!-- Nav brand -->
<a href="index.html" class="nav-brand">The Black Prism</a>
<!-- Navbar Toggler -->
<div class="classy-navbar-toggler">
<span class="navbarToggler"><span></span><span></span><span></span></span>
</div>
<!-- Menu -->
<div class="classy-menu">
<!-- Close Button -->
<div class="classycloseIcon">
<div class="cross-wrap"><span class="top"></span><span class="bottom"></span></div>
</div>
<!-- Nav Start -->
<div class="classynav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="blogs.html">Blog</a>
<ul class="dropdown">
<li><a href="blogs.html">All Blogs</a></li>
<li><a href="AI-Lab3.html">AI Lab3</a></li>
<li><a href="AI-Lab2.html">AI Lab2</a></li>
<li><a href="AI-Lab1.html">AI Lab1</a></li>
<li><a href="2048-AI.html">Artificial Intelligence</a></li>
<li><a href="dragnet.html">CSP & Datalog</a></li>
</ul>
</li>
<li><a href="photos.html">Photos</a>
<ul class="dropdown">
<li><a href="photos.html">All Photos</a></li>
<li><a href="africa.html">Africa</a></li>
<li><a href="mountains.html">Mountains</a></li>
<li><a href="diverse.html">Diverse</a></li>
</ul>
</li>
<li><a href="https://github.com/TheBlackPrism.html">Github</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
<!-- Nav End -->
</div>
</nav>
</div>
</div>
</div>
</header>
<!-- ##### Header Area End ##### -->
<!-- ##### Hero Area Start ##### -->
<section class="section-padding-200">
<div class="container">
<h2>AI-Lab1 — Unsupervised Learning</h2>
<h5 class="author">By Dano Roost, Jennifer Schürch & Yves Lütjens</h5>
<h5 class="author">10.03.2020</h5>
<div class="blogpost">
<p>The aim of this lab is to analyse the genre of artists based only
on their song lyrics, which is done using unsupervised machine learning approaches.<br>
An overview with the artists and their genre can be found on a dendrogram <a href="dendrogram_artists.svg">here</a>
</p>
<h4>Vectorizing with TF IDF</h4>
<p>To calculate the TF IDF Matrix, the lyrics are split into words.
Those words include many words that don't add any semantic meaning to the lyrics.
These words are called stopwords and were extracted from the text to make sure,
that the most frequent words contain meaning. The python natural language toolkit library provides a list of stop words.
</p>
<h5>Most frequent words per artist</h5>
<p>When we look at some examples of the 10 most frequent words,
there are some similarities between artists from the same genre.
At the same time, the most frequent words can be very different,
as we can see from the metal genre with bathory and annihilator.
</p>
<div class="col-md-2">
<table class="article-statistic">
<tr>
<th>50-Cent</th>
<th>Hip-Hop</th>
</tr>
<tr>
<th>Frequency</th>
<td>0.019160</td>
<td>0.015574</td>
<td>0.015098</td>
<td>0.013911</td>
<td>0.011044</td>
<td>0.011017</td>
<td>0.010379</td>
<td>0.008816</td>
<td>0.007108</td>
<td>0.007081</td>
</tr>
<tr>
<th>Words</th>
<td>'get'</td>
<td>'nigga'</td>
<td>'like'</td>
<td>'got'</td>
<td>'know'</td>
<td>'ain't'</td>
<td>'shit'</td>
<td>'niggas'</td>
<td>'see'</td>
<td>'ya'</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<th>Eminem</th>
<th>Hip-Hop</th>
</tr>
<tr>
<th>Frequency</th>
<td>0.015370</td>
<td>0.011441</td>
<td>0.007853</td>
<td>0.007699</td>
<td>0.007675</td>
<td>0.006965</td>
<td>0.006567</td>
<td>0.006236</td>
<td>0.005665</td>
<td>0.005267</td>
</tr>
<tr>
<th>Words</th>
<td>'like'</td>
<td>'get'</td>
<td>'got'</td>
<td>'know'</td>
<td>'shit'</td>
<td>'back'</td>
<td>'ain't'</td>
<td>'fuck'</td>
<td>'go'</td>
<td>'see'</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<th>Bathory</th>
<th>Metal</th>
</tr>
<tr>
<th>Frequency</th>
<td>0.007725</td>
<td>0.007483</td>
<td>0.007483</td>
<td>0.006819</td>
<td>0.006156</td>
<td>0.005673</td>
<td>0.005009</td>
<td>0.004949</td>
<td>0.004888</td>
<td>0.004767</td>
</tr>
<tr>
<th>Words</th>
<td>'death'</td>
<td>'sky'</td>
<td>'blood'</td>
<td>'one'</td>
<td>'fire'</td>
<td>'black'</td>
<td>'die'</td>
<td>'high'</td>
<td>'high'</td>
<td>'life'</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<th>Avicii</th>
<th>Electronic</th>
</tr>
<tr>
<th>Frequency</th>
<td>0.024273</td>
<td>0.021116</td>
<td>0.015130</td>
<td>0.013606</td>
<td>0.013606</td>
<td>0.011538</td>
<td>0.010884</td>
<td>0.010558</td>
<td>0.010449</td>
<td>0.009796</td>
</tr>
<tr>
<th>Words</th>
<td>'one'</td>
<td>'love'</td>
<td>'never'</td>
<td>'like'</td>
<td>'get'</td>
<td>'make'</td>
<td>'could'</td>
<td>'need'</td>
<td>'way'</td>
<td>'tell'</td>
</tr>
</table>
</div>
<h4>Clustering K-Means</h4>
<p>Clustering with K-Means is strongly dependent of the first few values
of the dataset, as they initialize the different centroids.
The most interesting Clusters are the following two:</p>
<div class="col-md-6">
<table class="article-statistic">
<tr>
<th>2</th>
<th>4</th>
</tr>
<tr>
<td>busta-rhymes: HIP-HOP</td>
<td>clannad: FOLK</td>
</tr>
<tr>
<td>game: HIP-HOP</td>
<td>andre-rieu: FOLK</td>
</tr>
<tr>
<td>50-cent: HIP-HOP</td>
<td>ataraxia: FOLK</td>
</tr>
<tr>
<td>chamillionaire: HIP-HOP</td>
<td>cradle-of-filth: METAL</td>
</tr>
<tr>
<td>e-40: HIP-HOP</td>
<td>bathory: METAL</td>
</tr>
<tr>
<td>dmx: HIP-HOP</td>
<td>cannibal-corpse: METAL</td>
</tr>
<tr>
<td>2pac: HIP-HOP</td>
<td>clancy-brothers: FOLK</td>
</tr>
<tr>
<td>drake: HIP-HOP</td>
<td>celtic-woman: FOLK</td>
</tr>
<tr>
<td>eminem: HIP-HOP</td>
<td>agoraphobic-nosebleed: METAL</td>
</tr>
</table>
</div>
<p>The lyrics of Hip-Hop seem to be extremly different than other genres,
as cluster 2 only contains the one genre. Cluster 4 consits of Folk and
Metal which concludes that this two genres are very similar to each other
in therms of the lyrics.
</p>
<h4>PCA</h4>
<p>To be able to visualize the different artists and genres we applied
the Principle Component Analysis onto the lyrics.
As seen in the previous chapter the Hip-Hop genres is very distinct
from the rest of the genres. In contrary to Hip-Hop, Pop spreads very widely.
It inherits some properties from most of the genres.
</p>
<a href="images/blogs/PCA_Artist_Genre.png" class="d-block photo-item" data-fancybox="gallery">
<img src="images/blogs/PCA_Artist_Genre.png" alt="Distribution Artists" class="img-fluid">
<div class="photo-text-more">
<span class="icon icon-search"></span>
</div>
</a>
<h4>Additional Task</h4>
<p>As additional task, we experimented with word vectors for topic extraction.
We again counted the words for each singer and then took the most common few.
For those most fequent words, the then calculated the average vector and seached
for the word, that was closest to this average vector.
For the vectors, we utilized SpaCy with pretrained GloVe vectors.
Additionally, we tried the procedure with different parameters to
get multiple topic-candidates for each artist. In a final steop,
we merged these topics together.
While the topics of some artists, do not make a lot of sense,
some are actually pretty fitting:<br><br>
"beyonce-knowles": "love, girl"<br>
"eazy-e": "hoe, shit"<br>
"ali-dee-and-the-deekompressors": "race-car, automobile, racer"<br>
"fair-sex": "thing, enough, love, bite"<br>
"babydoll": "baby, flulike, love, fever"<br>
</p>
</div>
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/**
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
**/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document,
s = d.createElement('script');
s.src = 'https://blackprism.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>
<!-- ##### Footer Area Start ##### -->
<footer class="footer-area">
<!-- Footer Logo -->
<div class="footer-logo mb-100">
<a href="index.html">The Black Prism</a>
</div>
</footer>
<!-- ##### Footer Area Start ##### -->
<div id="particles-js"></div>
<!-- ##### All Javascript Script ##### -->
<!-- jQuery-2.2.4 js -->
<script src="js/jquery/jquery-2.2.4.min.js"></script>
<!-- Popper js -->
<script src="js/bootstrap/popper.min.js"></script>
<!-- Bootstrap js -->
<script src="js/bootstrap/bootstrap.min.js"></script>
<!-- All Plugins js -->
<script src="js/plugins/plugins.js"></script>
<!-- Active js -->
<script src="js/active.js"></script>
<!-- Gallery js -->
<script src="js/jquery/jquery.fancybox.min.js"></script>
<script src="js/jquery/jquery.magnific-popup.min.js"></script>
<script src="js/gallery-main.js"></script>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>