Mercurial > hg > confint
view ext/scatter_desc.R @ 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 |
line wrap: on
line source
library(tidyverse) feats_mode <- 'original' feats_lev <- 'f' feats_path <- paste0('~/Repositories/research/datasets/features/gtzan/', feats_mode, '/scattering/') feats <- read.csv(file = paste0(feats_path, feats_lev, '.csv')) feats_desc <- feats %>% group_by(ex_id, gt) %>% summarise_all(funs(mean, median, var, min, max, skew = psych::skew, kurt = psych::kurtosi)) %>% ungroup() dif <- function(x) x - lag(x) feats_dif <- feats %>% group_by(ex_id, gt) %>% mutate_all(funs(dif)) %>% na.omit() %>% ungroup() names(feats_dif) <- c(names(feats_dif)[1:2], paste0(names(feats_dif)[3:length(names(feats_dif))], "_dif")) feats_dif2 <- feats_dif %>% group_by(ex_id, gt) %>% mutate_all(funs(dif)) %>% na.omit() %>% ungroup() names(feats_dif2) <- c(names(feats_dif2)[1:2], paste0(names(feats_dif2)[3:length(names(feats_dif2))], "2")) feats_desc <- cbind(feats_desc, feats_dif %>% group_by(ex_id, gt) %>% summarise_all(funs(mean, var)) %>% ungroup() %>% select(-ex_id, -gt), feats_dif2 %>% group_by(ex_id, gt) %>% summarise_all(funs(mean, var)) %>% ungroup() %>% select(-ex_id, -gt) ) file_name <- paste0(feats_path, feats_lev, '_desc.csv') write.csv(x = feats_desc, file = file_name, row.names = F)