# 12 - amount of listening music # 13 - playing instrument or singing # 17\18 - mood in VA # 19\20 - mood color # 21:40 - preception of 10 labels # 41:57 - presence of mood # 58:77 - color perception for 10 lables # 81 - song id # 82:101 - induced labels positions # 102:129 - perceived labels positions # 130/131 - color for song # ni 134:136 - HSV for song # calculate fetures for song in train set #ids, feat = calc_mfcc_features_dict('audio/full') feat = read_feature_from_json('features/mfcc_our_dataset_20.json') X = feature_matrix_by_id(all_ids, feat) Yv = all_val Ya = all_aro # add data to X #hsv = np.array(read_csv_col('csv/survery2dataMin1.csv', 134, 136)) color = np.array(read_csv_col('csv/survery2dataMin1.csv', 130, 131)) vamood = np.array(read_csv_col('csv/survery2dataMin1.csv', 17, 18)) musicschool = np.array(read_csv_col('csv/survery2dataMin1.csv', 6, 6)) sex = np.array(read_csv_col('csv/survery2dataMin1.csv', 4, 4)) listening = np.array(read_csv_col('csv/survery2dataMin1.csv', 12, 12)) moodcolor = np.array(read_csv_col('csv/survery2dataMin1.csv', 19, 20)) moodperception = np.array(read_csv_col('csv/survery2dataMin1.csv', 21, 40)) presencemood = np.array(read_csv_col('csv/survery2dataMin1.csv', 41, 57))
import random import sys import numpy as np from sklearn.tree import DecisionTreeRegressor from utils.cross_validation import cross_valid ''' regression tree for each response ''' # get exsisting valence and arousal data ids, va, aro, rows = seperate_va('csv/survery2dataMin1.csv') va_dict, aro_dict = csv_2_dict_va('csv/survery2dataMin1.csv') # calculate fetures for song in train set feat = read_feature_from_json('features/chroma.json') X = feature_matrix_by_id(ids, feat) Yva = va Yaro = aro #for i in range(100): X, Yva, Yaro, ids = shufle_same(X, Yva, Yaro, ids) print 'v: ' + str(cross_valid(10, X, Yva, ids, va_dict)) print 'A: ' + str(cross_valid(10, X, Yaro, ids, aro_dict))