# Imports
library(dplyr) # Data manipulation
library(FactoMineR) # PCA analysis
library(factoextra) # PCA visualization
library(tidyverse) # Data wrangling
# Set language to English and data repository path
Sys.setenv(LANGUAGE='en')
metadata_dir <- "/Users/teo/Datasets/fma/data"
This project uses a subset of the Free Music Archive (FMA) dataset, focusing on the 223 temporal features provided by Echonest (now Spotify). The complete dataset contains:
More information of this dataset can be found on the following links: - Github repositoy: https://github.com/mdeff/fma?tab=readme-ov-file - Website: https://freemusicarchive.org/ - Codebook paper: https://arxiv.org/abs/1612.01840
We will focus on the 223 temporal features provided by Echonest to explore dimensionality reduction.
echonest_raw <- read.csv(file.path(metadata_dir, "echonest.csv"), sep = ",")
# Find column indices
track_id_col <- which(echonest_raw[3, ] == "track_id")
audio_cols <- which(echonest_raw[1, ] == "temporal_features")
# Set track_id column name
echonest_raw[2, 1] <- "track_id"
# Select temporal features
echonest_clean <- echonest_raw %>%
select(track_id_col, audio_cols)
echonest_clean <- echonest_clean %>%
setNames(c("track_id", paste0("tf_", seq_len(length(audio_cols)) - 1 ))) %>%
slice(-c(1, 2, 3))
head(echonest_clean)
## track_id tf_0 tf_1 tf_2 tf_3 tf_4
## 1 2 0.8772332668 0.5889111161 0.3542430103 0.2950901389 0.2984125018
## 2 3 0.5344291329 0.5374142528 0.4432994723 0.3908788860 0.3445729315
## 3 5 0.5480925441 0.7201917768 0.3892570734 0.3449338675 0.3612995744
## 4 10 0.3114041686 0.7114023566 0.3219138086 0.5006007552 0.2509630620
## 5 134 0.6108492613 0.5691694617 0.4284938276 0.3457958102 0.3769202232
## 6 139 0.8002824187 0.5863723159 0.3541595340 0.2662401199 0.2501960099
## tf_5 tf_6 tf_7 tf_8 tf_9 tf_10
## 1 0.3094303906 0.3044959009 0.3345789909 0.2494945079 0.2596555948 0.3183763623
## 2 0.3664476275 0.4194553494 0.7477657795 0.4609008729 0.3923788667 0.4745588005
## 3 0.4025429785 0.4340436757 0.3881373107 0.5124866962 0.5257551670 0.4253708720
## 4 0.3213164508 0.7342495322 0.3251882195 0.3730122745 0.2358400822 0.3687555194
## 5 0.4605903029 0.4013709426 0.4499002397 0.4289464653 0.4467355907 0.4798492193
## 6 0.2111320049 0.2878349721 0.3560358286 0.1853207797 0.1874729693 0.2787652910
## tf_11 tf_12 tf_13 tf_14 tf_15 tf_16
## 1 0.3719735742 1.0000000000 0.5709999800 0.2779999971 0.2099999934 0.2150000036
## 2 0.4067287743 0.5059999824 0.5145000219 0.3869999945 0.3235000074 0.2804999948
## 3 0.4468963742 0.5109999776 0.7720000148 0.3610000014 0.2879999876 0.3310000002
## 4 0.4407747984 0.2630000114 0.7360000014 0.2730000019 0.4259999990 0.2140000015
## 5 0.3782213628 0.6140000224 0.5450000167 0.3630000055 0.2800000012 0.3109999895
## 6 0.2455324382 1.0000000000 0.5669999719 0.2849999964 0.1840000004 0.1800000072
## tf_17 tf_18 tf_19 tf_20 tf_21 tf_22
## 1 0.2285000086 0.2375000119 0.2790000141 0.1685000062 0.1685000062 0.2790000141
## 2 0.3134999871 0.3454999924 0.8980000019 0.4365000129 0.3384999931 0.3980000019
## 3 0.3720000088 0.3589999974 0.2790000141 0.4429999888 0.4839999974 0.3680000007
## 4 0.2879999876 0.8100000024 0.2460000068 0.2949999869 0.1640000045 0.3109999895
## 5 0.3970000148 0.3170000017 0.4040000141 0.3560000062 0.3799999952 0.4199999869
## 6 0.1539999992 0.2240000069 0.2730000019 0.1260000020 0.1209999993 0.1940000057
## tf_23 tf_24 tf_25 tf_26 tf_27 tf_28
## 1 0.3324999809 0.0498478077 0.1042116806 0.0602296367 0.0522896349 0.0474028923
## 2 0.3479999900 0.0792073756 0.0833189711 0.0735951439 0.0710243136 0.0566785559
## 3 0.3970000148 0.0810512751 0.0783000439 0.0486967675 0.0569216162 0.0452642851
## 4 0.3860000074 0.0339685380 0.0706918016 0.0391614996 0.0957805142 0.0241024029
## 5 0.2919999957 0.0851764232 0.0922424719 0.0731827617 0.0563536324 0.0620124415
## 6 0.1979999989 0.0882479027 0.0819181278 0.0764843374 0.0600638725 0.0520195663
## tf_29 tf_30 tf_31 tf_32 tf_33 tf_34
## 1 0.0528145321 0.0527327284 0.0622162186 0.0516130924 0.0573992468 0.0531989150
## 2 0.0661131516 0.0738886818 0.0881001726 0.0713052154 0.0592749827 0.0882215947
## 3 0.0668194890 0.0944890827 0.0892501846 0.0980891734 0.0841334611 0.0688664615
## 4 0.0284968242 0.0738470331 0.0451029576 0.0654683039 0.0416341983 0.0416188724
## 5 0.0883433670 0.0770837665 0.0979418233 0.1017896533 0.0945333317 0.0893670395
## 6 0.0348037370 0.0585542247 0.0702416673 0.0301108528 0.0414460115 0.0712253675
## tf_35 tf_36 tf_37 tf_38 tf_39 tf_40
## 1 0.0625829771 0.0359999985 0.0179999992 0.0170000009 0.0209999997 0.0209999997
## 2 0.0672978386 0.0399999991 0.0399999991 0.0289999992 0.0209999997 0.0089999996
## 3 0.0862237439 0.0230000000 0.0230000000 0.0240000002 0.0209999997 0.0230000000
## 4 0.0844420493 0.0270000007 0.0810000002 0.0350000001 0.0250000004 0.0329999998
## 5 0.0885441825 0.0030000000 0.0120000001 0.0030000000 0.0040000002 0.0099999998
## 6 0.0353756510 0.0189999994 0.0149999997 0.0089999996 0.0049999999 0.0070000002
## tf_41 tf_42 tf_43 tf_44 tf_45 tf_46
## 1 0.0099999998 0.0149999997 0.0410000011 0.0099999998 0.0089999996 0.0209999997
## 2 0.0199999996 0.0199999996 0.0529999994 0.0219999999 0.0320000015 0.0340000018
## 3 0.0199999996 0.0289999992 0.0219999999 0.0399999991 0.0260000005 0.0320000015
## 4 0.0080000004 0.0989999995 0.0379999988 0.0219999999 0.0089999996 0.0399999991
## 5 0.0149999997 0.0049999999 0.0060000001 0.0160000008 0.0140000004 0.0130000003
## 6 0.0060000001 0.0160000008 0.0140000004 0.0120000001 0.0049999999 0.0099999998
## tf_47 tf_48 tf_49 tf_50 tf_51 tf_52
## 1 0.0130000003 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 2 0.0280000009 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 3 0.0160000008 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 4 0.0189999994 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 5 0.0070000002 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 6 0.0080000004 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## tf_53 tf_54 tf_55 tf_56 tf_57 tf_58
## 1 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 2 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 3 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 4 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 5 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## 6 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000
## tf_59 tf_60 tf_61 tf_62 tf_63 tf_64
## 1 1.0000000000 0.9639999866 0.9819999933 0.9829999804 0.9789999723 0.9789999723
## 2 1.0000000000 0.9599999785 0.9599999785 0.9710000157 0.9789999723 0.9909999967
## 3 1.0000000000 0.9769999981 0.9769999981 0.9760000110 0.9789999723 0.9769999981
## 4 1.0000000000 0.9729999900 0.9190000296 0.9649999738 0.9750000238 0.9670000076
## 5 1.0000000000 0.9969999790 0.9879999757 0.9969999790 0.9959999919 0.9900000095
## 6 1.0000000000 0.9810000062 0.9850000143 0.9909999967 0.9950000048 0.9929999709
## tf_65 tf_66 tf_67 tf_68 tf_69 tf_70
## 1 0.9900000095 0.9850000143 0.9589999914 0.9900000095 0.9909999967 0.9789999723
## 2 0.9800000191 0.9800000191 0.9470000267 0.9779999852 0.9679999948 0.9660000205
## 3 0.9800000191 0.9710000157 0.9779999852 0.9599999785 0.9739999771 0.9679999948
## 4 0.9919999838 0.9010000229 0.9620000124 0.9779999852 0.9909999967 0.9599999785
## 5 0.9850000143 0.9950000048 0.9940000176 0.9840000272 0.9860000014 0.9869999886
## 6 0.9940000176 0.9840000272 0.9860000014 0.9879999757 0.9950000048 0.9900000095
## tf_71 tf_72 tf_73 tf_74 tf_75
## 1 0.9869999886 -1.8993418217 -0.0326541141 0.8784691095 1.1475379467
## 2 0.9720000029 0.1973776072 0.1827717870 0.6083937883 0.7858220935
## 3 0.9840000272 0.1928221285 -0.6717008352 0.7164307833 1.1776790619
## 4 0.9810000062 1.3737889528 -0.4227911234 1.2108287811 0.4019902349
## 5 0.9929999709 -0.0991881713 0.0337264910 0.6994758844 1.0396023989
## 6 0.9919999838 -1.3167631626 -0.0441693068 0.7841824293 1.1791211367
## tf_76 tf_77 tf_78 tf_79 tf_80
## 1 0.9508557320 0.9482570291 1.1578869820 1.1479109526 1.6463184357
## 2 0.7734788656 0.6505462527 0.5746049881 -0.7678036094 0.3262661099
## 3 0.6291931272 0.4781212211 0.6332803369 0.8628662825 0.3443535268
## 4 1.8386119604 1.1616538763 -0.5471905470 1.3866467476 1.2165236473
## 5 0.8988523483 0.5050012469 0.6253782511 0.3946059644 0.5546713471
## 6 1.5143893957 1.5524882078 1.3925627470 1.1596008539 2.1820979118
## tf_81 tf_82 tf_83 tf_84 tf_85
## 1 1.5301933289 1.1975679398 0.7456728220 2.5100378990 -1.5001832247
## 2 0.8084351420 0.5068933368 0.6821394563 -1.1575478315 -1.1701470613
## 3 0.2640900314 0.6734256744 0.4615538120 -1.0793280602 -0.7441930771
## 4 2.3209004402 1.2210924625 0.4748266041 2.1177000999 -1.0807386637
## 5 0.5244938135 0.3589419723 0.8646205068 -1.2557101250 -1.3260446787
## 6 2.4248695374 1.4303035736 1.7442389727 0.3334860802 -1.0609223843
## tf_86 tf_87 tf_88 tf_89 tf_90
## 1 0.0305399895 0.6942420006 0.1704316139 0.0646948814 0.8747265339
## 2 -0.6831877232 -0.3665735722 -0.2453565598 -0.5476160049 -0.8097112179
## 3 0.1019921303 0.8623402119 -0.2946934700 -0.8192279339 -0.8599569798
## 4 1.3041543961 -1.2012857199 4.9862089157 1.7308115959 -1.1243979931
## 5 -0.5158722401 0.5178930759 -0.0016620159 -0.9676997662 -0.7474625111
## 6 -0.4416387081 0.6469669342 1.9892992973 2.5554571152 1.4984049797
## tf_91 tf_92 tf_93 tf_94 tf_95
## 1 0.7225761414 2.2513198853 1.7081594467 1.0548572540 0.0206749439
## 2 -0.8944947720 -0.8087382317 -0.1303174496 -1.0564852953 -0.5107631683
## 3 -0.5404701233 -1.2879196405 -1.1827079058 -0.5665104389 -0.9312319756
## 4 1.4285011292 0.4900166988 5.1374111176 1.1253514290 -0.9764378071
## 5 -1.2020276785 -1.0383806229 -1.0393346548 -1.0762932301 -0.3903930187
## 6 0.4706118107 5.6225099564 6.1532106400 1.2509016991 3.6965451241
## tf_96 tf_97 tf_98 tf_99 tf_100
## 1 42.9491310120 44.3874359131 32.4093894958 15.6686668396 10.1140279770
## 2 44.0972824097 48.7902412415 10.5843172073 -2.5654540062 -1.2928307056
## 3 40.2746620178 6.5088739395 -7.2656726837 -4.3406348228 10.4072713852
## 4 46.4398994446 6.7388138771 72.5866012573 20.4387168884 -32.3778266907
## 5 40.3582801819 24.1155471802 20.2272605896 6.2521433830 -21.9503059387
## 6 46.0657081604 43.6160774231 37.6549949646 -1.7575439215 -20.9686374664
## tf_101 tf_102 tf_103 tf_104 tf_105
## 1 -4.0692524910 2.0423531532 2.1883211136 -3.8059234619 -0.4946986735
## 2 -4.4901485443 -0.6337406635 2.1125564575 -7.2880554199 -5.1325993538
## 3 -7.6181354523 5.7291831970 0.2861081958 10.8888654709 0.2416816503
## 4 -3.3921434879 -1.7472296953 -9.3804721832 1.7548427582 -11.1475219727
## 5 5.2669944763 -5.0091261864 0.1084639132 12.6657209396 11.3271398544
## 6 -18.8388214111 -4.8846340179 -3.0386648178 7.5374054909 3.3711853027
## tf_106 tf_107 tf_108 tf_109 tf_110
## 1 6.0246696472 10.6925992966 44.4425010681 42.3885002136 31.6849994659
## 2 -2.3904085159 11.4479780197 45.4145011902 51.9790000916 6.5979995728
## 3 -3.9121086597 1.7565828562 41.4269981384 7.8359999657 -10.4799995422
## 4 5.8795127869 3.3248572350 47.1870002747 3.5360000134 74.3059997559
## 5 -4.6929130554 -0.3111171722 41.7849998474 19.5919990540 7.0349998474
## 6 0.9086703062 -0.1956740022 46.7050018311 41.9119987488 38.6059989929
## tf_111 tf_112 tf_113 tf_114 tf_115
## 1 9.9875001907 9.5685005188 -7.1484999657 3.8315000534 1.8505001068
## 2 0.2800000012 -0.0120000001 -8.0494995117 -0.6829999685 1.0310000181
## 3 -5.7420001030 10.4680004120 -10.3800001144 5.9079999924 0.9060000181
## 4 19.5890007019 -36.0530014038 -3.4969999790 -0.4180000126 -9.8420000076
## 5 1.3930000067 -23.0799999237 -2.6930000782 -3.4089999199 -1.2799999714
## 6 -2.3750000000 -19.8099994659 -20.7759990692 -3.7550001144 -1.9609999657
## tf_116 tf_117 tf_118 tf_119 tf_120
## 1 -2.6875000000 -0.7999999523 5.4615001678 10.2565002441 39.4948196411
## 2 -7.0775003433 -4.3210000992 -0.9275000095 9.0895004272 22.5194072723
## 3 12.0290002823 -1.3190000057 -3.0490000248 0.9869999886 27.5552711487
## 4 0.8980000019 -9.9600000381 6.1199998856 3.9110000134 22.1937274933
## 5 13.7489995956 11.0340003967 -3.8389999866 -1.8220000267 26.8530502319
## 6 6.4279999733 3.1229999065 1.7029999495 -0.8240000010 20.7048206329
## tf_121 tf_122 tf_123 tf_124
## 1 1966.9791259766 1825.1230468750 1903.7567138672 828.8100585938
## 2 1694.8211669922 1256.4438476562 1251.5882568359 907.5451660156
## 3 1956.2543945312 1382.7572021484 1596.6842041016 983.1115112305
## 4 1392.7327880859 572.2828369141 694.7881469727 880.8521118164
## 5 4123.2895507812 4842.1269531250 2033.4962158203 1603.7653808594
## 6 1268.8386230469 927.0623779297 624.9285888672 586.0334472656
## tf_125 tf_126 tf_127 tf_128 tf_129
## 1 911.1558227539 581.0153198242 722.0014038086 404.6825561523 315.5284729004
## 2 588.6020507812 619.9716796875 679.5880126953 301.7233581543 401.6705322266
## 3 945.4044189453 659.3389282227 835.0131225586 399.1546936035 483.6076660156
## 4 344.1044616699 395.0022583008 306.6034545898 162.2848205566 283.1201171875
## 5 1318.9726562500 709.5377197266 1050.2038574219 758.4732055664 563.1395874023
## 6 432.5063171387 428.2659301758 282.7200622559 205.2754974365 160.5900115967
## tf_130 tf_131 tf_132 tf_133 tf_134
## 1 376.6324157715 229.2825469971 0.0000000000 -110.3679962158 -100.6050033569
## 2 294.2216186523 411.2994995117 0.0000000000 -82.7740020752 -137.5910034180
## 3 378.4648742676 244.3444671631 0.0000000000 -138.4380035400 -137.2039947510
## 4 125.4874267578 139.4597778320 0.0000000000 -174.0859985352 -61.2789993286
## 5 366.8037719727 409.6324768066 10.0649995804 -162.1009979248 -137.9539947510
## 6 117.3566207886 171.0218505859 5.4559998512 -70.1080017090 -163.3690032959
## tf_135 tf_136 tf_137 tf_138
## 1 -112.5810012817 -75.8820037842 -89.1600036621 -80.7379989624
## 2 -131.7290039062 -106.2429962158 -73.4449996948 -83.4680023193
## 3 -126.4509963989 -89.2470016479 -198.0559997559 -78.3420028687
## 4 -95.2720031738 -91.9100036621 -56.0649986267 -101.4879989624
## 5 -137.9830017090 -146.5489959717 -105.6989974976 -84.0770034790
## 6 -210.9510040283 -108.5390014648 -72.8860015869 -84.9950027466
## tf_139 tf_140 tf_141 tf_142 tf_143
## 1 -91.4980010986 -66.6490020752 -61.8450012207 -66.0810012817 -58.0439987183
## 2 -81.3229980469 -71.0739974976 -108.5650024414 -71.4980010986 -51.3510017395
## 3 -89.7450027466 -50.5960006714 -81.1890029907 -57.6940002441 -57.3120002747
## 4 -70.7959976196 -40.3899993896 -58.2340011597 -95.4639968872 -43.4580001831
## 5 -99.0510025024 -71.3020019531 -76.0540008545 -78.4580001831 -64.7139968872
## 6 -92.5739974976 -45.7109985352 -63.7760009766 -71.3249969482 -38.4490013123
## tf_144 tf_145 tf_146 tf_147 tf_148
## 1 52.0060005188 216.2369995117 208.4230041504 145.1940002441 97.4820022583
## 2 51.3660011292 190.3339996338 114.8440017700 359.9419860840 101.8619995117
## 3 48.2400016785 211.4900054932 98.5039978027 316.5509948730 92.7630004883
## 4 52.1930007935 171.1300048828 131.0859985352 298.5969848633 159.0930023193
## 5 47.8040008545 243.9210052490 251.8540039062 212.2160034180 107.8359985352
## 6 52.6489982605 178.2590026855 152.9559936523 225.2250061035 57.4860000610
## tf_149 tf_150 tf_151 tf_152 tf_153
## 1 98.7229995728 68.0910034180 101.5889968872 69.5059967041 58.2270011902
## 2 111.0820007324 78.6480026245 103.0009994507 46.2229995728 53.9939994812
## 3 212.5590057373 69.3669967651 126.8109970093 63.8680000305 73.8420028687
## 4 105.1169967651 73.4339981079 79.7600021362 49.5989990234 63.2309989929
## 5 192.6790008545 82.6539993286 107.7369995117 107.2570037842 89.8040008545
## 6 143.6280059814 71.7269973755 70.3610000610 55.2410011292 57.1860008240
## tf_154 tf_155 tf_156 tf_157 tf_158
## 1 69.2620010376 58.1759986877 52.0060005188 326.6049804688 309.0280151367
## 2 61.1809997559 90.4290008545 51.3660011292 273.1080017090 252.4349975586
## 3 60.0880012512 70.4020004272 48.2400016785 349.9280090332 235.7079925537
## 4 69.7539978027 35.3880004883 52.1930007935 345.2160034180 192.3649902344
## 5 75.4759979248 71.6380004883 37.7390022278 406.0220031738 389.8079833984
## 6 45.3899993896 55.4519996643 47.1929969788 248.3670043945 316.3250122070
## tf_159 tf_160 tf_161 tf_162 tf_163
## 1 257.7749938965 173.3640136719 187.8829956055 148.8290100098 193.0870056152
## 2 491.6709899902 208.1049957275 184.5270080566 162.1159973145 184.3240051270
## 3 443.0019836426 182.0100097656 410.6149902344 147.7089996338 216.5559997559
## 4 393.8689880371 251.0030059814 161.1819915771 174.9219970703 150.5559997559
## 5 350.1990051270 254.3849945068 298.3779907227 166.7310028076 206.7879943848
## 6 436.1760253906 166.0249938965 216.5140075684 156.7220001221 162.9349975586
## tf_164 tf_165 tf_166 tf_167 tf_168
## 1 136.1549987793 120.0720062256 135.3430023193 116.2200012207 -2.9521524906
## 2 117.2969970703 162.5590057373 132.6790008545 141.7799987793 -1.8275640011
## 3 114.4640045166 155.0310058594 117.7819976807 127.7140045166 -2.8933486938
## 4 89.9889984131 121.4649963379 165.2179870605 78.8460006714 -4.5159864426
## 5 178.5590057373 165.8580017090 153.9339904785 136.3519897461 -1.6525785923
## 6 100.9519958496 120.9620056152 116.7149963379 93.9010009766 -2.6680288315
## tf_169 tf_170 tf_171 tf_172 tf_173
## 1 0.0603787526 0.5259760022 0.3659146428 0.0181823578 0.4544309378
## 2 -0.0835611224 0.1623817682 0.8295344710 -0.1648740768 0.8977400064
## 3 0.0521285050 0.1697771996 0.7968577147 -0.1645101011 0.4647600651
## 4 0.0829991102 -0.4714215696 2.1715390682 1.7477349043 0.4354292750
## 5 0.3018700480 0.6659832001 0.7849597931 0.1076620296 1.0397495031
## 6 0.3682845533 -0.7174737453 0.5567523837 -0.3887572587 2.6096782684
## tf_174 tf_175 tf_176 tf_177 tf_178
## 1 -0.3300074339 0.1493950188 -0.2148586661 0.0304272678 -0.1538770944
## 2 -0.0588074923 0.3653810322 -0.1313885301 -0.2455788702 -0.3352801502
## 3 -0.2119869590 0.0271193385 -0.2152395695 0.0830522403 -0.0047781193
## 4 -0.6030023694 0.2009870261 0.1271099746 -0.0052971640 -0.9563493133
## 5 -0.1375140697 0.2175779194 -0.0444901139 0.0111590689 -0.2656947970
## 6 -0.2199933082 -0.9367120862 0.4612672925 -0.2523850203 -1.7536903620
## tf_179 tf_180 tf_181 tf_182 tf_183
## 1 -0.1501315832 13.2062129974 1.0099339485 1.5771942139 0.3370234966
## 2 0.6131197810 8.4240427017 0.2308335304 0.6142115593 11.6273479462
## 3 0.1148146242 12.9981660843 1.2584114075 -0.1051433086 5.2848081589
## 4 -0.2871954441 30.3319053650 2.0512919426 1.1234359741 22.1776161194
## 5 0.3312183619 3.1680064201 0.1415612698 -0.0477104187 1.9169836044
## 6 0.3250348568 11.1633558273 0.6830527782 3.2982597351 17.8313045502
## tf_184 tf_185 tf_186 tf_187 tf_188
## 1 0.0971493721 0.4012596607 0.0063242912 0.6434857845 0.0120587349
## 2 1.0158128738 1.6277313232 0.0323178768 0.8191256523 -0.0309982300
## 3 -0.2507338524 4.7197546959 -0.1833419800 0.3408124447 -0.2959704399
## 4 7.8893775940 1.8091473579 2.2190947533 1.5184302330 0.6548154354
## 5 -0.1393644810 2.2510304451 -0.2248260975 0.0507028103 0.1880192757
## 6 0.3662776947 13.1276760101 0.1440844536 4.3958177567 0.5084547997
## tf_189 tf_190 tf_191 tf_192 tf_193
## 1 0.2379474640 0.6559383869 1.2138643265 -12.4861459732 -11.2694997787
## 2 0.7346100807 0.4588825703 0.9999644756 -12.5020437241 -11.4204998016
## 3 0.0991032124 0.0987226963 1.3893718719 -15.4580945969 -14.1049995422
## 4 0.6507272720 12.6564731598 0.4067313671 -10.2448902130 -9.4639997482
## 5 0.2497496605 0.9316980839 0.7660686970 -15.1454715729 -14.1510000229
## 6 3.0266599655 9.7006855011 0.4012825489 -11.2136125565 -10.5539999008
## tf_194 tf_195 tf_196 tf_197 tf_198
## 1 46.0312614441 -60.0000000000 -3.9330000877 56.0670013428 -2.5874750614
## 2 26.4685516357 -60.0000000000 -5.7890000343 54.2109985352 -1.7558552027
## 3 35.9552230835 -60.0000000000 -7.2480001450 52.7519989014 -2.5055327415
## 4 20.3043079376 -60.0000000000 -5.0269999504 54.9729995728 -5.3652186394
## 5 19.9881458282 -40.2099990845 -7.3509998322 32.8590011597 -1.6325079203
## 6 12.3800067902 -52.5099983215 -3.9479999542 48.5619964600 -2.5336999893
## tf_199 tf_200 tf_201 tf_202 tf_203
## 1 11.8025846481 0.0479702950 0.0382749997 0.0009882613 0.0000000000
## 2 7.8953514099 0.0577073842 0.0453599989 0.0013973247 0.0000000000
## 3 9.7165975571 0.0586078167 0.0456999987 0.0017765589 0.0000000000
## 4 41.2012786865 0.0489383079 0.0408000015 0.0025914314 0.0000000000
## 5 3.3409819603 0.0594697110 0.0485600010 0.0015864075 0.0107899997
## 6 18.9344310760 0.0513853692 0.0418599993 0.0020967510 0.0053200000
## tf_204 tf_205 tf_206 tf_207 tf_208
## 1 0.2073000073 0.2073000073 1.6036585569 2.9842758179 -21.8120765686
## 2 0.3395000100 0.3395000100 2.2710206509 9.1860513687 -20.1850318909
## 3 0.2949700058 0.2949700058 1.8278373480 5.2537269592 -24.5231189728
## 4 0.8957399726 0.8957399726 10.5397090912 150.3599853516 -16.4727725983
## 5 0.4200600088 0.4092700183 2.7639477253 13.7183237076 -24.3365745544
## 6 0.5673699975 0.5620499849 4.5734848976 33.3827362061 -16.1887950897
## tf_209 tf_210 tf_211 tf_212 tf_213
## 1 -20.3120002747 49.1574821472 -60.0000000000 -9.6909999847 50.3089981079
## 2 -19.8680000305 24.0023269653 -60.0000000000 -9.6789999008 50.3209991455
## 3 -24.3670005798 31.8045463562 -60.0000000000 -12.5819997787 47.4179992676
## 4 -15.9029998779 27.5394401550 -60.0000000000 -9.0249996185 50.9749984741
## 5 -22.4489994049 52.7839050293 -60.0000000000 -13.1280002594 46.8720016479
## 6 -15.3030004501 34.6693840027 -60.0000000000 -8.5989999771 51.4010009766
## tf_214 tf_215 tf_216 tf_217 tf_218
## 1 -1.9923025370 6.8056936264 0.2330697626 0.1928800046 0.0274549890
## 2 -1.5823311806 8.8893079758 0.2584637702 0.2209050059 0.0813684240
## 3 -2.2883579731 11.5271091461 0.2568213642 0.2378199995 0.0601223968
## 4 -3.6629877090 21.5082283020 0.2833518982 0.2670699954 0.1257044971
## 5 -1.4526963234 2.3563981056 0.2346863896 0.1995500028 0.1493317783
## 6 -3.0786671638 12.4115667343 0.2708015740 0.2727000117 0.0252420790
## tf_219 tf_220 tf_221 tf_222 tf_223
## 1 0.0640799999 3.6769599915 3.6128799915 13.3166904449 262.9297485352
## 2 0.0641300008 6.0827698708 6.0186400414 16.6735477448 325.5810852051
## 3 0.0601399988 5.9264898300 5.8663496971 16.0138492584 356.7557373047
## 4 0.0808200017 8.4140100479 8.3331899643 21.3170642853 483.4038085938
## 5 0.0644000024 11.2670698166 11.2026700974 26.4541797638 751.1477050781
## 6 0.0640399978 2.4366900921 2.3726501465 3.8970954418 37.8660430908
# Convert track_id to integer
echonest_clean <- echonest_clean %>%
mutate(track_id = as.integer(track_id))
# Convert all temporal features to numeric
# Using across() for efficient conversion
echonest_clean <- echonest_clean %>%
mutate(across(everything(), as.numeric))
# Check for missing values
colSums(is.na(echonest_clean))
## track_id tf_0 tf_1 tf_2 tf_3 tf_4 tf_5 tf_6
## 0 0 0 0 0 0 0 0
## tf_7 tf_8 tf_9 tf_10 tf_11 tf_12 tf_13 tf_14
## 0 0 0 0 0 0 0 0
## tf_15 tf_16 tf_17 tf_18 tf_19 tf_20 tf_21 tf_22
## 0 0 0 0 0 0 0 0
## tf_23 tf_24 tf_25 tf_26 tf_27 tf_28 tf_29 tf_30
## 0 0 0 0 0 0 0 0
## tf_31 tf_32 tf_33 tf_34 tf_35 tf_36 tf_37 tf_38
## 0 0 0 0 0 0 0 0
## tf_39 tf_40 tf_41 tf_42 tf_43 tf_44 tf_45 tf_46
## 0 0 0 0 0 0 0 0
## tf_47 tf_48 tf_49 tf_50 tf_51 tf_52 tf_53 tf_54
## 0 0 0 0 0 0 0 0
## tf_55 tf_56 tf_57 tf_58 tf_59 tf_60 tf_61 tf_62
## 0 0 0 0 0 0 0 0
## tf_63 tf_64 tf_65 tf_66 tf_67 tf_68 tf_69 tf_70
## 0 0 0 0 0 0 0 0
## tf_71 tf_72 tf_73 tf_74 tf_75 tf_76 tf_77 tf_78
## 0 0 0 0 0 0 0 0
## tf_79 tf_80 tf_81 tf_82 tf_83 tf_84 tf_85 tf_86
## 0 0 0 0 0 0 0 0
## tf_87 tf_88 tf_89 tf_90 tf_91 tf_92 tf_93 tf_94
## 0 0 0 0 0 0 0 0
## tf_95 tf_96 tf_97 tf_98 tf_99 tf_100 tf_101 tf_102
## 0 0 0 0 0 0 0 0
## tf_103 tf_104 tf_105 tf_106 tf_107 tf_108 tf_109 tf_110
## 0 0 0 0 0 0 0 0
## tf_111 tf_112 tf_113 tf_114 tf_115 tf_116 tf_117 tf_118
## 0 0 0 0 0 0 0 0
## tf_119 tf_120 tf_121 tf_122 tf_123 tf_124 tf_125 tf_126
## 0 0 0 0 0 0 0 0
## tf_127 tf_128 tf_129 tf_130 tf_131 tf_132 tf_133 tf_134
## 0 0 0 0 0 0 0 0
## tf_135 tf_136 tf_137 tf_138 tf_139 tf_140 tf_141 tf_142
## 0 0 0 0 0 0 0 0
## tf_143 tf_144 tf_145 tf_146 tf_147 tf_148 tf_149 tf_150
## 0 0 0 0 0 0 0 0
## tf_151 tf_152 tf_153 tf_154 tf_155 tf_156 tf_157 tf_158
## 0 0 0 0 0 0 0 0
## tf_159 tf_160 tf_161 tf_162 tf_163 tf_164 tf_165 tf_166
## 0 0 0 0 0 0 0 0
## tf_167 tf_168 tf_169 tf_170 tf_171 tf_172 tf_173 tf_174
## 0 0 0 0 0 0 0 0
## tf_175 tf_176 tf_177 tf_178 tf_179 tf_180 tf_181 tf_182
## 0 0 0 0 0 0 0 0
## tf_183 tf_184 tf_185 tf_186 tf_187 tf_188 tf_189 tf_190
## 0 0 0 0 0 0 0 0
## tf_191 tf_192 tf_193 tf_194 tf_195 tf_196 tf_197 tf_198
## 0 0 0 0 0 0 0 0
## tf_199 tf_200 tf_201 tf_202 tf_203 tf_204 tf_205 tf_206
## 0 0 0 0 0 0 0 0
## tf_207 tf_208 tf_209 tf_210 tf_211 tf_212 tf_213 tf_214
## 0 0 0 0 0 0 0 0
## tf_215 tf_216 tf_217 tf_218 tf_219 tf_220 tf_221 tf_222
## 0 0 0 0 0 0 0 0
## tf_223
## 0
# Check for duplicates
sum(duplicated(echonest_clean$track_id))
## [1] 0
# Summary statistics
summary(echonest_clean)
## track_id tf_0 tf_1 tf_2
## Min. : 2 Min. :0.02264 Min. :0.02002 Min. :0.01509
## 1st Qu.: 12986 1st Qu.:0.33236 1st Qu.:0.31643 1st Qu.:0.27517
## Median : 28097 Median :0.44557 Median :0.43222 Median :0.35597
## Mean : 34031 Mean :0.44836 Mean :0.43587 Mean :0.36521
## 3rd Qu.: 45021 3rd Qu.:0.56014 3rd Qu.:0.55158 3rd Qu.:0.44291
## Max. :124911 Max. :0.99843 Max. :0.98537 Max. :0.99654
## tf_3 tf_4 tf_5 tf_6
## Min. :0.01431 Min. :0.03279 Min. :0.01409 Min. :0.01186
## 1st Qu.:0.22443 1st Qu.:0.26822 1st Qu.:0.23867 1st Qu.:0.24616
## Median :0.29773 Median :0.35295 Median :0.31892 Median :0.32545
## Mean :0.30607 Mean :0.36552 Mean :0.32573 Mean :0.33241
## 3rd Qu.:0.37644 3rd Qu.:0.44858 3rd Qu.:0.40192 3rd Qu.:0.40884
## Max. :0.99018 Max. :0.96753 Max. :0.95067 Max. :0.96777
## tf_7 tf_8 tf_9 tf_10
## Min. :0.01182 Min. :0.01599 Min. :0.006663 Min. :0.01298
## 1st Qu.:0.26621 1st Qu.:0.23539 1st Qu.:0.266039 1st Qu.:0.22077
## Median :0.34988 Median :0.31306 Median :0.347999 Median :0.29337
## Mean :0.35796 Mean :0.32188 Mean :0.358277 Mean :0.30112
## 3rd Qu.:0.43641 3rd Qu.:0.39777 3rd Qu.:0.437743 3rd Qu.:0.37109
## Max. :0.99152 Max. :0.91784 Max. :0.939243 Max. :0.94722
## tf_11 tf_12 tf_13 tf_14
## Min. :0.02323 Min. :0.0000 Min. :0.0000 Min. :0.0010
## 1st Qu.:0.24833 1st Qu.:0.2320 1st Qu.:0.2180 1st Qu.:0.1800
## Median :0.32954 Median :0.3685 Median :0.3560 Median :0.2700
## Mean :0.34012 Mean :0.4015 Mean :0.3884 Mean :0.2946
## 3rd Qu.:0.41764 3rd Qu.:0.5380 3rd Qu.:0.5255 3rd Qu.:0.3740
## Max. :0.91427 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_15 tf_16 tf_17 tf_18
## Min. :0.0050 Min. :0.0090 Min. :0.0010 Min. :0.0000
## 1st Qu.:0.1480 1st Qu.:0.1750 1st Qu.:0.1520 1st Qu.:0.1620
## Median :0.2240 Median :0.2660 Median :0.2340 Median :0.2430
## Mean :0.2418 Mean :0.2969 Mean :0.2542 Mean :0.2624
## 3rd Qu.:0.3100 3rd Qu.:0.3780 3rd Qu.:0.3280 3rd Qu.:0.3350
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_19 tf_20 tf_21 tf_22
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.1690 1st Qu.:0.1520 1st Qu.:0.1645 1st Qu.:0.1360
## Median :0.2555 Median :0.2290 Median :0.2490 Median :0.2090
## Mean :0.2814 Mean :0.2513 Mean :0.2803 Mean :0.2276
## 3rd Qu.:0.3565 3rd Qu.:0.3220 3rd Qu.:0.3545 3rd Qu.:0.2940
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_23 tf_24 tf_25 tf_26
## Min. :0.0000 Min. :0.0002272 Min. :0.0001521 Min. :0.0004734
## 1st Qu.:0.1550 1st Qu.:0.0658755 1st Qu.:0.0623974 1st Qu.:0.0537938
## Median :0.2380 Median :0.0860815 Median :0.0826507 Median :0.0743358
## Mean :0.2644 Mean :0.0858465 Mean :0.0818259 Mean :0.0763666
## 3rd Qu.:0.3370 3rd Qu.:0.1058514 3rd Qu.:0.1011746 3rd Qu.:0.0969476
## Max. :1.0000 Max. :0.2218524 Max. :0.2007435 Max. :0.2227033
## tf_27 tf_28 tf_29
## Min. :0.0001387 Min. :0.0003291 Min. :5.489e-05
## 1st Qu.:0.0365433 1st Qu.:0.0526772 1st Qu.:4.383e-02
## Median :0.0538858 Median :0.0746778 Median :6.473e-02
## Mean :0.0586044 Mean :0.0759198 Mean :6.774e-02
## 3rd Qu.:0.0762886 3rd Qu.:0.0971429 3rd Qu.:8.809e-02
## Max. :0.1926542 Max. :0.2091382 Max. :2.060e-01
## tf_30 tf_31 tf_32
## Min. :0.0003117 Min. :0.0002645 Min. :0.0002199
## 1st Qu.:0.0453248 1st Qu.:0.0550645 1st Qu.:0.0426507
## Median :0.0650111 Median :0.0777982 Median :0.0627404
## Mean :0.0674917 Mean :0.0785882 Mean :0.0656460
## 3rd Qu.:0.0870209 3rd Qu.:0.1007912 3rd Qu.:0.0858430
## Max. :0.1920445 Max. :0.2072419 Max. :0.1958248
## tf_33 tf_34 tf_35 tf_36
## Min. :0.0002017 Min. :0.0007676 Min. :0.001009 Min. :0.00000
## 1st Qu.:0.0560231 1st Qu.:0.0398864 1st Qu.:0.050964 1st Qu.:0.00500
## Median :0.0795397 Median :0.0598633 Median :0.073602 Median :0.01000
## Mean :0.0801792 Mean :0.0631989 Mean :0.075348 Mean :0.01878
## 3rd Qu.:0.1030514 3rd Qu.:0.0833389 3rd Qu.:0.097432 3rd Qu.:0.02300
## Max. :0.1995398 Max. :0.2143355 Max. :0.219708 Max. :0.79400
## tf_37 tf_38 tf_39 tf_40
## Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00500 1st Qu.:0.00400 1st Qu.:0.00300 1st Qu.:0.00400
## Median :0.01100 Median :0.00800 Median :0.00700 Median :0.00800
## Mean :0.01898 Mean :0.01412 Mean :0.01257 Mean :0.01443
## 3rd Qu.:0.02300 3rd Qu.:0.01700 3rd Qu.:0.01500 3rd Qu.:0.01800
## Max. :0.43100 Max. :0.40200 Max. :0.40900 Max. :0.33200
## tf_41 tf_42 tf_43 tf_44
## Min. :0.00000 Min. :0.0000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00300 1st Qu.:0.0040 1st Qu.:0.00400 1st Qu.:0.00400
## Median :0.00700 Median :0.0080 Median :0.00800 Median :0.00800
## Mean :0.01256 Mean :0.0135 Mean :0.01321 Mean :0.01298
## 3rd Qu.:0.01600 3rd Qu.:0.0170 3rd Qu.:0.01700 3rd Qu.:0.01600
## Max. :0.22900 Max. :0.3020 Max. :0.39300 Max. :0.30000
## tf_45 tf_46 tf_47 tf_48
## Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.2470
## 1st Qu.:0.00400 1st Qu.:0.00300 1st Qu.:0.00300 1st Qu.:1.0000
## Median :0.00800 Median :0.00700 Median :0.00700 Median :1.0000
## Mean :0.01329 Mean :0.01183 Mean :0.01211 Mean :0.9979
## 3rd Qu.:0.01600 3rd Qu.:0.01500 3rd Qu.:0.01500 3rd Qu.:1.0000
## Max. :0.24800 Max. :0.24300 Max. :0.23200 Max. :1.0000
## tf_49 tf_50 tf_51 tf_52
## Min. :0.0560 Min. :0.2010 Min. :0.0790 Min. :0.1090
## 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:1.0000
## Median :1.0000 Median :1.0000 Median :1.0000 Median :1.0000
## Mean :0.9974 Mean :0.9955 Mean :0.9893 Mean :0.9945
## 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_53 tf_54 tf_55 tf_56
## Min. :0.0410 Min. :0.1070 Min. :0.1450 Min. :0.0800
## 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:1.0000
## Median :1.0000 Median :1.0000 Median :1.0000 Median :1.0000
## Mean :0.9928 Mean :0.9935 Mean :0.9955 Mean :0.9926
## 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_57 tf_58 tf_59 tf_60
## Min. :0.1070 Min. :0.1620 Min. :0.2610 Min. :0.2060
## 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:1.0000 1st Qu.:0.9760
## Median :1.0000 Median :1.0000 Median :1.0000 Median :0.9890
## Mean :0.9953 Mean :0.9919 Mean :0.9951 Mean :0.9791
## 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:1.0000 3rd Qu.:0.9950
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_61 tf_62 tf_63 tf_64
## Min. :0.0520 Min. :0.1990 Min. :0.0750 Min. :0.0980
## 1st Qu.:0.9770 1st Qu.:0.9810 1st Qu.:0.9810 1st Qu.:0.9810
## Median :0.9890 Median :0.9910 Median :0.9920 Median :0.9910
## Mean :0.9784 Mean :0.9814 Mean :0.9767 Mean :0.9801
## 3rd Qu.:0.9950 3rd Qu.:0.9960 3rd Qu.:0.9960 3rd Qu.:0.9960
## Max. :1.0000 Max. :1.0000 Max. :1.0000 Max. :1.0000
## tf_65 tf_66 tf_67 tf_68
## Min. :0.0380 Min. :0.104 Min. :0.1370 Min. :0.0750
## 1st Qu.:0.9820 1st Qu.:0.981 1st Qu.:0.9820 1st Qu.:0.9820
## Median :0.9920 Median :0.991 Median :0.9920 Median :0.9920
## Mean :0.9803 Mean :0.980 Mean :0.9823 Mean :0.9797
## 3rd Qu.:0.9960 3rd Qu.:0.996 3rd Qu.:0.9960 3rd Qu.:0.9960
## Max. :1.0000 Max. :1.000 Max. :1.0000 Max. :1.0000
## tf_69 tf_70 tf_71 tf_72
## Min. :0.107 Min. :0.1590 Min. :0.259 Min. :-10.95189
## 1st Qu.:0.982 1st Qu.:0.9840 1st Qu.:0.984 1st Qu.: 0.04715
## Median :0.992 Median :0.9920 Median :0.993 Median : 0.52633
## Mean :0.982 Mean :0.9801 Mean :0.983 Mean : 0.59706
## 3rd Qu.:0.996 3rd Qu.:0.9970 3rd Qu.:0.997 3rd Qu.: 1.05774
## Max. :1.000 Max. :1.0000 Max. :1.000 Max. : 8.65188
## tf_73 tf_74 tf_75 tf_76
## Min. :-7.56555 Min. :-13.0729 Min. :-7.3019 Min. :-4.0807
## 1st Qu.: 0.09127 1st Qu.: 0.5229 1st Qu.: 0.7731 1st Qu.: 0.5119
## Median : 0.59927 Median : 0.9004 Median : 1.1620 Median : 0.9250
## Mean : 0.69282 Mean : 0.9693 Mean : 1.2800 Mean : 0.9888
## 3rd Qu.: 1.16310 3rd Qu.: 1.3431 3rd Qu.: 1.6302 3rd Qu.: 1.3769
## Max. :10.07884 Max. : 12.3504 Max. :11.7965 Max. :11.9104
## tf_77 tf_78 tf_79 tf_80
## Min. :-4.0374 Min. :-3.7537 Min. :-8.3136 Min. :-2.5365
## 1st Qu.: 0.7018 1st Qu.: 0.6819 1st Qu.: 0.5663 1st Qu.: 0.7318
## Median : 1.0954 Median : 1.0784 Median : 0.9689 Median : 1.1348
## Mean : 1.2018 Mean : 1.1784 Mean : 1.0396 Mean : 1.2405
## 3rd Qu.: 1.5730 3rd Qu.: 1.5436 3rd Qu.: 1.4256 3rd Qu.: 1.6230
## Max. :10.6874 Max. :13.1238 Max. :11.3182 Max. :11.5638
## tf_81 tf_82 tf_83 tf_84
## Min. :-3.0471 Min. :-3.1581 Min. :-2.1862 Min. : -1.9576
## 1st Qu.: 0.5588 1st Qu.: 0.8244 1st Qu.: 0.6375 1st Qu.: -1.2333
## Median : 0.9694 Median : 1.2219 Median : 1.0431 Median : -0.7995
## Mean : 1.0357 Mean : 1.3387 Mean : 1.1294 Mean : 0.2392
## 3rd Qu.: 1.4290 3rd Qu.: 1.7114 3rd Qu.: 1.5151 3rd Qu.: 0.2677
## Max. : 8.0471 Max. :12.0842 Max. : 8.5312 Max. :126.7580
## tf_85 tf_86 tf_87 tf_88
## Min. : -1.8700 Min. : -1.9721 Min. : -1.8104 Min. : -1.9045
## 1st Qu.: -1.1879 1st Qu.: -0.9005 1st Qu.: -0.3253 1st Qu.: -0.9129
## Median : -0.6915 Median : -0.1522 Median : 0.7843 Median : -0.1030
## Mean : 0.5569 Mean : 0.8097 Mean : 2.1324 Mean : 0.9006
## 3rd Qu.: 0.5955 3rd Qu.: 1.1594 3rd Qu.: 2.6798 3rd Qu.: 1.3215
## Max. :124.4269 Max. :194.8380 Max. :181.1530 Max. :150.6000
## tf_89 tf_90 tf_91 tf_92
## Min. : -1.9029 Min. : -1.8449 Min. : -1.89127 Min. : -1.9191
## 1st Qu.: -0.5909 1st Qu.: -0.6245 1st Qu.: -0.91587 1st Qu.: -0.5378
## Median : 0.4300 Median : 0.3738 Median : -0.08399 Median : 0.5464
## Mean : 1.6441 Mean : 1.5746 Mean : 0.95283 Mean : 1.8338
## 3rd Qu.: 2.1869 3rd Qu.: 2.0788 3rd Qu.: 1.41657 3rd Qu.: 2.4113
## Max. :129.4258 Max. :265.3875 Max. :157.55472 Max. :165.0466
## tf_93 tf_94 tf_95 tf_96
## Min. :-1.8735 Min. : -1.8799 Min. : -1.8931 Min. : 3.324
## 1st Qu.:-0.9458 1st Qu.: -0.3532 1st Qu.: -0.7850 1st Qu.:37.107
## Median :-0.1241 Median : 0.7962 Median : 0.1654 Median :42.245
## Mean : 0.9142 Mean : 2.1428 Mean : 1.2965 Mean :41.409
## 3rd Qu.: 1.3867 3rd Qu.: 2.8106 3rd Qu.: 1.8309 3rd Qu.:46.471
## Max. :87.6046 Max. :149.7641 Max. :100.3373 Max. :62.748
## tf_97 tf_98 tf_99 tf_100
## Min. :-243.182 Min. :-215.844 Min. :-141.606 Min. :-124.311
## 1st Qu.: -43.856 1st Qu.: -19.102 1st Qu.: -10.682 1st Qu.: -18.210
## Median : -6.358 Median : 6.651 Median : -1.068 Median : -1.783
## Mean : -12.025 Mean : 9.478 Mean : 2.432 Mean : -1.442
## 3rd Qu.: 27.241 3rd Qu.: 32.376 3rd Qu.: 11.379 3rd Qu.: 14.366
## Max. : 234.662 Max. : 256.160 Max. : 173.089 Max. : 160.229
## tf_101 tf_102 tf_103 tf_104
## Min. :-74.381 Min. :-92.181 Min. :-67.728 Min. :-83.517
## 1st Qu.:-21.430 1st Qu.:-14.831 1st Qu.: -6.513 1st Qu.: -5.845
## Median :-12.825 Median : -4.566 Median : -0.930 Median : 2.182
## Mean :-11.539 Mean : -4.846 Mean : -1.259 Mean : 1.735
## 3rd Qu.: -3.594 3rd Qu.: 5.368 3rd Qu.: 4.163 3rd Qu.: 9.966
## Max. : 94.051 Max. :104.127 Max. : 47.566 Max. : 75.002
## tf_105 tf_106 tf_107 tf_108
## Min. :-40.6908 Min. :-36.5698 Min. :-65.762 Min. : 3.079
## 1st Qu.: -3.2386 1st Qu.: -5.3619 1st Qu.: -3.319 1st Qu.:38.192
## Median : 0.8413 Median : -0.8569 Median : 2.111 Median :43.495
## Mean : 0.9467 Mean : -1.4724 Mean : 2.477 Mean :42.510
## 3rd Qu.: 5.0300 3rd Qu.: 2.6965 3rd Qu.: 7.878 3rd Qu.:47.776
## Max. : 37.3761 Max. : 25.0965 Max. : 65.691 Max. :63.631
## tf_109 tf_110 tf_111 tf_112
## Min. :-250.683 Min. :-234.864 Min. :-152.1990 Min. :-128.908
## 1st Qu.: -44.994 1st Qu.: -19.727 1st Qu.: -11.7170 1st Qu.: -18.912
## Median : -5.478 Median : 6.876 Median : -2.5920 Median : -2.613
## Mean : -12.200 Mean : 9.362 Mean : 0.7508 Mean : -2.240
## 3rd Qu.: 28.655 3rd Qu.: 32.703 3rd Qu.: 9.3120 3rd Qu.: 13.277
## Max. : 311.378 Max. : 257.963 Max. : 180.0560 Max. : 162.701
## tf_113 tf_114 tf_115 tf_116
## Min. :-83.912 Min. :-101.256 Min. :-69.949 Min. :-82.676
## 1st Qu.:-24.364 1st Qu.: -14.928 1st Qu.: -6.437 1st Qu.: -5.536
## Median :-16.644 Median : -4.389 Median : -1.030 Median : 2.510
## Mean :-15.278 Mean : -4.768 Mean : -1.538 Mean : 1.979
## 3rd Qu.: -8.254 3rd Qu.: 5.782 3rd Qu.: 3.750 3rd Qu.: 10.363
## Max. : 81.555 Max. : 98.049 Max. : 52.492 Max. : 79.271
## tf_117 tf_118 tf_119 tf_120
## Min. :-42.9800 Min. :-33.0000 Min. :-69.095 Min. : 0.6919
## 1st Qu.: -2.9960 1st Qu.: -4.4840 1st Qu.: -3.152 1st Qu.: 18.4881
## Median : 0.9475 Median : -0.2370 Median : 2.286 Median : 29.5138
## Mean : 0.9839 Mean : -0.8137 Mean : 2.663 Mean : 35.4763
## 3rd Qu.: 4.9375 3rd Qu.: 3.1260 3rd Qu.: 8.000 3rd Qu.: 45.3671
## Max. : 36.9870 Max. : 24.0800 Max. : 64.514 Max. :502.1328
## tf_121 tf_122 tf_123 tf_124
## Min. : 113.6 Min. : 49.06 Min. : 80.56 Min. : 31.25
## 1st Qu.: 1470.5 1st Qu.: 1046.87 1st Qu.: 815.65 1st Qu.: 535.10
## Median : 2374.4 Median : 1656.29 Median : 1302.42 Median : 772.59
## Mean : 2916.0 Mean : 2024.58 Mean : 1658.78 Mean : 908.28
## 3rd Qu.: 3680.8 3rd Qu.: 2543.97 3rd Qu.: 2047.67 3rd Qu.:1125.14
## Max. :32701.5 Max. :21856.95 Max. :27569.97 Max. :8627.19
## tf_125 tf_126 tf_127 tf_128
## Min. : 24.39 Min. : 35.84 Min. : 35.98 Min. : 19.83
## 1st Qu.: 440.78 1st Qu.: 353.79 1st Qu.: 299.87 1st Qu.: 231.66
## Median : 721.88 Median : 516.57 Median : 452.04 Median : 338.84
## Mean : 907.69 Mean : 604.64 Mean : 562.97 Mean : 405.38
## 3rd Qu.: 1166.00 3rd Qu.: 755.05 3rd Qu.: 695.84 3rd Qu.: 499.37
## Max. :10475.04 Max. :7789.86 Max. :4886.78 Max. :6472.80
## tf_129 tf_130 tf_131 tf_132
## Min. : 29.37 Min. : 23.98 Min. : 16.84 Min. : 0.000
## 1st Qu.: 191.88 1st Qu.: 154.22 1st Qu.: 173.43 1st Qu.: 0.000
## Median : 283.29 Median : 241.34 Median : 244.58 Median : 1.497
## Mean : 331.46 Mean : 308.12 Mean : 291.23 Mean : 5.519
## 3rd Qu.: 415.37 3rd Qu.: 381.06 3rd Qu.: 349.60 3rd Qu.: 8.860
## Max. :2599.63 Max. :4321.08 Max. :3331.25 Max. :51.110
## tf_133 tf_134 tf_135 tf_136
## Min. :-371.5 Min. :-347.91 Min. :-504.45 Min. :-299.05
## 1st Qu.:-213.6 1st Qu.:-168.55 1st Qu.:-217.05 1st Qu.:-112.04
## Median :-165.3 Median :-132.11 Median :-158.86 Median : -87.06
## Mean :-163.3 Mean :-131.10 Mean :-173.25 Mean : -88.69
## 3rd Qu.:-115.9 3rd Qu.: -94.92 3rd Qu.:-116.52 3rd Qu.: -62.37
## Max. : 121.4 Max. : 161.03 Max. : -22.35 Max. : 57.49
## tf_137 tf_138 tf_139 tf_140
## Min. :-276.39 Min. :-257.55 Min. :-226.670 Min. :-231.530
## 1st Qu.:-118.07 1st Qu.:-102.04 1st Qu.:-101.714 1st Qu.: -79.399
## Median : -85.53 Median : -83.07 Median : -80.389 Median : -62.760
## Mean :-101.78 Mean : -85.48 Mean : -82.929 Mean : -66.120
## 3rd Qu.: -68.14 3rd Qu.: -66.71 3rd Qu.: -61.507 3rd Qu.: -48.635
## Max. : -30.63 Max. : 43.46 Max. : -1.114 Max. : 2.618
## tf_141 tf_142 tf_143 tf_144
## Min. :-156.210 Min. :-253.579 Min. :-181.450 Min. : 8.346
## 1st Qu.: -77.912 1st Qu.: -97.351 1st Qu.: -66.186 1st Qu.:47.267
## Median : -62.728 Median : -74.732 Median : -51.720 Median :51.088
## Mean : -63.601 Mean : -79.356 Mean : -54.502 Mean :50.258
## 3rd Qu.: -48.144 3rd Qu.: -56.536 3rd Qu.: -40.098 3rd Qu.:53.982
## Max. : -0.367 Max. : -8.539 Max. : 9.337 Max. :65.610
## tf_145 tf_146 tf_147 tf_148
## Min. :-70.71 Min. :-49.49 Min. :-35.18 Min. :-50.37
## 1st Qu.:153.51 1st Qu.:105.95 1st Qu.:142.62 1st Qu.: 70.26
## Median :171.13 Median :142.43 Median :210.33 Median : 96.54
## Mean :187.40 Mean :150.69 Mean :221.84 Mean :101.09
## 3rd Qu.:217.64 3rd Qu.:186.48 3rd Qu.:297.58 3rd Qu.:125.72
## Max. :603.94 Max. :427.40 Max. :497.26 Max. :349.60
## tf_149 tf_150 tf_151 tf_152
## Min. :-50.74 Min. :-22.40 Min. : 10.29 Min. :-30.94
## 1st Qu.: 98.07 1st Qu.: 54.65 1st Qu.: 77.94 1st Qu.: 48.68
## Median :136.42 Median : 71.03 Median :100.14 Median : 63.93
## Mean :141.07 Mean : 74.54 Mean :102.88 Mean : 65.95
## 3rd Qu.:179.99 3rd Qu.: 89.97 3rd Qu.:124.44 3rd Qu.: 80.70
## Max. :390.57 Max. :276.49 Max. :259.93 Max. :217.03
## tf_153 tf_154 tf_155 tf_156
## Min. : 5.865 Min. : 3.629 Min. : -1.133 Min. : 6.486
## 1st Qu.: 58.311 1st Qu.: 45.053 1st Qu.: 42.799 1st Qu.:39.470
## Median : 74.663 Median : 58.840 Median : 54.579 Median :46.496
## Mean : 76.425 Mean : 63.667 Mean : 57.490 Mean :44.739
## 3rd Qu.: 92.429 3rd Qu.: 77.563 3rd Qu.: 69.050 3rd Qu.:51.565
## Max. :189.861 Max. :239.455 Max. :168.988 Max. :64.333
## tf_157 tf_158 tf_159 tf_160
## Min. : 78.17 Min. : 56.75 Min. : 77.31 Min. : 31.76
## 1st Qu.:284.37 1st Qu.:227.99 1st Qu.:293.39 1st Qu.:152.62
## Median :344.87 Median :272.76 Median :387.71 Median :183.77
## Mean :350.70 Mean :281.79 Mean :395.09 Mean :189.78
## 3rd Qu.:409.13 3rd Qu.:325.90 3rd Qu.:484.95 3rd Qu.:220.14
## Max. :832.42 Max. :657.64 Max. :968.70 Max. :493.52
## tf_161 tf_162 tf_163 tf_164
## Min. : 24.5 Min. : 29.77 Min. : 35.12 Min. : 27.16
## 1st Qu.:183.1 1st Qu.:130.75 1st Qu.:149.07 1st Qu.:104.83
## Median :235.6 Median :154.89 Median :182.75 Median :127.57
## Mean :242.8 Mean :160.02 Mean :185.81 Mean :132.07
## 3rd Qu.:295.2 3rd Qu.:183.73 3rd Qu.:217.98 3rd Qu.:155.03
## Max. :564.7 Max. :432.39 Max. :433.16 Max. :388.21
## tf_165 tf_166 tf_167 tf_168
## Min. : 35.75 Min. : 30.66 Min. : 20.85 Min. :-19.512
## 1st Qu.:114.50 1st Qu.:109.05 1st Qu.: 88.64 1st Qu.: -3.170
## Median :138.40 Median :136.52 Median :107.46 Median : -1.986
## Mean :140.03 Mean :143.02 Mean :111.99 Mean : -2.447
## 3rd Qu.:162.93 3rd Qu.:169.97 3rd Qu.:130.64 3rd Qu.: -1.182
## Max. :299.15 Max. :407.73 Max. :294.39 Max. : 2.361
## tf_169 tf_170 tf_171 tf_172
## Min. :-4.7402 Min. :-5.396925 Min. :-12.02860 Min. :-4.1936
## 1st Qu.:-0.2684 1st Qu.:-0.414407 1st Qu.: -0.09889 1st Qu.:-0.1049
## Median : 0.1964 Median :-0.004986 Median : 0.34573 Median : 0.1743
## Mean : 0.2392 Mean :-0.007359 Mean : 0.59404 Mean : 0.2161
## 3rd Qu.: 0.6902 3rd Qu.: 0.394315 3rd Qu.: 1.00285 3rd Qu.: 0.4901
## Max. : 8.3299 Max. : 4.320025 Max. : 14.12818 Max. : 4.1059
## tf_173 tf_174 tf_175 tf_176
## Min. :-7.7519 Min. :-3.13281 Min. :-4.65733 Min. :-4.96988
## 1st Qu.: 0.5455 1st Qu.:-0.29300 1st Qu.:-0.05163 1st Qu.:-0.33943
## Median : 0.9144 Median :-0.03025 Median : 0.21997 Median :-0.06324
## Mean : 1.1212 Mean :-0.02234 Mean : 0.29160 Mean :-0.09645
## 3rd Qu.: 1.4161 3rd Qu.: 0.23554 3rd Qu.: 0.54421 3rd Qu.: 0.19299
## Max. :13.1137 Max. : 5.40988 Max. : 8.12990 Max. : 2.79431
## tf_177 tf_178 tf_179 tf_180
## Min. :-5.57343 Min. :-8.729508 Min. :-5.83752 Min. : -1.850
## 1st Qu.:-0.20911 1st Qu.:-0.624572 1st Qu.:-0.30783 1st Qu.: 2.276
## Median : 0.07208 Median :-0.282591 Median :-0.06356 Median : 6.802
## Mean : 0.12936 Mean :-0.375540 Mean :-0.07301 Mean : 15.548
## 3rd Qu.: 0.38122 3rd Qu.:-0.005992 3rd Qu.: 0.17429 3rd Qu.: 16.837
## Max. : 7.07485 Max. : 9.859152 Max. : 3.54022 Max. :559.856
## tf_181 tf_182 tf_183 tf_184
## Min. : -1.7964 Min. :-1.82603 Min. : -1.349 Min. :-1.560700
## 1st Qu.: 0.2287 1st Qu.: 0.02774 1st Qu.: 1.316 1st Qu.:-0.009855
## Median : 1.0590 Median : 0.68410 Median : 3.741 Median : 0.435811
## Mean : 2.2087 Mean : 1.54428 Mean : 11.409 Mean : 0.872021
## 3rd Qu.: 2.5427 3rd Qu.: 1.95835 3rd Qu.: 11.085 3rd Qu.: 1.160318
## Max. :143.6847 Max. :62.44063 Max. :273.071 Max. :28.445503
## tf_185 tf_186 tf_187 tf_188
## Min. : -1.453 Min. :-1.89183 Min. : -1.3262 Min. :-1.4040
## 1st Qu.: 1.042 1st Qu.: 0.04735 1st Qu.: 0.6917 1st Qu.: 0.1297
## Median : 2.580 Median : 0.46684 Median : 1.6021 Median : 0.5754
## Mean : 6.859 Mean : 0.84823 Mean : 2.9081 Mean : 0.9219
## 3rd Qu.: 6.263 3rd Qu.: 1.14055 3rd Qu.: 3.3007 3rd Qu.: 1.2112
## Max. :275.675 Max. :44.04563 Max. :117.3948 Max. :39.6927
## tf_189 tf_190 tf_191 tf_192
## Min. :-1.5411 Min. : -1.520 Min. :-1.6797 Min. :-54.534
## 1st Qu.: 0.5696 1st Qu.: 0.754 1st Qu.: 0.1188 1st Qu.:-18.681
## Median : 1.2093 Median : 1.671 Median : 0.5245 Median :-13.774
## Mean : 2.1753 Mean : 4.114 Mean : 0.8285 Mean :-14.795
## 3rd Qu.: 2.3886 3rd Qu.: 3.805 3rd Qu.: 1.1154 3rd Qu.: -9.898
## Max. :78.5359 Max. :139.872 Max. :58.4638 Max. : 4.696
## tf_193 tf_194 tf_195 tf_196
## Min. :-54.920 Min. : 0.3732 Min. :-60.00 Min. :-46.887
## 1st Qu.:-17.580 1st Qu.: 17.6565 1st Qu.:-60.00 1st Qu.: -8.435
## Median :-12.629 Median : 29.6852 Median :-56.37 Median : -5.019
## Mean :-13.747 Mean : 36.2056 Mean :-51.37 Mean : -5.868
## 3rd Qu.: -8.729 3rd Qu.: 47.3047 3rd Qu.:-45.88 3rd Qu.: -2.561
## Max. : 5.323 Max. :487.9831 Max. : -2.62 Max. : 7.730
## tf_197 tf_198 tf_199 tf_200
## Min. : 3.552 Min. :-20.449 Min. : -1.863 Min. :0.01380
## 1st Qu.:38.818 1st Qu.: -3.222 1st Qu.: 2.000 1st Qu.:0.04781
## Median :48.481 Median : -1.961 Median : 6.779 Median :0.05800
## Mean :45.500 Mean : -2.509 Mean : 17.942 Mean :0.06384
## 3rd Qu.:54.527 3rd Qu.: -1.121 3rd Qu.: 17.827 3rd Qu.:0.07004
## Max. :66.735 Max. : 2.937 Max. :531.945 Max. :2.22713
## tf_201 tf_202 tf_203 tf_204
## Min. :0.01082 Min. :3.900e-05 Min. :-0.011560 Min. : 0.04567
## 1st Qu.:0.03512 1st Qu.:1.424e-03 1st Qu.: 0.000000 1st Qu.: 0.34280
## Median :0.04367 Median :2.512e-03 Median : 0.004800 Median : 0.52046
## Mean :0.04505 Mean :4.082e-02 Mean : 0.004679 Mean : 0.96361
## 3rd Qu.:0.05232 3rd Qu.:5.369e-03 3rd Qu.: 0.008480 3rd Qu.: 0.92334
## Max. :0.72013 Max. :2.708e+02 Max. : 0.080160 Max. :204.87518
## tf_205 tf_206 tf_207 tf_208
## Min. : 0.04415 Min. :-0.263 Min. : -1.184 Min. :-58.8064
## 1st Qu.: 0.33856 1st Qu.: 2.629 1st Qu.: 10.499 1st Qu.:-27.5929
## Median : 0.51549 Median : 3.670 Median : 20.816 Median :-21.9067
## Mean : 0.95893 Mean : 5.044 Mean : 62.825 Mean :-22.6967
## 3rd Qu.: 0.92009 3rd Qu.: 5.564 3rd Qu.: 49.219 3rd Qu.:-17.2276
## Max. :204.86661 Max. :77.708 Max. :6289.178 Max. : 0.7634
## tf_209 tf_210 tf_211 tf_212
## Min. :-59.224 Min. : 0.9751 Min. :-60.00 Min. :-52.821
## 1st Qu.:-26.503 1st Qu.: 27.8607 1st Qu.:-60.00 1st Qu.:-14.019
## Median :-20.535 Median : 42.3295 Median :-60.00 Median :-10.026
## Mean :-21.520 Mean : 49.9068 Mean :-59.52 Mean :-10.883
## 3rd Qu.:-15.723 3rd Qu.: 63.2610 3rd Qu.:-60.00 3rd Qu.: -6.926
## Max. : 1.803 Max. :523.0599 Max. :-16.48 Max. : 5.666
## tf_213 tf_214 tf_215 tf_216
## Min. : 7.179 Min. :-17.9662 Min. : -1.868 Min. :0.1290
## 1st Qu.:45.471 1st Qu.: -2.5873 1st Qu.: 1.229 1st Qu.:0.2424
## Median :49.583 Median : -1.5651 Median : 4.355 Median :0.2860
## Mean :48.641 Mean : -1.9660 Mean : 10.746 Mean :0.3090
## 3rd Qu.:52.832 3rd Qu.: -0.8755 3rd Qu.: 11.408 3rd Qu.:0.3391
## Max. :65.666 Max. : 1.6638 Max. :423.621 Max. :5.2114
## tf_217 tf_218 tf_219 tf_220
## Min. :0.09828 Min. : 0.00052 Min. :0.06000 Min. : 0.3222
## 1st Qu.:0.20875 1st Qu.: 0.02132 1st Qu.:0.06308 1st Qu.: 1.8171
## Median :0.24274 Median : 0.04215 Median :0.06449 Median : 3.0941
## Mean :0.25538 Mean : 0.16388 Mean :0.06853 Mean : 4.1834
## 3rd Qu.:0.28531 3rd Qu.: 0.08752 3rd Qu.:0.07007 3rd Qu.: 5.1475
## Max. :1.68057 Max. :375.74478 Max. :0.34200 Max. :226.3268
## tf_221 tf_222 tf_223
## Min. : 0.2246 Min. :-3.567 Min. : -1.688
## 1st Qu.: 1.7497 1st Qu.: 2.867 1st Qu.: 15.566
## Median : 3.0263 Median : 5.502 Median : 55.875
## Mean : 4.1149 Mean : 7.605 Mean : 138.932
## 3rd Qu.: 5.0798 3rd Qu.:10.598 3rd Qu.: 175.939
## Max. :226.2441 Max. :67.042 Max. :4790.697
The temporal feature set consists of continuous audio descriptors extracted from the signal over time. Due to high dimensionality (223 variables), heterogeneous scales, and strong correlations between features, direct clustering or distance-based analysis would be unreliable.
vars <- apply(select(echonest_clean, -track_id), 2, var, na.rm = TRUE)
summary(vars)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0 0.0 7.6 46996.0 446.3 4872198.0
Features show substantial variance heterogeneity, ranging from near-zero to several millions. Some features are scaled 0-1 (temporal features from tf_0 to tf_71), others range up to hundred, and some extend to 30000, with corresponding variances gap. This necessitates standardization to ensure equal feature importance in PCA.
var_temporal <- apply(echonest_clean, 2, var)
hist(log10(var_temporal) + 1.3,
main = "Distribution of temporal feature variances (log scale)",
xlab = "log10(variance)")
The large heterogeneity in variances across variables indicates that some features would dominate principal components purely due to scale differences. Therefore, data standardization is essential prior to PCA to give equal importance to all temporal features.
# Select only temporal features for dimension reduction
X_temporal <- echonest_clean %>%
select(starts_with("tf_"))
# Note: scaling will be performed directly in the PCA procedure
pca_temporal <- PCA(
X_temporal,
scale.unit = TRUE, # to ensure standardization (scaling) is applied during PCA analysis.
ncp = ncol(X_temporal),
graph = FALSE
)
eig_vals <- get_eigenvalue(pca_temporal)
head(eig_vals)
## eigenvalue variance.percent cumulative.variance.percent
## Dim.1 26.372606 11.773485 11.77349
## Dim.2 19.679721 8.785590 20.55907
## Dim.3 11.088889 4.950397 25.50947
## Dim.4 7.563873 3.376729 28.88620
## Dim.5 6.267807 2.798128 31.68433
## Dim.6 5.927654 2.646274 34.33060
fviz_eig(
pca_temporal,
addlabels = TRUE,
)
The scree plot shows a sharp decrease in explained variance for the first components, followed by a smoother decay. Only a limited number of principal components capture most of the information, suggesting effective dimensionality reduction is possible.
We can apply a simple rule to choose the number of components—retain those explaining at least 50% and then 70% of total variance.
eig_vals <- pca_temporal$eig
cum_var <- cumsum(eig_vals[, 2])
n_comp_50 <- which(cum_var >= 50)[1]
n_comp_70 <- which(cum_var >= 70)[1]
cat("Components for 50% variance:", n_comp_50, "\n")
## Components for 50% variance: 14
cat("Components for 70% variance:", n_comp_70, "\n")
## Components for 70% variance: 31
Based on the cumulative explained variance criterion, the first 14 principal components are sufficient to retain at least 50% of the total variance (which represents a dimensionality reduction from 223 to 14, or ~93.7% of the original dimensions). To explain at 70% of variance, we need to keep 31 components (which represents a dimensionality reduction of ~86,1% of the original dimension).
# fviz_pca_var(
# pca_temporal,
# geom = "point",
# col.var = "contrib",
# gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07")
# )
fviz_pca_var(pca_temporal,
col.var = "contrib",
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"))
Variables pointing in similar directions are positively correlated, while those in opposite directions are negatively correlated. Variables close to the center contribute less to the first two principal components. The color gradient indicates each variable’s contribution to the principal dimensions, red being towars the highest and blue towards the lowest.
fviz_contrib(
pca_temporal,
choice = "var",
axes = 1,
top = 15
)
This plot shows the top 15 temporal features contributing most to the first principal component (Dim-1). Features with higher contribution percentages are more important in defining the primary direction of variance in the dataset.
fviz_pca_ind(
pca_temporal,
alpha.ind = 0.2,
pointsize = 0.5
)
This projection displays all individuals in the space defined by the first two principal components. However, due to the high number of observations, the plot is heavily over-crowded, making it difficult to visually identify any clear structure or separation between observations.
Most points are concentrated near the center, suggesting that the majority of tracks share similar temporal audio profiles in the reduced space. A few outliers can be observed, corresponding to tracks with more distinctive temporal characteristics. This highlights some limitations of individual-level PCA visualizations for large datasets.
Principal Component Analysis successfully reduced the dimensionality of the temporal feature space from 223 to 14 dimensions while retaining 50% of the total variance (or 31 by retaining 70%). This transformation: - Reduces computational complexity for clustering tasks, - Eliminates redundancy by combining correlated features, - Facilitates visualization through low-dimensional projections - Maintains information content with minimal loss
The heterogeneous variance scales across temporal features necessitated standardization before PCA. The resulting principal components capture the dominant patterns of variation in the audio temporal characteristics, enabling more efficient and interpretable analysis of the music dataset.