In this paper, I aim to compare different input reduction techniques ( PCA, MDS,t-SNE) on the echonest dataset. The said dataset is huge: with around 13000+ rows and 250 variables. Applying clustering algorithms on this dataset will yield results which are very diicult to present graphically and also to interpret as well. That is why we will use some input reduction techniques on this dataset to reduce it to a lower dimension and make it more comprehendable. Lets start!
First, lets look prepare the data and look at what columns we have.
echonest_1 <- read.csv("C:/Users/PC-CATHERINE/Desktop/New folder/Unsupervised learning/clustering/fma_metadata/echonest.csv",stringsAsFactors=FALSE)
echonest_1 <- echonest_1[4:13132,]
head(echonest_1)
## track_id audio_features_acousticness audio_features_danceability
## 4 2 0.416675233 0.675893985
## 5 3 0.374407769 0.528643062
## 6 5 0.043566899 0.74556587
## 7 10 0.951669965 0.658178654
## 8 134 0.452217307 0.51323805
## 9 139 0.106549525 0.260911173
## audio_features_energy audio_features_instrumentalness audio_features_liveness
## 4 0.634476268 0.010628068 0.177646571
## 5 0.817461132 0.001851103 0.105879944
## 6 0.701469992 0.000696799 0.373143312
## 7 0.924525162 0.965427015 0.115473884
## 8 0.560409931 0.019442694 0.096566694
## 9 0.607066864 0.83508699 0.223676271
## audio_features_speechiness audio_features_tempo audio_features_valence
## 4 0.159310065 165.922 0.576660988
## 5 0.461818128 126.957 0.269240242
## 6 0.124595342 100.26 0.621661224
## 7 0.032985219 111.562 0.963589892
## 8 0.525519379 114.29 0.894072272
## 9 0.030569276 196.961 0.16026709
## metadata_album_date metadata_album_name metadata_artist_latitude
## 4 32.6783
## 5 32.6783
## 6 32.6783
## 7 3/11/2008 Constant Hitmaker 39.9523
## 8 32.6783
## 9 41.8239
## metadata_artist_location metadata_artist_longitude
## 4 Georgia, US -83.223
## 5 Georgia, US -83.223
## 6 Georgia, US -83.223
## 7 Philadelphia, PA, US -75.1624
## 8 Georgia, US -83.223
## 9 Providence, RI, US -71.412
## metadata_artist_name metadata_release
## 4 AWOL AWOL - A Way Of Life
## 5 AWOL AWOL - A Way Of Life
## 6 AWOL AWOL - A Way Of Life
## 7 Kurt Vile Constant Hitmaker
## 8 AWOL AWOL - A Way Of Life
## 9 Alec K. Redfearn and the Eyesores Every Man For Himself
## ranks_artist_discovery_rank ranks_artist_familiarity_rank
## 4
## 5
## 6
## 7 2635 2544
## 8
## 9 149495 104037
## ranks_artist_hotttnesss_rank ranks_song_currency_rank
## 4
## 5
## 6
## 7 397 115691
## 8
## 9 159249 1871529
## ranks_song_hotttnesss_rank social_features_artist_discovery
## 4 0.388989865
## 5 0.388989865
## 6 0.388989865
## 7 67609 0.557339007
## 8 0.388989865
## 9 5415434 0.388922859
## social_features_artist_familiarity social_features_artist_hotttnesss
## 4 0.38674 0.40637
## 5 0.38674 0.40637
## 6 0.38674 0.40637
## 7 0.614272 0.798387
## 8 0.38674 0.40637
## 9 0.330784 0.4063
## social_features_song_currency social_features_song_hotttnesss
## 4 0 0
## 5 0 0
## 6 0 0
## 7 0.005157993 0.354516
## 8 0 0
## 9 0.00025 0.03855
## temporal_features_0 temporal_features_1 temporal_features_2
## 4 0.877233267 0.588911116 0.35424301
## 5 0.534429133 0.537414253 0.443299472
## 6 0.548092544 0.720191777 0.389257073
## 7 0.311404169 0.711402357 0.321913809
## 8 0.610849261 0.569169462 0.428493828
## 9 0.800282419 0.586372316 0.354159534
## temporal_features_3 temporal_features_4 temporal_features_5
## 4 0.295090139 0.298412502 0.309430391
## 5 0.390878886 0.344572932 0.366447628
## 6 0.344933868 0.361299574 0.402542979
## 7 0.500600755 0.250963062 0.321316451
## 8 0.34579581 0.376920223 0.460590303
## 9 0.26624012 0.25019601 0.211132005
## temporal_features_6 temporal_features_7 temporal_features_8
## 4 0.304495901 0.334578991 0.249494508
## 5 0.419455349 0.74776578 0.460900873
## 6 0.434043676 0.388137311 0.512486696
## 7 0.734249532 0.32518822 0.373012275
## 8 0.401370943 0.44990024 0.428946465
## 9 0.287834972 0.356035829 0.18532078
## temporal_features_9 temporal_features_10 temporal_features_11
## 4 0.259655595 0.318376362 0.371973574
## 5 0.392378867 0.474558801 0.406728774
## 6 0.525755167 0.425370872 0.446896374
## 7 0.235840082 0.368755519 0.440774798
## 8 0.446735591 0.479849219 0.378221363
## 9 0.187472969 0.278765291 0.245532438
## temporal_features_12 temporal_features_13 temporal_features_14
## 4 1 0.57099998 0.277999997
## 5 0.505999982 0.514500022 0.386999995
## 6 0.510999978 0.772000015 0.361000001
## 7 0.263000011 0.736000001 0.273000002
## 8 0.614000022 0.545000017 0.363000006
## 9 1 0.566999972 0.284999996
## temporal_features_15 temporal_features_16 temporal_features_17
## 4 0.209999993 0.215000004 0.228500009
## 5 0.323500007 0.280499995 0.313499987
## 6 0.287999988 0.331 0.372000009
## 7 0.425999999 0.214000002 0.287999988
## 8 0.280000001 0.31099999 0.397000015
## 9 0.184 0.180000007 0.153999999
## temporal_features_18 temporal_features_19 temporal_features_20
## 4 0.237500012 0.279000014 0.168500006
## 5 0.345499992 0.898000002 0.436500013
## 6 0.358999997 0.279000014 0.442999989
## 7 0.810000002 0.246000007 0.294999987
## 8 0.317000002 0.404000014 0.356000006
## 9 0.224000007 0.273000002 0.126000002
## temporal_features_21 temporal_features_22 temporal_features_23
## 4 0.168500006 0.279000014 0.332499981
## 5 0.338499993 0.398000002 0.34799999
## 6 0.483999997 0.368000001 0.397000015
## 7 0.164000005 0.31099999 0.386000007
## 8 0.379999995 0.419999987 0.291999996
## 9 0.120999999 0.194000006 0.197999999
## temporal_features_24 temporal_features_25 temporal_features_26
## 4 0.049847808 0.104211681 0.060229637
## 5 0.079207376 0.083318971 0.073595144
## 6 0.081051275 0.078300044 0.048696768
## 7 0.033968538 0.070691802 0.0391615
## 8 0.085176423 0.092242472 0.073182762
## 9 0.088247903 0.081918128 0.076484337
## temporal_features_27 temporal_features_28 temporal_features_29
## 4 0.052289635 0.047402892 0.052814532
## 5 0.071024314 0.056678556 0.066113152
## 6 0.056921616 0.045264285 0.066819489
## 7 0.095780514 0.024102403 0.028496824
## 8 0.056353632 0.062012442 0.088343367
## 9 0.060063873 0.052019566 0.034803737
## temporal_features_30 temporal_features_31 temporal_features_32
## 4 0.052732728 0.062216219 0.051613092
## 5 0.073888682 0.088100173 0.071305215
## 6 0.094489083 0.089250185 0.098089173
## 7 0.073847033 0.045102958 0.065468304
## 8 0.077083767 0.097941823 0.101789653
## 9 0.058554225 0.070241667 0.030110853
## temporal_features_33 temporal_features_34 temporal_features_35
## 4 0.057399247 0.053198915 0.062582977
## 5 0.059274983 0.088221595 0.067297839
## 6 0.084133461 0.068866462 0.086223744
## 7 0.041634198 0.041618872 0.084442049
## 8 0.094533332 0.08936704 0.088544183
## 9 0.041446012 0.071225368 0.035375651
## temporal_features_36 temporal_features_37 temporal_features_38
## 4 0.035999999 0.017999999 0.017000001
## 5 0.039999999 0.039999999 0.028999999
## 6 0.023 0.023 0.024
## 7 0.027000001 0.081 0.035
## 8 0.003 0.012 0.003
## 9 0.018999999 0.015 0.009
## temporal_features_39 temporal_features_40 temporal_features_41
## 4 0.021 0.021 0.01
## 5 0.021 0.009 0.02
## 6 0.021 0.023 0.02
## 7 0.025 0.033 0.008
## 8 0.004 0.01 0.015
## 9 0.005 0.007 0.006
## temporal_features_42 temporal_features_43 temporal_features_44
## 4 0.015 0.041000001 0.01
## 5 0.02 0.052999999 0.022
## 6 0.028999999 0.022 0.039999999
## 7 0.099 0.037999999 0.022
## 8 0.005 0.006 0.016000001
## 9 0.016000001 0.014 0.012
## temporal_features_45 temporal_features_46 temporal_features_47
## 4 0.009 0.021 0.013
## 5 0.032000002 0.034000002 0.028000001
## 6 0.026000001 0.032000002 0.016000001
## 7 0.009 0.039999999 0.018999999
## 8 0.014 0.013 0.007
## 9 0.005 0.01 0.008
## temporal_features_48 temporal_features_49 temporal_features_50
## 4 1 1 1
## 5 1 1 1
## 6 1 1 1
## 7 1 1 1
## 8 1 1 1
## 9 1 1 1
## temporal_features_51 temporal_features_52 temporal_features_53
## 4 1 1 1
## 5 1 1 1
## 6 1 1 1
## 7 1 1 1
## 8 1 1 1
## 9 1 1 1
## temporal_features_54 temporal_features_55 temporal_features_56
## 4 1 1 1
## 5 1 1 1
## 6 1 1 1
## 7 1 1 1
## 8 1 1 1
## 9 1 1 1
## temporal_features_57 temporal_features_58 temporal_features_59
## 4 1 1 1
## 5 1 1 1
## 6 1 1 1
## 7 1 1 1
## 8 1 1 1
## 9 1 1 1
## temporal_features_60 temporal_features_61 temporal_features_62
## 4 0.963999987 0.981999993 0.98299998
## 5 0.959999979 0.959999979 0.971000016
## 6 0.976999998 0.976999998 0.976000011
## 7 0.97299999 0.91900003 0.964999974
## 8 0.996999979 0.987999976 0.996999979
## 9 0.981000006 0.985000014 0.990999997
## temporal_features_63 temporal_features_64 temporal_features_65
## 4 0.978999972 0.978999972 0.99000001
## 5 0.978999972 0.990999997 0.980000019
## 6 0.978999972 0.976999998 0.980000019
## 7 0.975000024 0.967000008 0.991999984
## 8 0.995999992 0.99000001 0.985000014
## 9 0.995000005 0.992999971 0.994000018
## temporal_features_66 temporal_features_67 temporal_features_68
## 4 0.985000014 0.958999991 0.99000001
## 5 0.980000019 0.947000027 0.977999985
## 6 0.971000016 0.977999985 0.959999979
## 7 0.901000023 0.962000012 0.977999985
## 8 0.995000005 0.994000018 0.984000027
## 9 0.984000027 0.986000001 0.987999976
## temporal_features_69 temporal_features_70 temporal_features_71
## 4 0.990999997 0.978999972 0.986999989
## 5 0.967999995 0.966000021 0.972000003
## 6 0.973999977 0.967999995 0.984000027
## 7 0.990999997 0.959999979 0.981000006
## 8 0.986000001 0.986999989 0.992999971
## 9 0.995000005 0.99000001 0.991999984
## temporal_features_72 temporal_features_73 temporal_features_74
## 4 -1.899341822 -0.032654114 0.87846911
## 5 0.197377607 0.182771787 0.608393788
## 6 0.192822129 -0.671700835 0.716430783
## 7 1.373788953 -0.422791123 1.210828781
## 8 -0.099188171 0.033726491 0.699475884
## 9 -1.316763163 -0.044169307 0.784182429
## temporal_features_75 temporal_features_76 temporal_features_77
## 4 1.147537947 0.950855732 0.948257029
## 5 0.785822094 0.773478866 0.650546253
## 6 1.177679062 0.629193127 0.478121221
## 7 0.401990235 1.83861196 1.161653876
## 8 1.039602399 0.898852348 0.505001247
## 9 1.179121137 1.514389396 1.552488208
## temporal_features_78 temporal_features_79 temporal_features_80
## 4 1.157886982 1.147910953 1.646318436
## 5 0.574604988 -0.767803609 0.32626611
## 6 0.633280337 0.862866283 0.344353527
## 7 -0.547190547 1.386646748 1.216523647
## 8 0.625378251 0.394605964 0.554671347
## 9 1.392562747 1.159600854 2.182097912
## temporal_features_81 temporal_features_82 temporal_features_83
## 4 1.530193329 1.19756794 0.745672822
## 5 0.808435142 0.506893337 0.682139456
## 6 0.264090031 0.673425674 0.461553812
## 7 2.32090044 1.221092463 0.474826604
## 8 0.524493814 0.358941972 0.864620507
## 9 2.424869537 1.430303574 1.744238973
## temporal_features_84 temporal_features_85 temporal_features_86
## 4 2.510037899 -1.500183225 0.03053999
## 5 -1.157547832 -1.170147061 -0.683187723
## 6 -1.07932806 -0.744193077 0.10199213
## 7 2.1177001 -1.080738664 1.304154396
## 8 -1.255710125 -1.326044679 -0.51587224
## 9 0.33348608 -1.060922384 -0.441638708
## temporal_features_87 temporal_features_88 temporal_features_89
## 4 0.694242001 0.170431614 0.064694881
## 5 -0.366573572 -0.24535656 -0.547616005
## 6 0.862340212 -0.29469347 -0.819227934
## 7 -1.20128572 4.986208916 1.730811596
## 8 0.517893076 -0.001662016 -0.967699766
## 9 0.646966934 1.989299297 2.555457115
## temporal_features_90 temporal_features_91 temporal_features_92
## 4 0.874726534 0.722576141 2.251319885
## 5 -0.809711218 -0.894494772 -0.808738232
## 6 -0.85995698 -0.540470123 -1.287919641
## 7 -1.124397993 1.428501129 0.490016699
## 8 -0.747462511 -1.202027679 -1.038380623
## 9 1.49840498 0.470611811 5.622509956
## temporal_features_93 temporal_features_94 temporal_features_95
## 4 1.708159447 1.054857254 0.020674944
## 5 -0.13031745 -1.056485295 -0.510763168
## 6 -1.182707906 -0.566510439 -0.931231976
## 7 5.137411118 1.125351429 -0.976437807
## 8 -1.039334655 -1.07629323 -0.390393019
## 9 6.15321064 1.250901699 3.696545124
## temporal_features_96 temporal_features_97 temporal_features_98
## 4 42.94913101 44.38743591 32.4093895
## 5 44.09728241 48.79024124 10.58431721
## 6 40.27466202 6.50887394 -7.265672684
## 7 46.43989944 6.738813877 72.58660126
## 8 40.35828018 24.11554718 20.22726059
## 9 46.06570816 43.61607742 37.65499496
## temporal_features_99 temporal_features_100 temporal_features_101
## 4 15.66866684 10.11402798 -4.069252491
## 5 -2.565454006 -1.292830706 -4.490148544
## 6 -4.340634823 10.40727139 -7.618135452
## 7 20.43871689 -32.37782669 -3.392143488
## 8 6.252143383 -21.95030594 5.266994476
## 9 -1.757543922 -20.96863747 -18.83882141
## temporal_features_102 temporal_features_103 temporal_features_104
## 4 2.042353153 2.188321114 -3.805923462
## 5 -0.633740664 2.112556458 -7.28805542
## 6 5.729183197 0.286108196 10.88886547
## 7 -1.747229695 -9.380472183 1.754842758
## 8 -5.009126186 0.108463913 12.66572094
## 9 -4.884634018 -3.038664818 7.537405491
## temporal_features_105 temporal_features_106 temporal_features_107
## 4 -0.494698674 6.024669647 10.6925993
## 5 -5.132599354 -2.390408516 11.44797802
## 6 0.24168165 -3.91210866 1.756582856
## 7 -11.14752197 5.879512787 3.324857235
## 8 11.32713985 -4.692913055 -0.311117172
## 9 3.371185303 0.908670306 -0.195674002
## temporal_features_108 temporal_features_109 temporal_features_110
## 4 44.44250107 42.38850021 31.68499947
## 5 45.41450119 51.97900009 6.597999573
## 6 41.42699814 7.835999966 -10.47999954
## 7 47.18700027 3.536000013 74.30599976
## 8 41.78499985 19.59199905 7.034999847
## 9 46.70500183 41.91199875 38.60599899
## temporal_features_111 temporal_features_112 temporal_features_113
## 4 9.987500191 9.568500519 -7.148499966
## 5 0.280000001 -0.012 -8.049499512
## 6 -5.742000103 10.46800041 -10.38000011
## 7 19.5890007 -36.0530014 -3.496999979
## 8 1.393000007 -23.07999992 -2.693000078
## 9 -2.375 -19.80999947 -20.77599907
## temporal_features_114 temporal_features_115 temporal_features_116
## 4 3.831500053 1.850500107 -2.6875
## 5 -0.682999969 1.031000018 -7.077500343
## 6 5.907999992 0.906000018 12.02900028
## 7 -0.418000013 -9.842000008 0.898000002
## 8 -3.40899992 -1.279999971 13.7489996
## 9 -3.755000114 -1.960999966 6.427999973
## temporal_features_117 temporal_features_118 temporal_features_119
## 4 -0.799999952 5.461500168 10.25650024
## 5 -4.321000099 -0.92750001 9.089500427
## 6 -1.319000006 -3.049000025 0.986999989
## 7 -9.960000038 6.119999886 3.911000013
## 8 11.0340004 -3.838999987 -1.822000027
## 9 3.122999907 1.70299995 -0.824000001
## temporal_features_120 temporal_features_121 temporal_features_122
## 4 39.49481964 1966.979126 1825.123047
## 5 22.51940727 1694.821167 1256.443848
## 6 27.55527115 1956.254395 1382.757202
## 7 22.19372749 1392.732788 572.2828369
## 8 26.85305023 4123.289551 4842.126953
## 9 20.70482063 1268.838623 927.0623779
## temporal_features_123 temporal_features_124 temporal_features_125
## 4 1903.756714 828.8100586 911.1558228
## 5 1251.588257 907.545166 588.6020508
## 6 1596.684204 983.1115112 945.4044189
## 7 694.788147 880.8521118 344.1044617
## 8 2033.496216 1603.765381 1318.972656
## 9 624.9285889 586.0334473 432.5063171
## temporal_features_126 temporal_features_127 temporal_features_128
## 4 581.0153198 722.0014038 404.6825562
## 5 619.9716797 679.5880127 301.7233582
## 6 659.3389282 835.0131226 399.1546936
## 7 395.0022583 306.6034546 162.2848206
## 8 709.5377197 1050.203857 758.4732056
## 9 428.2659302 282.7200623 205.2754974
## temporal_features_129 temporal_features_130 temporal_features_131
## 4 315.5284729 376.6324158 229.282547
## 5 401.6705322 294.2216187 411.2994995
## 6 483.607666 378.4648743 244.3444672
## 7 283.1201172 125.4874268 139.4597778
## 8 563.1395874 366.803772 409.6324768
## 9 160.5900116 117.3566208 171.0218506
## temporal_features_132 temporal_features_133 temporal_features_134
## 4 0 -110.3679962 -100.6050034
## 5 0 -82.77400208 -137.5910034
## 6 0 -138.4380035 -137.2039948
## 7 0 -174.0859985 -61.27899933
## 8 10.06499958 -162.1009979 -137.9539948
## 9 5.455999851 -70.10800171 -163.3690033
## temporal_features_135 temporal_features_136 temporal_features_137
## 4 -112.5810013 -75.88200378 -89.16000366
## 5 -131.7290039 -106.2429962 -73.44499969
## 6 -126.4509964 -89.24700165 -198.0559998
## 7 -95.27200317 -91.91000366 -56.06499863
## 8 -137.9830017 -146.548996 -105.6989975
## 9 -210.951004 -108.5390015 -72.88600159
## temporal_features_138 temporal_features_139 temporal_features_140
## 4 -80.73799896 -91.4980011 -66.64900208
## 5 -83.46800232 -81.32299805 -71.0739975
## 6 -78.34200287 -89.74500275 -50.59600067
## 7 -101.487999 -70.79599762 -40.38999939
## 8 -84.07700348 -99.0510025 -71.30200195
## 9 -84.99500275 -92.5739975 -45.71099854
## temporal_features_141 temporal_features_142 temporal_features_143
## 4 -61.84500122 -66.08100128 -58.04399872
## 5 -108.5650024 -71.4980011 -51.35100174
## 6 -81.18900299 -57.69400024 -57.31200027
## 7 -58.23400116 -95.46399689 -43.45800018
## 8 -76.05400085 -78.45800018 -64.71399689
## 9 -63.77600098 -71.32499695 -38.44900131
## temporal_features_144 temporal_features_145 temporal_features_146
## 4 52.00600052 216.2369995 208.4230042
## 5 51.36600113 190.3339996 114.8440018
## 6 48.24000168 211.4900055 98.5039978
## 7 52.19300079 171.1300049 131.0859985
## 8 47.80400085 243.9210052 251.8540039
## 9 52.64899826 178.2590027 152.9559937
## temporal_features_147 temporal_features_148 temporal_features_149
## 4 145.1940002 97.48200226 98.72299957
## 5 359.9419861 101.8619995 111.0820007
## 6 316.5509949 92.76300049 212.5590057
## 7 298.5969849 159.0930023 105.1169968
## 8 212.2160034 107.8359985 192.6790009
## 9 225.2250061 57.48600006 143.628006
## temporal_features_150 temporal_features_151 temporal_features_152
## 4 68.09100342 101.5889969 69.5059967
## 5 78.64800262 103.0009995 46.22299957
## 6 69.36699677 126.810997 63.86800003
## 7 73.43399811 79.76000214 49.59899902
## 8 82.65399933 107.7369995 107.2570038
## 9 71.72699738 70.36100006 55.24100113
## temporal_features_153 temporal_features_154 temporal_features_155
## 4 58.22700119 69.26200104 58.17599869
## 5 53.99399948 61.18099976 90.42900085
## 6 73.84200287 60.08800125 70.40200043
## 7 63.23099899 69.7539978 35.38800049
## 8 89.80400085 75.47599792 71.63800049
## 9 57.18600082 45.38999939 55.45199966
## temporal_features_156 temporal_features_157 temporal_features_158
## 4 52.00600052 326.6049805 309.0280151
## 5 51.36600113 273.1080017 252.4349976
## 6 48.24000168 349.928009 235.7079926
## 7 52.19300079 345.2160034 192.3649902
## 8 37.73900223 406.0220032 389.8079834
## 9 47.19299698 248.3670044 316.3250122
## temporal_features_159 temporal_features_160 temporal_features_161
## 4 257.7749939 173.3640137 187.8829956
## 5 491.67099 208.1049957 184.5270081
## 6 443.0019836 182.0100098 410.6149902
## 7 393.868988 251.003006 161.1819916
## 8 350.1990051 254.3849945 298.3779907
## 9 436.1760254 166.0249939 216.5140076
## temporal_features_162 temporal_features_163 temporal_features_164
## 4 148.82901 193.0870056 136.1549988
## 5 162.1159973 184.3240051 117.2969971
## 6 147.7089996 216.5559998 114.4640045
## 7 174.9219971 150.5559998 89.98899841
## 8 166.7310028 206.7879944 178.5590057
## 9 156.7220001 162.9349976 100.9519958
## temporal_features_165 temporal_features_166 temporal_features_167
## 4 120.0720062 135.3430023 116.2200012
## 5 162.5590057 132.6790009 141.7799988
## 6 155.0310059 117.7819977 127.7140045
## 7 121.4649963 165.2179871 78.84600067
## 8 165.8580017 153.9339905 136.3519897
## 9 120.9620056 116.7149963 93.90100098
## temporal_features_168 temporal_features_169 temporal_features_170
## 4 -2.952152491 0.060378753 0.525976002
## 5 -1.827564001 -0.083561122 0.162381768
## 6 -2.893348694 0.052128505 0.1697772
## 7 -4.515986443 0.08299911 -0.47142157
## 8 -1.652578592 0.301870048 0.6659832
## 9 -2.668028832 0.368284553 -0.717473745
## temporal_features_171 temporal_features_172 temporal_features_173
## 4 0.365914643 0.018182358 0.454430938
## 5 0.829534471 -0.164874077 0.897740006
## 6 0.796857715 -0.164510101 0.464760065
## 7 2.171539068 1.747734904 0.435429275
## 8 0.784959793 0.10766203 1.039749503
## 9 0.556752384 -0.388757259 2.609678268
## temporal_features_174 temporal_features_175 temporal_features_176
## 4 -0.330007434 0.149395019 -0.214858666
## 5 -0.058807492 0.365381032 -0.13138853
## 6 -0.211986959 0.027119339 -0.21523957
## 7 -0.603002369 0.200987026 0.127109975
## 8 -0.13751407 0.217577919 -0.044490114
## 9 -0.219993308 -0.936712086 0.461267293
## temporal_features_177 temporal_features_178 temporal_features_179
## 4 0.030427268 -0.153877094 -0.150131583
## 5 -0.24557887 -0.33528015 0.613119781
## 6 0.08305224 -0.004778119 0.114814624
## 7 -0.005297164 -0.956349313 -0.287195444
## 8 0.011159069 -0.265694797 0.331218362
## 9 -0.25238502 -1.753690362 0.325034857
## temporal_features_180 temporal_features_181 temporal_features_182
## 4 13.206213 1.009933949 1.577194214
## 5 8.424042702 0.23083353 0.614211559
## 6 12.99816608 1.258411408 -0.105143309
## 7 30.33190537 2.051291943 1.123435974
## 8 3.16800642 0.14156127 -0.047710419
## 9 11.16335583 0.683052778 3.298259735
## temporal_features_183 temporal_features_184 temporal_features_185
## 4 0.337023497 0.097149372 0.401259661
## 5 11.62734795 1.015812874 1.627731323
## 6 5.284808159 -0.250733852 4.719754696
## 7 22.17761612 7.889377594 1.809147358
## 8 1.916983604 -0.139364481 2.251030445
## 9 17.83130455 0.366277695 13.12767601
## temporal_features_186 temporal_features_187 temporal_features_188
## 4 0.006324291 0.643485785 0.012058735
## 5 0.032317877 0.819125652 -0.03099823
## 6 -0.18334198 0.340812445 -0.29597044
## 7 2.219094753 1.518430233 0.654815435
## 8 -0.224826098 0.05070281 0.188019276
## 9 0.144084454 4.395817757 0.5084548
## temporal_features_189 temporal_features_190 temporal_features_191
## 4 0.237947464 0.655938387 1.213864327
## 5 0.734610081 0.45888257 0.999964476
## 6 0.099103212 0.098722696 1.389371872
## 7 0.650727272 12.65647316 0.406731367
## 8 0.249749661 0.931698084 0.766068697
## 9 3.026659966 9.700685501 0.401282549
## temporal_features_192 temporal_features_193 temporal_features_194
## 4 -12.48614597 -11.26949978 46.03126144
## 5 -12.50204372 -11.4204998 26.46855164
## 6 -15.4580946 -14.10499954 35.95522308
## 7 -10.24489021 -9.463999748 20.30430794
## 8 -15.14547157 -14.15100002 19.98814583
## 9 -11.21361256 -10.5539999 12.38000679
## temporal_features_195 temporal_features_196 temporal_features_197
## 4 -60 -3.933000088 56.06700134
## 5 -60 -5.789000034 54.21099854
## 6 -60 -7.248000145 52.7519989
## 7 -60 -5.02699995 54.97299957
## 8 -40.20999908 -7.350999832 32.85900116
## 9 -52.50999832 -3.947999954 48.56199646
## temporal_features_198 temporal_features_199 temporal_features_200
## 4 -2.587475061 11.80258465 0.047970295
## 5 -1.755855203 7.89535141 0.057707384
## 6 -2.505532742 9.716597557 0.058607817
## 7 -5.365218639 41.20127869 0.048938308
## 8 -1.63250792 3.34098196 0.059469711
## 9 -2.533699989 18.93443108 0.051385369
## temporal_features_201 temporal_features_202 temporal_features_203
## 4 0.038275 0.000988261 0
## 5 0.045359999 0.001397325 0
## 6 0.045699999 0.001776559 0
## 7 0.040800002 0.002591431 0
## 8 0.048560001 0.001586408 0.01079
## 9 0.041859999 0.002096751 0.00532
## temporal_features_204 temporal_features_205 temporal_features_206
## 4 0.207300007 0.207300007 1.603658557
## 5 0.33950001 0.33950001 2.271020651
## 6 0.294970006 0.294970006 1.827837348
## 7 0.895739973 0.895739973 10.53970909
## 8 0.420060009 0.409270018 2.763947725
## 9 0.567369998 0.562049985 4.573484898
## temporal_features_207 temporal_features_208 temporal_features_209
## 4 2.984275818 -21.81207657 -20.31200027
## 5 9.186051369 -20.18503189 -19.86800003
## 6 5.253726959 -24.52311897 -24.36700058
## 7 150.3599854 -16.4727726 -15.90299988
## 8 13.71832371 -24.33657455 -22.4489994
## 9 33.38273621 -16.18879509 -15.30300045
## temporal_features_210 temporal_features_211 temporal_features_212
## 4 49.15748215 -60 -9.690999985
## 5 24.00232697 -60 -9.678999901
## 6 31.80454636 -60 -12.58199978
## 7 27.53944016 -60 -9.024999619
## 8 52.78390503 -60 -13.12800026
## 9 34.669384 -60 -8.598999977
## temporal_features_213 temporal_features_214 temporal_features_215
## 4 50.30899811 -1.992302537 6.805693626
## 5 50.32099915 -1.582331181 8.889307976
## 6 47.41799927 -2.288357973 11.52710915
## 7 50.97499847 -3.662987709 21.5082283
## 8 46.87200165 -1.452696323 2.356398106
## 9 51.40100098 -3.078667164 12.41156673
## temporal_features_216 temporal_features_217 temporal_features_218
## 4 0.233069763 0.192880005 0.027454989
## 5 0.25846377 0.220905006 0.081368424
## 6 0.256821364 0.23782 0.060122397
## 7 0.283351898 0.267069995 0.125704497
## 8 0.23468639 0.199550003 0.149331778
## 9 0.270801574 0.272700012 0.025242079
## temporal_features_219 temporal_features_220 temporal_features_221
## 4 0.06408 3.676959992 3.612879992
## 5 0.064130001 6.082769871 6.018640041
## 6 0.060139999 5.92648983 5.866349697
## 7 0.080820002 8.414010048 8.333189964
## 8 0.064400002 11.26706982 11.2026701
## 9 0.064039998 2.436690092 2.372650147
## temporal_features_222 temporal_features_223
## 4 13.31669044 262.9297485
## 5 16.67354774 325.5810852
## 6 16.01384926 356.7557373
## 7 21.31706429 483.4038086
## 8 26.45417976 751.1477051
## 9 3.897095442 37.86604309
Now, we need to remove the text based columns and convert the rest of the columns to numeric type. Furthermore, we will also scale the data as the columns differ in the measures and hence their metrics and scales. For now, we are only taking the sample of the data as the entire data takes a longer time to run.
echonest<-echonest_1[1:2000,c(-10,-11,-13,-15,-16)]
echonest<-echonest[,c(-10,-11)]
names<-colnames(echonest)
echonest[names] <- sapply(echonest[names],as.numeric)
echonest[,-1]<-scale(echonest[,-1])
head(echonest)
## track_id audio_features_acousticness audio_features_danceability
## 4 2 -0.7579922 1.6349737
## 5 3 -0.8831350 0.7354699
## 6 5 -1.8626679 2.0605746
## 7 10 0.8259867 1.5267570
## 8 134 -0.6527614 0.6413661
## 9 139 -1.6761929 -0.9000095
## audio_features_energy audio_features_instrumentalness audio_features_liveness
## 4 0.4012889 -2.1123487 -0.09593665
## 5 1.0306976 -2.1392744 -0.51815593
## 6 0.6317257 -2.1428156 1.05421484
## 7 1.3989632 0.8167603 -0.46171261
## 8 0.1465247 -2.0853074 -0.57294788
## 9 0.3070094 0.4169063 0.17486647
## audio_features_speechiness audio_features_tempo audio_features_valence
## 4 0.3752442 1.14061665 0.6356884
## 5 2.3704497 0.05016077 -0.4698175
## 6 0.1462817 -0.69696872 0.7975123
## 7 -0.4579370 -0.38067634 2.0271111
## 8 2.7905942 -0.30433184 1.7771210
## 9 -0.4738714 2.00925928 -0.8616923
## ranks_artist_discovery_rank ranks_artist_familiarity_rank
## 4 NA NA
## 5 NA NA
## 6 NA NA
## 7 -0.69589482 -0.52922575
## 8 NA NA
## 9 -0.06980413 0.08100297
## ranks_artist_hotttnesss_rank ranks_song_currency_rank
## 4 NA NA
## 5 NA NA
## 6 NA NA
## 7 -0.538130034 -1.5424660
## 8 NA NA
## 9 -0.009019591 -0.6646663
## ranks_song_hotttnesss_rank social_features_artist_discovery
## 4 NA 0.6392530
## 5 NA 0.6392530
## 6 NA 0.6392530
## 7 -1.247402 2.0977606
## 8 NA 0.6392530
## 9 1.752815 0.6386725
## social_features_artist_familiarity social_features_artist_hotttnesss
## 4 0.5639636 0.4264003
## 5 0.5639636 0.4264003
## 6 0.5639636 0.4264003
## 7 2.2050837 3.1913666
## 8 0.5639636 0.4264003
## 9 0.1603697 0.4259065
## social_features_song_currency social_features_song_hotttnesss
## 4 -0.2278766 -0.4837453
## 5 -0.2278766 -0.4837453
## 6 -0.2278766 -0.4837453
## 7 10.6144361 5.8609075
## 8 -0.2278766 -0.4837453
## 9 0.2976337 0.2061710
## temporal_features_0 temporal_features_1 temporal_features_2
## 4 2.6691868 1.0780202 -0.16983137
## 5 0.5791185 0.7519850 0.48072410
## 6 0.6624240 1.9091797 0.08594558
## 7 -0.7806591 1.8535325 -0.40599546
## 8 1.0450501 0.9530325 0.37256920
## 9 2.2000194 1.0619466 -0.17044116
## temporal_features_3 temporal_features_4 temporal_features_5
## 4 -0.1639694 -0.61025010 -0.2116087
## 5 0.6155101 -0.30673522 0.2240596
## 6 0.2416332 -0.19675391 0.4998640
## 7 1.5083701 -0.92224050 -0.1207874
## 8 0.2486472 -0.09404474 0.9434033
## 9 -0.3987360 -0.92728403 -0.9627062
## temporal_features_6 temporal_features_7 temporal_features_8
## 4 -0.3056261 -0.24104072 -0.6052928
## 5 0.6065090 2.94463037 1.0576909
## 6 0.7222587 0.17189405 1.4634799
## 7 3.1042144 -0.31344359 0.3663338
## 8 0.4630199 0.64808637 0.8063283
## 9 -0.4378208 -0.07560845 -1.1101019
## temporal_features_9 temporal_features_10 temporal_features_11
## 4 -0.7755455 0.09014109 0.04987199
## 5 0.1673718 1.40693733 0.30688954
## 6 1.1149285 0.99222694 0.60393222
## 7 -0.9447401 0.51489489 0.55866267
## 8 0.5535430 1.45154159 0.09607490
## 9 -1.2883588 -0.24382545 -0.88517055
## temporal_features_12 temporal_features_13 temporal_features_14
## 4 2.7750983 1.0350260 -0.1823276
## 5 0.5293443 0.7527431 0.4466169
## 6 0.5520746 2.0392547 0.2965935
## 7 -0.5753482 1.8593928 -0.2111782
## 8 1.0203191 0.9051260 0.3081338
## 9 2.7750983 1.0150413 -0.1419366
## temporal_features_15 temporal_features_16 temporal_features_17
## 4 -0.3295934 -0.57531906 -0.2787673
## 5 0.4990076 -0.24027142 0.2823319
## 6 0.2398416 0.01804782 0.6685004
## 7 1.2473035 -0.58043430 0.1140021
## 8 0.1814381 -0.08425687 0.8335297
## 9 -0.5194050 -0.75435216 -0.7705545
## temporal_features_18 temporal_features_19 temporal_features_20
## 4 -0.2806696 -0.08983402 -0.6489593
## 5 0.4599513 3.77829878 1.1971361
## 6 0.5525290 -0.08983402 1.2419106
## 7 3.6453075 -0.29605116 0.2224251
## 8 0.2645097 0.69129136 0.6426186
## 9 -0.3732472 -0.12732811 -0.9417170
## temporal_features_21 temporal_features_22 temporal_features_23
## 4 -0.7302833 0.2879853 0.20368864
## 5 0.2371546 1.1694669 0.29660625
## 6 1.0651677 0.9472446 0.59034575
## 7 -0.7558920 0.5250222 0.52440421
## 8 0.4733233 1.3324298 -0.03909583
## 9 -1.0005969 -0.3416445 -0.60259580
## temporal_features_24 temporal_features_25 temporal_features_26
## 4 -1.02257052 1.02400973 -0.49898446
## 5 -0.04928989 0.26444066 -0.06004333
## 6 0.01183605 0.08197407 -0.87773931
## 7 -1.54897425 -0.19462889 -1.19089027
## 8 0.14858625 0.58886078 -0.07358650
## 9 0.25040696 0.21351204 0.03484164
## temporal_features_27 temporal_features_28 temporal_features_29
## 4 -0.11998444 -0.9579198 -0.39501054
## 5 0.56164735 -0.6575957 0.05471763
## 6 0.04854290 -1.0271628 0.07860429
## 7 1.46236269 -1.7123346 -1.21737845
## 8 0.02787769 -0.4848971 0.80649141
## 9 0.16286897 -0.8084428 -1.00409343
## temporal_features_30 temporal_features_31 temporal_features_32
## 4 -0.4141219 -0.4439464 -0.3189987
## 5 0.3435524 0.3996681 0.3904499
## 6 1.0813302 0.4371495 1.3553962
## 7 0.3420608 -1.0017050 0.1801634
## 8 0.4579804 0.7204290 1.4887135
## 9 -0.2056322 -0.1823796 -1.0936604
## temporal_features_33 temporal_features_34 temporal_features_35
## 4 -0.6141902 -0.2232667 -0.3416775
## 5 -0.5552448 1.0214167 -0.1869165
## 6 0.2259389 0.3335478 0.4343091
## 7 -1.1096107 -0.6348139 0.3758266
## 8 0.5527574 1.0621251 0.5104754
## 9 -1.1155245 0.4173818 -1.2347332
## temporal_features_36 temporal_features_37 temporal_features_38
## 4 0.42458091 -0.1289294 0.0019827
## 5 0.55046659 0.6689458 0.6280831
## 6 0.01545247 0.0524059 0.3672079
## 7 0.14133818 2.1558953 0.9411334
## 8 -0.61397595 -0.3465317 -0.7284679
## 9 -0.11043325 -0.2377306 -0.4154177
## temporal_features_39 temporal_features_40 temporal_features_41
## 4 0.2781594 0.1207125 -0.30287448
## 5 0.2781594 -0.4139065 0.23571266
## 6 0.2781594 0.2098157 0.23571266
## 7 0.4865965 0.6553315 -0.41059191
## 8 -0.6076985 -0.3693549 -0.03358091
## 9 -0.5555892 -0.5030097 -0.51830933
## temporal_features_42 temporal_features_43 temporal_features_44
## 4 -0.08516872 1.41356465 -0.329784407
## 5 0.18090037 2.08149552 0.326502961
## 6 0.65982466 0.35600721 1.310933959
## 7 4.38479188 1.24658180 0.326502961
## 8 -0.61730688 -0.53456743 -0.001640668
## 9 -0.03195485 -0.08928011 -0.220403179
## temporal_features_45 temporal_features_46 temporal_features_47
## 4 -0.3738172 0.3430937 -0.164439280
## 5 0.8000234 1.0686866 0.641240712
## 6 0.4938041 0.9570570 -0.003303238
## 7 -0.3738172 1.4035754 0.157832642
## 8 -0.1186344 -0.1034249 -0.486711255
## 9 -0.5779633 -0.2708694 -0.432999259
## temporal_features_48 temporal_features_49 temporal_features_50
## 4 0.06799924 0.07992043 0.1140083
## 5 0.06799924 0.07992043 0.1140083
## 6 0.06799924 0.07992043 0.1140083
## 7 0.06799924 0.07992043 0.1140083
## 8 0.06799924 0.07992043 0.1140083
## 9 0.06799924 0.07992043 0.1140083
## temporal_features_51 temporal_features_52 temporal_features_53
## 4 0.1947765 0.1237257 0.144763
## 5 0.1947765 0.1237257 0.144763
## 6 0.1947765 0.1237257 0.144763
## 7 0.1947765 0.1237257 0.144763
## 8 0.1947765 0.1237257 0.144763
## 9 0.1947765 0.1237257 0.144763
## temporal_features_54 temporal_features_55 temporal_features_56
## 4 0.13609 0.1219353 0.1448442
## 5 0.13609 0.1219353 0.1448442
## 6 0.13609 0.1219353 0.1448442
## 7 0.13609 0.1219353 0.1448442
## 8 0.13609 0.1219353 0.1448442
## 9 0.13609 0.1219353 0.1448442
## temporal_features_57 temporal_features_58 temporal_features_59
## 4 0.1142661 0.1467471 0.1161975
## 5 0.1142661 0.1467471 0.1161975
## 6 0.1142661 0.1467471 0.1161975
## 7 0.1142661 0.1467471 0.1161975
## 8 0.1142661 0.1467471 0.1161975
## 9 0.1142661 0.1467471 0.1161975
## temporal_features_60 temporal_features_61 temporal_features_62
## 4 -0.25334696 0.14287930 0.09709828
## 5 -0.34311079 -0.33425337 -0.23604894
## 6 0.03838514 0.03444023 -0.09723732
## 7 -0.05137869 -1.22345349 -0.40262421
## 8 0.48720294 0.27300594 0.48577116
## 9 0.12814896 0.20794326 0.31919756
## temporal_features_63 temporal_features_64 temporal_features_65
## 4 0.10007495 0.0462137654 0.25910535
## 5 0.10007495 0.3206873731 0.03640143
## 6 0.10007495 0.0004688541 0.03640143
## 7 0.03407389 -0.2282584471 0.30364559
## 8 0.38058346 0.2978149174 0.14775338
## 9 0.36408320 0.3664322844 0.34818717
## temporal_features_66 temporal_features_67 temporal_features_68
## 4 0.16166352 -0.56012671 0.25624695
## 5 0.04555131 -0.87591978 0.01974737
## 6 -0.16345096 -0.06011968 -0.33500137
## 7 -1.78902342 -0.48117766 0.01974737
## 8 0.39388797 0.36093987 0.13799774
## 9 0.13844136 0.15041008 0.21682976
## temporal_features_69 temporal_features_70 temporal_features_71
## 4 0.2889967 -0.005718109 0.1795306
## 5 -0.3057002 -0.306028736 -0.1838918
## 6 -0.1505623 -0.259827527 0.1068470
## 7 0.2889967 -0.444635133 0.0341619
## 8 0.1597149 0.179089519 0.3248992
## 9 0.3924225 0.248392718 0.3006714
## temporal_features_72 temporal_features_73 temporal_features_74
## 4 -2.6628942 -0.8696579 -0.09429838
## 5 -0.4864619 -0.6452586 -0.43160371
## 6 -0.4911906 -1.5353236 -0.29667300
## 7 0.7346741 -1.2760458 0.32079579
## 8 -0.7943025 -0.8005123 -0.31784849
## 9 -2.0581671 -0.8816528 -0.21205590
## temporal_features_75 temporal_features_76 temporal_features_77
## 4 -0.1415646 0.064800016 -0.28002636
## 5 -0.5752710 -0.143824894 -0.64124175
## 6 -0.1054247 -0.313529095 -0.85044673
## 7 -1.0354951 1.108950062 -0.02110988
## 8 -0.2709821 0.003635324 -0.81783293
## 9 -0.1036956 0.727610011 0.45309323
## temporal_features_78 temporal_features_79 temporal_features_80
## 4 0.001265656 0.1652097 0.46190937
## 5 -0.715026924 -2.3466998 -1.08819989
## 6 -0.642971353 -0.2085445 -1.06696023
## 7 -2.092634713 0.4782431 -0.04278948
## 8 -0.652675417 -0.8225335 -0.81998850
## 9 0.289456464 0.1805376 1.09106376
## temporal_features_81 temporal_features_82 temporal_features_83
## 4 0.5908062 -0.18015340 -0.3598542
## 5 -0.2527817 -0.98108795 -0.4382347
## 6 -0.8890100 -0.78797023 -0.7103689
## 7 1.5149813 -0.15287340 -0.6939944
## 8 -0.5846511 -1.15265841 -0.2131097
## 9 1.6364999 0.08973636 0.8720666
## temporal_features_84 temporal_features_85 temporal_features_86
## 4 0.43898120 -0.4363700 -0.1822363
## 5 -0.35334458 -0.3726418 -0.3560991
## 6 -0.33644639 -0.2903923 -0.1648307
## 7 0.35422262 -0.3553775 0.1280139
## 8 -0.37455104 -0.4027448 -0.3153413
## 9 -0.03122952 -0.3515510 -0.2972582
## temporal_features_87 temporal_features_88 temporal_features_89
## 4 -0.2977471 -0.1615905 -0.38118360
## 5 -0.5222343 -0.2834922 -0.53053064
## 6 -0.2621746 -0.2979569 -0.59677874
## 7 -0.6988740 1.2503091 0.02519427
## 8 -0.3350657 -0.2120453 -0.63299209
## 9 -0.3077514 0.3716689 0.22633125
## temporal_features_90 temporal_features_91 temporal_features_92
## 4 -0.138542085 -0.04287846 0.05919186
## 5 -0.486485589 -0.49091758 -0.55072030
## 6 -0.496864534 -0.39282857 -0.64622782
## 7 -0.551488419 0.15271098 -0.29186037
## 8 -0.473627273 -0.57612521 -0.59649122
## 9 -0.009712828 -0.11268980 0.73111694
## temporal_features_93 temporal_features_94 temporal_features_95
## 4 0.1647077 -0.2022689 -0.2709822
## 5 -0.2807815 -0.5440338 -0.4084528
## 6 -0.5357907 -0.4647211 -0.5172183
## 7 0.9956643 -0.1908579 -0.5289120
## 8 -0.5010493 -0.5472401 -0.3773159
## 9 1.2418070 -0.1705350 0.6798799
## temporal_features_96 temporal_features_97 temporal_features_98
## 4 0.35977866 1.1722578 0.33959361
## 5 0.52499587 1.2536623 -0.19692728
## 6 -0.02507327 0.4719127 -0.63572961
## 7 0.86209482 0.4761641 1.32726105
## 8 -0.01304075 0.7974464 0.04012304
## 9 0.80824928 1.1579960 0.46854516
## temporal_features_99 temporal_features_100 temporal_features_101
## 4 1.08094681 0.7962399 0.3842356
## 5 -0.02653752 0.3682848 0.3513957
## 6 -0.13435654 0.8072416 0.1073380
## 7 1.37066495 -0.7979418 0.4370662
## 8 0.50901618 -0.4067289 1.1126856
## 9 0.02253245 -0.3698993 -0.7681432
## temporal_features_102 temporal_features_103 temporal_features_104
## 4 0.5802670 0.2177974528 -0.6563484
## 5 0.4199116 0.2091595022 -0.9166131
## 6 0.8011872 0.0009256021 0.4419833
## 7 0.3531897 -1.1011640519 -0.2407204
## 8 0.1577322 -0.0193276745 0.5747907
## 9 0.1651919 -0.3781327409 0.1914853
## temporal_features_105 temporal_features_106 temporal_features_107
## 4 -0.2506679 1.2413461 0.68205165
## 5 -0.9056602 -0.4097739 0.75533075
## 6 -0.1466718 -0.7083462 -0.18482904
## 7 -1.7551239 1.2128649 -0.03269114
## 8 1.4188836 -0.8615476 -0.38541609
## 9 0.2952956 0.2375374 -0.37421698
## temporal_features_108 temporal_features_109 temporal_features_110
## 4 0.38931831 1.1103174 0.3093887
## 5 0.52447804 1.2807517 -0.2964239
## 6 -0.02999702 0.4962797 -0.7088314
## 7 0.77094971 0.4198638 1.3386205
## 8 0.01978426 0.7051974 -0.2858710
## 9 0.70392628 1.1018495 0.4765202
## temporal_features_111 temporal_features_112 temporal_features_113
## 4 0.80725088 0.7830414 0.4834854
## 5 0.21744303 0.4289949 0.4076987
## 6 -0.14844138 0.8162824 0.2116708
## 7 1.39061841 -0.9028970 0.7906280
## 8 0.28506663 -0.4234809 0.8582557
## 9 0.05613066 -0.3026383 -0.6627792
## temporal_features_114 temporal_features_115 temporal_features_116
## 4 0.6705663 0.2456791 -0.58607569
## 5 0.4031875 0.1482172 -0.90617151
## 6 0.7935505 0.1333512 0.48697438
## 7 0.4188826 -1.1448914 -0.32463982
## 8 0.2417356 -0.1266263 0.61238772
## 9 0.2212431 -0.2076166 0.07857879
## temporal_features_117 temporal_features_118 temporal_features_119
## 4 -0.2986056 1.0508027 0.618361924
## 5 -0.8218909 -0.2912922 0.505951223
## 6 -0.3757386 -0.7369416 -0.274518271
## 7 -1.6599497 1.1891293 0.007134638
## 8 1.4601440 -0.9028917 -0.545093859
## 9 0.2844242 0.2612795 -0.448961982
## temporal_features_120 temporal_features_121 temporal_features_122
## 4 -0.03610495 -0.3571392 -0.003795541
## 5 -0.58126267 -0.4921952 -0.399029308
## 6 -0.41953817 -0.3624613 -0.311241144
## 7 -0.59172173 -0.6421038 -0.874523285
## 8 -0.44208968 0.7129104 2.093031318
## 9 -0.63953730 -0.7035852 -0.627950428
## temporal_features_123 temporal_features_124 temporal_features_125
## 4 0.4640769 -0.05344211 0.2474155
## 5 -0.1565919 0.08787867 -0.3315342
## 6 0.1718360 0.22351187 0.3088881
## 7 -0.6864986 0.03996760 -0.7703813
## 8 0.5875501 1.33751667 0.9794033
## 9 -0.7529840 -0.48919918 -0.6117094
## temporal_features_126 temporal_features_127 temporal_features_128
## 4 0.06856966 0.7077756 0.004942277
## 5 0.16570755 0.5770993 -0.351493786
## 6 0.26387000 1.0559666 -0.014194717
## 7 -0.39525490 -0.5720723 -0.834218247
## 8 0.38904096 1.7189728 1.229735677
## 9 -0.31231176 -0.6456574 -0.685388149
## temporal_features_129 temporal_features_130 temporal_features_131
## 4 0.1150388 0.6042926 -0.2681643
## 5 0.6225198 0.1785604 0.5885707
## 6 1.1052287 0.6137590 -0.1972694
## 7 -0.0758856 -0.6931162 -0.6909507
## 8 1.5737679 0.5535181 0.5807242
## 9 -0.7977362 -0.7351198 -0.5423913
## temporal_features_132 temporal_features_133 temporal_features_134
## 4 -0.73069075 0.72272501 0.3813373
## 5 -0.73069075 1.15107196 -0.3161202
## 6 -0.73069075 0.28698882 -0.3088223
## 7 -0.73069075 -0.26638196 1.1229211
## 8 0.53998230 -0.08033646 -0.3229653
## 9 -0.04188874 1.34768875 -0.8022247
## temporal_features_135 temporal_features_136 temporal_features_137
## 4 0.7901838 0.5904475 0.07295709
## 5 0.5307275 -0.2724542 0.40945255
## 6 0.6022448 0.2105956 -2.25876417
## 7 1.0247216 0.1349094 0.78159955
## 8 0.4459855 -1.4180069 -0.28118195
## 9 -0.5427343 -0.3377099 0.42142203
## temporal_features_138 temporal_features_139 temporal_features_140
## 4 0.17526312 -0.38383294 -0.09370848
## 5 0.08298801 -0.03164328 -0.26195719
## 6 0.25624866 -0.32315601 0.51666427
## 7 -0.52609443 0.33273015 0.90472037
## 8 0.06240355 -0.64526667 -0.27062645
## 9 0.03137484 -0.42107664 0.70240350
## temporal_features_141 temporal_features_142 temporal_features_143
## 4 -0.06837558 0.37063575 -0.2137103
## 5 -2.40549220 0.18891502 0.1084247
## 6 -1.03603797 0.65198927 -0.1784791
## 7 0.11226073 -0.61505736 0.4883162
## 8 -0.77916514 -0.04456775 -0.5347384
## 9 -0.16497171 0.19471869 0.7294001
## temporal_features_144 temporal_features_145 temporal_features_146
## 4 0.4890421 0.59932245 1.06255904
## 5 0.3557876 0.20529847 -0.58910275
## 6 -0.2950779 0.52711346 -0.87750250
## 7 0.5279775 -0.08682346 -0.30243283
## 8 -0.3858577 1.02043823 1.82911266
## 9 0.6229209 0.02161943 0.08357081
## temporal_features_147 temporal_features_148 temporal_features_149
## 4 -0.69461226 0.2307570 -0.6894868
## 5 1.61128135 0.3463870 -0.4651234
## 6 1.14536309 0.1061773 1.3770740
## 7 0.95257880 1.8572615 -0.5734111
## 8 0.02504808 0.5040981 1.0161756
## 9 0.16473449 -0.8251207 0.1257116
## temporal_features_150 temporal_features_151 temporal_features_152
## 4 -0.02776816 0.007709011 -0.0325701
## 5 0.35483877 0.050165437 -0.9926628
## 6 0.01847641 0.766090047 -0.2650573
## 7 0.16587274 -0.648650342 -0.8534508
## 8 0.50002417 0.192568600 1.5241223
## 9 0.10400759 -0.931261749 -0.6207984
## temporal_features_153 temporal_features_154 temporal_features_155
## 4 -0.7459086 0.37127581 -0.02544918
## 5 -0.9214621 0.02217363 1.46388160
## 6 -0.0983142 -0.02504430 0.53910480
## 7 -0.5383799 0.39253025 -1.07771919
## 8 0.5636711 0.63972273 0.59617896
## 9 -0.7890816 -0.66000329 -0.15123392
## temporal_features_156 temporal_features_157 temporal_features_158
## 4 0.9439915 -0.08346134 0.5726422
## 5 0.8697400 -0.70718433 -0.2379578
## 6 0.5070675 0.18846260 -0.4775441
## 7 0.9656869 0.13352517 -1.0983599
## 8 -0.7112383 0.84246428 1.7296798
## 9 0.3855960 -0.99564041 0.6771595
## temporal_features_159 temporal_features_160 temporal_features_161
## 4 -0.9647325 -0.24620395 -0.5565140
## 5 0.8697185 0.46457379 -0.6016401
## 6 0.4880065 -0.06931253 2.4384382
## 7 0.1026554 1.34223899 -0.9155474
## 8 -0.2398491 1.41143226 0.9292502
## 9 0.4344704 -0.39635549 -0.1715288
## temporal_features_162 temporal_features_163 temporal_features_164
## 4 -0.14135854 0.22319446 0.04272243
## 5 0.17423474 0.05080562 -0.43835078
## 6 -0.16796109 0.68488479 -0.51062127
## 7 0.47840357 -0.61349049 -1.13498593
## 8 0.28385061 0.49272514 1.12446122
## 9 0.04611621 -0.36996648 -0.85531662
## temporal_features_165 temporal_features_166 temporal_features_167
## 4 -0.4855421 -0.05735693 0.1182108
## 5 0.7557823 -0.11961756 0.8951111
## 6 0.5358400 -0.46777684 0.4675729
## 7 -0.4448437 0.64085419 -1.0177780
## 8 0.8521677 0.37713483 0.7301259
## 9 -0.4595393 -0.49271383 -0.5601788
## temporal_features_168 temporal_features_169 temporal_features_170
## 4 -0.2463541 -0.32156223 0.8281412
## 5 0.3149920 -0.48657606 0.3589921
## 6 -0.2170018 -0.33102038 0.3685345
## 7 -1.0269527 -0.29563007 -0.4588104
## 8 0.4023372 -0.04471468 1.0087938
## 9 -0.1045318 0.03142344 -0.7762938
## temporal_features_171 temporal_features_172 temporal_features_173
## 4 -0.15418028 -0.2839568 -0.6409316
## 5 0.12394304 -0.6040406 -0.2867425
## 6 0.10434041 -0.6034042 -0.6326790
## 7 0.92900521 2.7402573 -0.6561133
## 8 0.09720291 -0.1274969 -0.1732817
## 9 -0.03969763 -0.9955122 1.0810388
## temporal_features_174 temporal_features_175 temporal_features_176
## 4 -0.55277495 -0.27146480 -0.1145655
## 5 -0.06942847 0.05222576 0.0244779
## 6 -0.34243279 -0.45471502 -0.1152000
## 7 -1.03932055 -0.19414569 0.4550810
## 8 -0.20970338 -0.16928151 0.1692320
## 9 -0.35670212 -1.89917494 1.0117155
## temporal_features_177 temporal_features_178 temporal_features_179
## 4 -0.2634591 0.3509373 -0.1304941
## 5 -0.6866641 0.1589896 1.3711401
## 6 -0.1827684 0.5087030 0.3907658
## 7 -0.3182360 -0.4981810 -0.4001559
## 8 -0.2930034 0.2326198 0.8165223
## 9 -0.6971001 -1.3418698 0.8043567
## temporal_features_180 temporal_features_181 temporal_features_182
## 4 -0.06028758 -0.28825531 -0.04069129
## 5 -0.24893167 -0.48398710 -0.36385185
## 6 -0.06849448 -0.22583083 -0.60525508
## 7 0.61527614 -0.02663709 -0.19296482
## 8 -0.45626854 -0.50641478 -0.58598158
## 9 -0.14087294 -0.37037699 0.53686895
## temporal_features_183 temporal_features_184 temporal_features_185
## 4 -0.60454019 -0.47535728 -0.5206951
## 5 -0.04086809 0.03111695 -0.4337451
## 6 -0.35752087 -0.66715100 -0.2145378
## 7 0.48585653 3.82062573 -0.4208837
## 8 -0.52566031 -0.60575124 -0.3895567
## 9 0.26886590 -0.32698243 0.3815371
## temporal_features_186 temporal_features_187 temporal_features_188
## 4 -0.4723963 -0.5827563 -0.6010214
## 5 -0.4614387 -0.5449211 -0.6210230
## 6 -0.5523504 -0.6479561 -0.7441127
## 7 0.4604009 -0.3942817 -0.3024363
## 8 -0.5698381 -0.7104496 -0.5192810
## 9 -0.4143233 0.2255455 -0.3704264
## temporal_features_189 temporal_features_190 temporal_features_191
## 4 -0.59431865 -0.4691492 0.09084679
## 5 -0.47305113 -0.4894668 -0.03814021
## 6 -0.62821953 -0.5266016 0.19668227
## 7 -0.49353236 0.7681803 -0.39587472
## 8 -0.59143697 -0.4407166 -0.17918526
## 9 0.08658673 0.4634203 -0.39916050
## temporal_features_192 temporal_features_193 temporal_features_194
## 4 0.5525125 0.5543345 0.2050303
## 5 0.5500967 0.5319090 -0.4225631
## 6 0.1008896 0.1332248 -0.1182202
## 7 0.8930979 0.8224755 -0.6203189
## 8 0.1483964 0.1263931 -0.6304617
## 9 0.7458891 0.6605958 -0.8745393
## temporal_features_195 temporal_features_196 temporal_features_197
## 4 -0.8423218 0.6459058 1.0740227
## 5 -0.8423218 0.2131183 0.9052599
## 6 -0.8423218 -0.1270957 0.7725959
## 7 -0.8423218 0.3908037 0.9745472
## 8 1.0012824 -0.1511135 -1.0362365
## 9 -0.1445655 0.6424081 0.3916069
## temporal_features_198 temporal_features_199 temporal_features_200
## 4 -0.04843733 -0.14474253 -0.3449314
## 5 0.33878579 -0.27251944 -0.2149180
## 6 -0.01028293 -0.21295985 -0.2028951
## 7 -1.34182460 0.81667294 -0.3320061
## 8 0.39621938 -0.42145944 -0.1913867
## 9 -0.02339831 0.08848781 -0.2993320
## temporal_features_201 temporal_features_202 temporal_features_203
## 4 -0.471958861 -0.09472464 -1.4761224
## 5 -0.152652657 -0.09384910 -1.4761224
## 6 -0.137329563 -0.09303741 -1.4761224
## 7 -0.358162260 -0.09129330 -1.4761224
## 8 -0.008435207 -0.09344440 0.9742709
## 9 -0.310390395 -0.09235209 -0.2679581
## temporal_features_204 temporal_features_205 temporal_features_206
## 4 -0.4503543 -0.4476321 -0.8747477
## 5 -0.3935243 -0.3907930 -0.7231862
## 6 -0.4126668 -0.4099386 -0.8238355
## 7 -0.1544083 -0.1516385 1.1546762
## 8 -0.3588932 -0.3607955 -0.6112399
## 9 -0.2955677 -0.2951080 -0.2002845
## temporal_features_207 temporal_features_208 temporal_features_209
## 4 -0.4213261 0.1736195 0.19078416
## 5 -0.3818996 0.3880805 0.24602424
## 6 -0.4068985 -0.1837235 -0.31371684
## 7 0.5155844 0.8773941 0.73932792
## 8 -0.3530866 -0.1591351 -0.07508961
## 9 -0.2280742 0.9148253 0.81397657
## temporal_features_210 temporal_features_211 temporal_features_212
## 4 -0.14771927 -0.2177152 0.2828163
## 5 -0.83048714 -0.2177152 0.2852048
## 6 -0.61871724 -0.2177152 -0.2926030
## 7 -0.73448188 -0.2177152 0.4153758
## 8 -0.04928994 -0.2177152 -0.4012779
## 9 -0.54095906 -0.2177152 0.5001660
## temporal_features_213 temporal_features_214 temporal_features_215
## 4 0.3553598 0.03454314 -0.21485796
## 5 0.3575294 0.25929566 -0.11145223
## 6 -0.1672697 -0.12775894 0.01945671
## 7 0.4757582 -0.88135180 0.51480023
## 8 -0.2659741 0.33036345 -0.43566784
## 9 0.5527701 -0.56101842 0.06335062
## temporal_features_216 temporal_features_217 temporal_features_218
## 4 -0.5935005 -0.83598833 -0.10914002
## 5 -0.4549874 -0.54683980 -0.08143559
## 6 -0.4639460 -0.37231900 -0.09235326
## 7 -0.3192336 -0.07053158 -0.05865267
## 8 -0.5846825 -0.76717048 -0.04651136
## 9 -0.3876901 -0.01244376 -0.11027716
## temporal_features_219 temporal_features_220 temporal_features_221
## 4 -0.4801640 -0.1473874 -0.1465424
## 5 -0.4751876 0.2971926 0.2981696
## 6 -0.8722985 0.2683129 0.2700183
## 7 1.1859095 0.7279925 0.7260212
## 8 -0.4483154 1.2552217 1.2564533
## 9 -0.4841453 -0.3765822 -0.3758027
## temporal_features_222 temporal_features_223
## 4 1.1883420 0.8275405
## 5 1.8093965 1.1635787
## 6 1.6873453 1.3307878
## 7 2.6684968 2.0100803
## 8 3.6189182 3.4461576
## 9 -0.5543839 -0.3796163
Before we start withe dimension reduction methods, we need to load the required packages and libraries required to do so:
install.packages("ade4", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'ade4' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'ade4'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying C:
## \Users\PC-CATHERINE\Documents\R\win-library\3.6\00LOCK\ade4\libs\x64\ade4.dll
## to C:\Users\PC-CATHERINE\Documents\R\win-library\3.6\ade4\libs\x64\ade4.dll:
## Permission denied
## Warning: restored 'ade4'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("FactoMineR", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'FactoMineR' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("smacof", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
##
## There is a binary version available but the source version is later:
## binary source needs_compilation
## smacof 2.0-0 2.1-0 TRUE
##
## Binaries will be installed
## package 'smacof' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'smacof'
## Warning in file.copy(savedcopy, lib, recursive = TRUE):
## problem copying C:\Users\PC-CATHERINE\Documents\R\win-
## library\3.6\00LOCK\smacof\libs\x64\smacof.dll to C:\Users\PC-
## CATHERINE\Documents\R\win-library\3.6\smacof\libs\x64\smacof.dll: Permission
## denied
## Warning: restored 'smacof'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("labdsv", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'labdsv' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'labdsv'
## Warning in file.copy(savedcopy, lib, recursive = TRUE):
## problem copying C:\Users\PC-CATHERINE\Documents\R\win-
## library\3.6\00LOCK\labdsv\libs\x64\labdsv.dll to C:\Users\PC-
## CATHERINE\Documents\R\win-library\3.6\labdsv\libs\x64\labdsv.dll: Permission
## denied
## Warning: restored 'labdsv'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("missMDA", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'missMDA' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("devtools", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'devtools' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("knitr", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'knitr' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("rgl", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'rgl' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'rgl'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying C:
## \Users\PC-CATHERINE\Documents\R\win-library\3.6\00LOCK\rgl\libs\x64\rgl.dll
## to C:\Users\PC-CATHERINE\Documents\R\win-library\3.6\rgl\libs\x64\rgl.dll:
## Permission denied
## Warning: restored 'rgl'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("htmlTable", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'htmlTable' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("ClusterR", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'ClusterR' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'ClusterR'
## Warning in file.copy(savedcopy, lib, recursive = TRUE):
## problem copying C:\Users\PC-CATHERINE\Documents\R\win-
## library\3.6\00LOCK\ClusterR\libs\x64\ClusterR.dll to C:\Users\PC-
## CATHERINE\Documents\R\win-library\3.6\ClusterR\libs\x64\ClusterR.dll: Permission
## denied
## Warning: restored 'ClusterR'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
#install.packages("ggbiplot", repos = "http://cran.us.r-project.org")
install.packages("factoextra", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'factoextra' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("psych", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'psych' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("maptools", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'maptools' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'maptools'
## Warning in file.copy(savedcopy, lib, recursive = TRUE):
## problem copying C:\Users\PC-CATHERINE\Documents\R\win-
## library\3.6\00LOCK\maptools\libs\x64\maptools.dll to C:\Users\PC-
## CATHERINE\Documents\R\win-library\3.6\maptools\libs\x64\maptools.dll: Permission
## denied
## Warning: restored 'maptools'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
install.packages("Rtsne", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/PC-CATHERINE/Documents/R/win-library/3.6'
## (as 'lib' is unspecified)
## package 'Rtsne' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'Rtsne'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying C:
## \Users\PC-CATHERINE\Documents\R\win-library\3.6\00LOCK\Rtsne\libs\x64\Rtsne.dll
## to C:\Users\PC-CATHERINE\Documents\R\win-library\3.6\Rtsne\libs\x64\Rtsne.dll:
## Permission denied
## Warning: restored 'Rtsne'
##
## The downloaded binary packages are in
## C:\Users\PC-CATHERINE\AppData\Local\Temp\RtmpUzXceH\downloaded_packages
library(rgl)
## Warning: package 'rgl' was built under R version 3.6.3
library(htmlTable)
## Warning: package 'htmlTable' was built under R version 3.6.3
library(knitr)
## Warning: package 'knitr' was built under R version 3.6.3
library(devtools)
## Warning: package 'devtools' was built under R version 3.6.3
## Loading required package: usethis
## Warning: package 'usethis' was built under R version 3.6.2
install_github("vqv/ggbiplot")
## WARNING: Rtools is required to build R packages, but is not currently installed.
##
## Please download and install Rtools custom from http://cran.r-project.org/bin/windows/Rtools/.
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (7325e880) has not changed since last install.
## Use `force = TRUE` to force installation
library(ggbiplot)
## Loading required package: ggplot2
## Loading required package: plyr
## Loading required package: scales
## Loading required package: grid
library(missMDA)
## Warning: package 'missMDA' was built under R version 3.6.3
library(FactoMineR)
## Warning: package 'FactoMineR' was built under R version 3.6.3
library(ade4)
## Warning: package 'ade4' was built under R version 3.6.3
##
## Attaching package: 'ade4'
## The following object is masked from 'package:FactoMineR':
##
## reconst
library(labdsv)
## Warning: package 'labdsv' was built under R version 3.6.3
## Loading required package: mgcv
## Loading required package: nlme
## This is mgcv 1.8-28. For overview type 'help("mgcv-package")'.
## Registered S3 method overwritten by 'labdsv':
## method from
## summary.dist ade4
## This is labdsv 2.0-1
## convert existing ordinations with as.dsvord()
##
## Attaching package: 'labdsv'
## The following object is masked from 'package:stats':
##
## density
library(smacof)
## Warning: package 'smacof' was built under R version 3.6.3
## Loading required package: plotrix
##
## Attaching package: 'plotrix'
## The following object is masked from 'package:scales':
##
## rescale
## The following object is masked from 'package:rgl':
##
## mtext3d
## Registered S3 methods overwritten by 'car':
## method from
## influence.merMod lme4
## cooks.distance.influence.merMod lme4
## dfbeta.influence.merMod lme4
## dfbetas.influence.merMod lme4
##
## Attaching package: 'smacof'
## The following object is masked from 'package:base':
##
## transform
library(ggplot2)
library(ClusterR)
## Warning: package 'ClusterR' was built under R version 3.6.3
## Loading required package: gtools
##
## Attaching package: 'gtools'
## The following object is masked from 'package:mgcv':
##
## scat
library(psych)
## Warning: package 'psych' was built under R version 3.6.3
##
## Attaching package: 'psych'
## The following object is masked from 'package:gtools':
##
## logit
## The following object is masked from 'package:smacof':
##
## Procrustes
## The following object is masked from 'package:plotrix':
##
## rescale
## The following object is masked from 'package:labdsv':
##
## pca
## The following objects are masked from 'package:scales':
##
## alpha, rescale
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(Rtsne)
## Warning: package 'Rtsne' was built under R version 3.6.2
library(factoextra)
## Warning: package 'factoextra' was built under R version 3.6.3
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(maptools)
## Loading required package: sp
## Checking rgeos availability: FALSE
## Note: when rgeos is not available, polygon geometry computations in maptools depend on gpclib,
## which has a restricted licence. It is disabled by default;
## to enable gpclib, type gpclibPermit()
Now that we have the required packages lets move on to the different methods of input dimension reduction techniques.
Multidimensional Scaling is a method of dimension reduction which maps the relative position of the datapoints with a given dissimilarity matrix.
d<-dist(echonest[,2:19])
mds1<-mds(d, ndim=2)
mds1
##
## Call:
## mds(delta = d, ndim = 2)
##
## Model: Symmetric SMACOF
## Number of objects: 2000
## Stress-1 value: 0.259
## Number of iterations: 106
plot(mds1)
From the plot we can see that there are some outliers, but most of the data seems to be concentrated in one place. The Stress-1 coefficient using ordinal MDS, Kruskal (1964a), on the basis of his “experience with experimental and synthetic data” (p. 16), suggests the following benchmarks: .20 = poor, .10 = fair, .05 = good, .025 = excellent, and .00 = perfect. Hence, the goodness of fit measure indicates that mds fitting is poor in this case. To get how “close” (or similar) are the different variables, we can perform mds on the transposed table:
d1<-dist(t(echonest[,2:19]))
mds2<-mds(d1, ndim=2)
mds2
##
## Call:
## mds(delta = d1, ndim = 2)
##
## Model: Symmetric SMACOF
## Number of objects: 18
## Stress-1 value: 0.253
## Number of iterations: 115
plot(mds2)
How good is the fit? Not very good , as is eveident from the Stress-1 value.
In case of PCA, the pincipal components are determined such that maximum variability of the data is covered. In R we have the prcomp and princomp functions for determining the principal components. But these functions aren’t that efficient when we have missing values as they just have a provision of omitting missing values. So lets check if our data has missing values:
sum(is.na(echonest))
## [1] 8473
But, we can imput the missing values and perform pca using prcomp in the following way:
echonest_imputed<- imputePCA(echonest[,2:19])
pca_impute<-prcomp(echonest_imputed$completeObs)
summary(pca_impute)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 2.0194 1.3685 1.2295 1.19362 1.07667 1.00114 0.9389
## Proportion of Variance 0.2812 0.1292 0.1043 0.09825 0.07995 0.06912 0.0608
## Cumulative Proportion 0.2812 0.4104 0.5147 0.61291 0.69286 0.76198 0.8228
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.85851 0.7413 0.6198 0.56142 0.45461 0.43035 0.28921
## Proportion of Variance 0.05083 0.0379 0.0265 0.02174 0.01425 0.01277 0.00577
## Cumulative Proportion 0.87361 0.9115 0.9380 0.95974 0.97399 0.98677 0.99253
## PC15 PC16 PC17 PC18
## Standard deviation 0.21491 0.20619 0.13292 0.04343
## Proportion of Variance 0.00319 0.00293 0.00122 0.00013
## Cumulative Proportion 0.99572 0.99865 0.99987 1.00000
We can see that we need atleast 9 principal components to cover atleast 90% of the variation in the data. But for now, we are going to take the cutoff point for the varition as 75% and thus will use 6 principal components.
pca_plot<-data.frame(pca_x=pca_impute$x[,1],pca_y=pca_impute$x[,2],label=echonest_1$metadata_artist_name[1:2000], label2=echonest_1$metadata_artist_location[1:2000])
ggplot(pca_plot, aes(x = pca_x, y = pca_y, color = label)) +
ggtitle("PCA of Echonest sample") +
geom_text(aes(label = label)) +
theme(legend.position = "none")
ggplot(pca_plot, aes(x = pca_x, y = pca_y, color = label2)) +
ggtitle("PCA of Echonest sample") +
geom_text(aes(label = label2)) +
theme(legend.position = "none")
fviz_pca_var(pca_impute, repel=TRUE)
fviz_eig(pca_impute)
As we can see from the output, the first two principal values cover very less variation in the data. Futheremore, from the variable plot we can deduce that the energy and dancebility of a song are completely in the opposite directions, implying that they are almost perfectly negatively correlated (weird, right?). Similarily, we see that all the rank varibles are all the hotness rank features of a song are negatively correlated with the social features of the artists. Audio spechiness is positively correlated with the dancebility. How good is the quality of this dimension reduction?
pca1<-principal(echonest[,2:19], nfactors=6, rotate="varimax")
## Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
pca1$uniquenesses
## audio_features_acousticness audio_features_danceability
## 0.27088953 0.21398707
## audio_features_energy audio_features_instrumentalness
## 0.31889873 0.42563490
## audio_features_liveness audio_features_speechiness
## 0.39166434 0.32554162
## audio_features_tempo audio_features_valence
## 0.51292417 0.14591210
## ranks_artist_discovery_rank ranks_artist_familiarity_rank
## 0.09437458 0.22878742
## ranks_artist_hotttnesss_rank ranks_song_currency_rank
## 0.11352551 0.15393671
## ranks_song_hotttnesss_rank social_features_artist_discovery
## 0.23772804 0.02860332
## social_features_artist_familiarity social_features_artist_hotttnesss
## 0.20038473 0.12905907
## social_features_song_currency social_features_song_hotttnesss
## 0.41360144 0.10472673
pca1$complexity
## audio_features_acousticness audio_features_danceability
## 1.109748 1.530017
## audio_features_energy audio_features_instrumentalness
## 1.775989 1.141084
## audio_features_liveness audio_features_speechiness
## 1.230047 1.069704
## audio_features_tempo audio_features_valence
## 1.745055 1.187461
## ranks_artist_discovery_rank ranks_artist_familiarity_rank
## 1.040580 1.140429
## ranks_artist_hotttnesss_rank ranks_song_currency_rank
## 1.028283 1.090428
## ranks_song_hotttnesss_rank social_features_artist_discovery
## 1.435711 1.056574
## social_features_artist_familiarity social_features_artist_hotttnesss
## 1.468129 1.288929
## social_features_song_currency social_features_song_hotttnesss
## 1.037590 1.240461
As we can see from the results, both the complexity and uniqueness are higher than is desired.
t-Distributed Stochastic Neighbor Embedding (t-SNE) is a method of dimensionaluty reduction which computes the difference between the probability of similar points in the original space and in lower dimension via K-L divergence metric. It differes from Pca mainly by the fact that it keeps the low dimensional similar points together, whereas PCA keeps the away to maximise variance covered in the data. It basically performs PCA to get a lower dimension data, then it derives a probability distribution on the original high-dimensional data, such that the points which are similar to each other have a higher probability of getting picked. Then using these two, it defines a probability distribution of similarity between the low dimension points of PCA and the high dimensional data points. Lastly, it minimises the dissimilarity or K-L divergence between these two probability distributions.
tsne<-Rtsne(echonest_imputed$completeObs)
plot(tsne$itercosts)# We need to set the max_iter to that value after which thereis a big fall in the cost
tsne<-Rtsne(echonest_imputed$completeObs, max_iter = 250, perplexity = 300)
tsne_plot <- data.frame(tsne_x = tsne$Y[,1], tsne_y = tsne$Y[,2], label = as.factor(echonest_1$metadata_artist_location[1:2000]))
ggplot(tsne_plot, aes(x = tsne_x, y = tsne_y, color = label)) +
ggtitle("t-SNE for Location") + geom_text(aes(label = label)) +
theme(legend.position="none")
tsne_plot1 <- data.frame(tsne_x = tsne$Y[,1], tsne_y = tsne$Y[,2], label = as.factor(echonest_1$metadata_artist_name[1:2000]))
ggplot(tsne_plot1, aes(x = tsne_x, y = tsne_y, color = label)) +
ggtitle("t-SNE for Artists") + geom_text(aes(label = label)) +
theme(legend.position="none")
The output is a little more comprehendable and distinguishable as compared to pca and mds, but, it doesn’t give us any information amoung the correlations of different variables.
The correct input reduction method depends on the type of data one has and what we intend to derve from it. That being said, since t-SNE is a metric method, its is more accurate and easy to interpret as compared to PCA and MDS. Furthermore, it can also be used for classification between the different groups by calculating the centroids of the embedded data obtained and then classifying the points into groups based on the their distance from these centroids. But, sometimes PCA or MDS might be better than t-SNE especially if the number of dimensions is not as large and the when one is interested in the relation amoungst these variables. In such a case, t-SNE will overcomplicate the matters as you will have to find the optimum number of iteration and then also perplexity via trial and error when a vey good reslt could be oobtained by employing PCA or MDS. Thus, the optimum method for dimensionality reduction depends on the purpose of the analysis and the structure of the dataset.