annotate analysis/analyse_gtzan.Rmd @ 0:205974c9568c tip

Initial commit. Predictions not included for lack of space.
author franrodalg <f.rodriguezalgarra@qmul.ac.uk>
date Sat, 29 Jun 2019 18:45:50 +0100
parents
children
rev   line source
f@0 1 ---
f@0 2 title: "Analyse GTZAN"
f@0 3 output: html_notebook
f@0 4 ---
f@0 5
f@0 6 ```{r}
f@0 7 source('../db/access_db.R')
f@0 8 library(tidyverse)
f@0 9 ```
f@0 10
f@0 11
f@0 12
f@0 13
f@0 14 ```{r}
f@0 15 excerpts_classes <- get_excerpts_classes()
f@0 16
f@0 17 excerpts_artist <- get_excerpts_artists()
f@0 18
f@0 19 classes_artists <- excerpts_classes %>%
f@0 20 inner_join(excerpts_artist, by = c('ex_id')) %>%
f@0 21 inner_join(get_class_names(), by = c('class_id'))
f@0 22
f@0 23 ```
f@0 24
f@0 25 ## Number of artists per class
f@0 26
f@0 27 ```{r}
f@0 28 (table_class_artists <-
f@0 29 classes_artists %>%
f@0 30 group_by(class) %>%
f@0 31 summarise(Unique_Artists = n_distinct(artist_id)))
f@0 32 ```
f@0 33
f@0 34 ```{r fig.height=2.5, fig.width=6}
f@0 35 ggplot(table_class_artists, aes(class, Unique_Artists)) +
f@0 36 geom_bar(stat = 'identity') +
f@0 37 scale_x_discrete(name = 'GTZAN Class') +
f@0 38 scale_y_continuous(name = 'Unique Artists',
f@0 39 breaks = c(0, 25, 50, 75),
f@0 40 limits = c(0, 75)) +
f@0 41 theme_bw() +
f@0 42 theme(axis.title = element_text(size = 24),
f@0 43 axis.title.x = element_text(vjust = -4),
f@0 44 axis.text = element_text(size = 22),
f@0 45 axis.text.x = element_text(angle = 45, vjust = 0.5))
f@0 46
f@0 47
f@0 48 ```
f@0 49
f@0 50 ## Number of recordings per artist
f@0 51
f@0 52
f@0 53 ```{r}
f@0 54 (table_excerpts_artists <-
f@0 55 classes_artists %>%
f@0 56 group_by(class, artist_id) %>%
f@0 57 summarise(rec = n_distinct(ex_id)))
f@0 58 ```
f@0 59
f@0 60 ```{r fig.height=2.5, fig.width=6}
f@0 61 ggplot(table_excerpts_artists, aes(class, Unique_Artists)) +
f@0 62 geom_boxplot(aes(x = class, y = rec)) +
f@0 63 scale_x_discrete(name = 'GTZAN Class') +
f@0 64 scale_y_continuous(name = 'Excerpts per Artist',
f@0 65 limits=c(0,40)) +
f@0 66 theme_bw() +
f@0 67 theme(axis.title = element_text(size = 24),
f@0 68 axis.title.x = element_text(vjust = -4),
f@0 69 axis.text = element_text(size = 22),
f@0 70 axis.text.x = element_text(angle = 45, vjust = 0.5))
f@0 71
f@0 72 ```