         
         drumKits = loadDrumKits()
         selectedDrumKit = loadSelectedKit()
-        
         
         
         doMachineLearning()

    func finishRecording() {
        audioRecorder.stop()
        audioRecorder = nil
        
    }
    
    
    
    func doMachineLearning() {

        let features = [[0.1927402, -1.339814, 0.981847], [0.18788, -1.185445, 0.9608067], [0.1884118, -0.9225742, 0.9288566], [0.1769582, -0.7990825, 0.9208634], [0.1597085, -0.5818297, 0.904695], [0.138394, -0.3453415, 0.8832368], [0.1540525, -0.03293601, 0.8299391], [0.1380265, 0.1225157, 0.7824301], [0.1212493, 0.1880005, 0.7073172], [0.07856233, 0.2888171, 0.5198279], [0.06129582, 0.1483526, 0.3766977], [0.04004546, -0.1281626, 0.2542105], [0.04248419, -0.3668215, 0.1509939], [0.09671733, -0.8740592, 0.04116748], [0.1102066, -1.062368, -0.03823522], [0.1215336, -1.190509, -0.1297533], [0.1531063, -1.441042, -0.3309127], [0.105246, -1.141169, -0.4963723], [0.07315483, -0.7749969, -0.6794466], [0.07189995, -0.5787749, -1.005536], [0.006723443, -0.2499431, -1.236057], [-0.01357356, -0.06456665, -1.499733], [-0.01651181, -0.03249007, -1.860241], [0.01665248, -0.110363, -2.070905], [0.0722711, -0.2779844, -2.239714], [0.1224859, -0.3913474, -2.468451], [0.1918129, -0.6718974, -2.578656], [0.2026244, -0.8139902, -2.617898], [0.1911971, -1.06207, -2.570316], [0.1483843, -1.38927, -2.580324], [0.1353973, -1.40995, -2.665221], [0.09504738, -1.045501, -2.829573], [0.05672505, -0.699186, -2.997013], [-0.1125112, -0.3683408, 3.033122], [-0.2301443, -0.2385775, 2.846699], [-0.3277235, -0.3042794, 2.68387], [-0.39914, -0.5151742, 2.517151], [-0.1983801, -0.6985071, 2.468911], [0.09949835, -0.6687629, 2.407811], [0.2808053, -0.7113474, 2.371014], [0.1237236, -0.990518, 2.396025], [-0.1076306, -1.20572, 2.364202], [-0.1587171, -1.34859, 2.11041], [-0.156957, -1.453754, 1.906205], [0.1914793, -1.262137, 1.172782], [-0.02272421, -0.9065078, 1.127827], [-0.2000724, -0.6073343, 1.027924], [-0.2806979, -0.4418713, 0.9359039], [-0.08922306, -0.3099584, 0.8183712], [0.5419424, -0.4140735, 0.5314031], [0.5345545, -0.4220795, 0.3650727], [0.03558247, -0.1694661, 0.1496811], [-0.1060268, -0.1621651, -0.02209347], [0.4207807, -0.6730987, -0.1320524], [0.4611191, -1.028128, -0.1162849], [0.2240665, -1.432058, -0.2311109], [0.02728697, -1.131254, -0.4722672], [-0.116647, -0.634939, -0.9111575], [-0.01413543, -0.4439882, -1.296562], [0.5542433, -0.4734539, -1.490078], [0.7616539, -0.5410151, -1.653819], [1.404978, -1.178373, -0.6149796], [1.381895, -1.300232, -0.4455243], [1.372498, -1.301717, -0.2677779], [1.125372, -1.189484, 0.01762925], [1.198763, -1.20801, 0.255857], [1.46119, -0.5166294, -0.1644316], [1.36501, 1.224392, -1.677488], [1.439365, 1.279247, -1.572474], [1.550372, -1.373339, 1.283154], [1.467212, 2.106068, -1.681404], [1.407459, 1.778214, -1.135498], [1.309862, 1.403925, -0.300022], [1.197842, 1.47639, -0.1419999], [1.077028, 1.499111, -0.03299962], [1.095586, 1.450426, 0.11944], [1.138691, 1.624224, 0.08563247], [1.050297, 1.653198, 0.2234399], [1.080667, 1.7848, 0.4248549], [1.192828, 1.587763, 0.9675721], [1.306671, 1.693463, 1.10665], [1.085035, 1.626109, 1.530218], [1.11876, 1.552732, 2.07926], [1.211005, 1.4219, 2.562093], [1.071569, 1.286677, -2.749404], [1.080395, 1.403968, -3.118405], [1.058726, 1.380938, 2.939113], [0.9392068, 1.184426, 2.643138], [0.9376488, 1.187226, 2.321812], [0.9363671, 1.161864, 2.059076], [0.8776446, 1.123757, 1.909874], [0.1810643, -1.909219, 1.341364], [0.1682665, -1.992195, 1.35691], [0.168599, -2.377717, 1.495739], [0.140637, -2.681167, 1.605482], [0.04932081, -2.928097, 1.699347], [-0.02859037, 3.106978, 1.751549], [-0.01782523, 3.00619, 1.761297], [-0.0818858, 2.977801, 1.714764], [-0.08767375, 3.019909, 1.580652], [0.04804909, -2.52772, 1.264163], [0.01270829, -2.203327, 0.9711349], [0.02455354, -2.478341, 0.9453428], [0.01406946, -3.01323, 0.5700706], [-0.01876578, 3.056983, 0.3189988], [-0.04508765, 2.941452, 0.2116951], [-0.0053991, 2.884994, 0.2104963], [0.1354906, -2.988266, 0.0633329], [0.1908389, -2.460403, -0.2157429], [0.1573762, -2.724146, -0.1744662], [0.1253558, 3.061389, -0.2231422], [0.09462123, 2.922869, -0.4151103], [0.0818233, 2.877344, -0.592719], [-0.02584108, 2.888501, -0.8503299], [0.02733511, -3.032893, -0.9704501], [0.009602111, -2.84195, -1.133175], [0.1270769, -2.68847, -1.226824], [0.2151543, -2.698557, -1.332647], [0.1100627, 3.122592, -1.259956], [-0.009076158, 2.894295, -1.406677], [-0.07716483, 3.048921, -1.76989], [-0.1478451, -2.922085, -1.955391], [-0.279035, -2.756634, -2.079859], [-0.007135186, -2.307527, -2.145653], [0.0302104, -2.924815, -2.015891], [0.00541537, 3.127649, -2.101214], [0.002364528, 3.059313, -2.219052], [0.003372238, -2.127389, 0.9693691], [0.00410833, -2.136684, 0.9498239], [0.05710578, -2.682447, 1.288984], [0.1142594, 2.963413, 1.668246], [0.1631033, -2.93154, 1.625615], [0.1078025, -2.286122, 1.600311], [0.08180065, -2.03161, 1.816123], [0.1331122, -2.165155, 1.954497], [0.2110729, -2.893556, 2.493919], [0.1906222, 3.119341, 2.774938], [0.1780859, 2.962929, 2.964387], [0.1667672, 3.045388, 3.007974], [0.2209198, -2.381813, 2.891637], [0.1971088, -2.291154, 2.960315], [0.109746, -2.882393, -2.986551], [0.08910755, 3.064147, -2.792862], [0.08457949, 2.870851, -2.545081], [0.1535108, -3.121764, -2.430076], [0.2036753, -2.722708, -2.390161], [0.2755493, -2.746492, -2.284417], [0.1326298, 2.824984, -2.040125], [0.07773166, 2.69804, -2.002038], [0.04669991, 2.668584, -1.976953], [0.1193729, -3.049845, -2.055267], [0.111872, -2.555286, -1.986207], [0.06913193, -2.651505, -1.81503], [0.009420991, -3.140521, -1.470016], [0.00395479, 3.04768, -1.445653], [-0.02539535, 2.912136, -2.720463], [-0.1145805, 2.783067, -1.942888], [-0.1375385, 2.790631, -1.761428], [-0.1223519, 2.751905, -1.66185], [-0.02378772, 2.665194, -1.416652], [-0.07243676, 2.683587, -1.655757], [-0.1250206, 2.586203, -2.017153], [-0.05649001, 2.355631, -2.570474], [-0.001115984, 2.376464, -2.979451], [0.1386702, 2.447958, 2.616911], [0.1916338, 2.497378, 1.820473], [0.190697, 2.484938, 1.197834], [0.1838902, 2.56518, 0.7437924], [0.1092188, 2.725, -0.344139], [0.02433744, 2.526279, -0.8657679], [-0.042839, 2.500779, -1.213091], [-0.1445416, 2.403799, -1.616014], [-0.1009751, 2.334628, -2.104885]]
        
        let labels = ["Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 1", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 2", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3", "Gesture 3"]

        //relabel labels
        var intLabels:[Int] = []
