
f@0: ---
f@0: title: "Analyse GTZAN"
f@0: output: html_notebook
f@0: ---
f@0: 
f@0: ```{r}
f@0: source('../db/access_db.R')
f@0: library(tidyverse)
f@0: ```
f@0: 
f@0: 
f@0: 
f@0: 
f@0: ```{r}
f@0: excerpts_classes <- get_excerpts_classes()
f@0: 
f@0: excerpts_artist <- get_excerpts_artists()
f@0: 
f@0: classes_artists <- excerpts_classes %>%
f@0:   inner_join(excerpts_artist, by = c('ex_id')) %>%
f@0:   inner_join(get_class_names(), by = c('class_id'))
f@0: 
f@0: ```
f@0: 
f@0: ## Number of artists per class
f@0: 
f@0: ```{r}
f@0: (table_class_artists <- 
f@0:   classes_artists %>%
f@0:   group_by(class) %>%
f@0:   summarise(Unique_Artists = n_distinct(artist_id)))
f@0: ```
f@0: 
f@0: ```{r fig.height=2.5, fig.width=6}
f@0: ggplot(table_class_artists, aes(class, Unique_Artists)) + 
f@0:   geom_bar(stat = 'identity') +
f@0:   scale_x_discrete(name = 'GTZAN Class') + 
f@0:   scale_y_continuous(name = 'Unique Artists',
f@0:                      breaks = c(0, 25, 50, 75),
f@0:                      limits = c(0, 75)) +
f@0:   theme_bw() +
f@0:   theme(axis.title = element_text(size = 24),
f@0:         axis.title.x = element_text(vjust = -4),
f@0:         axis.text = element_text(size = 22),
f@0:         axis.text.x = element_text(angle = 45, vjust = 0.5))
f@0: 
f@0: 
f@0: ```
f@0: 
f@0: ## Number of recordings per artist
f@0: 
f@0: 
f@0: ```{r}
f@0: (table_excerpts_artists <- 
f@0:   classes_artists %>%
f@0:   group_by(class, artist_id) %>%
f@0:   summarise(rec = n_distinct(ex_id)))
f@0: ```
f@0: 
f@0: ```{r fig.height=2.5, fig.width=6}
f@0: ggplot(table_excerpts_artists, aes(class, Unique_Artists)) + 
f@0:   geom_boxplot(aes(x = class, y = rec)) +
f@0:   scale_x_discrete(name = 'GTZAN Class') + 
f@0:   scale_y_continuous(name = 'Excerpts per Artist',
f@0:                      limits=c(0,40)) +
f@0:   theme_bw() +
f@0:   theme(axis.title = element_text(size = 24),
f@0:         axis.title.x = element_text(vjust = -4),
f@0:         axis.text = element_text(size = 22),
f@0:         axis.text.x = element_text(angle = 45, vjust = 0.5))
f@0: 
f@0: ```




