@@ -0,0 +1,2283 @@
+import os%0Afrom scipy.io import loadmat%0Afrom numpy import array, vstack, reshape, delete%0A %0A%0Afrom sklearn.metrics import precision_recall_fscore_support%0Afrom sklearn.ensemble import AdaBoostClassifier%0A%0Afrom sklearn import preprocessing%0Afrom sklearn.feature_selection import VarianceThreshold%0A%0Afrom sklearn.svm import SVC%0A%0A%0A%0Adef normalize_data(x):%0A    scaler = preprocessing.StandardScaler().fit(x)%0A    return scaler %0A%0A%0Adef adaboost(D):%0A      %0A             %0A    feature = D%5B'feature_vector'%5D%0A    target = D%5B'target'%5D%0A%0A%0A%0A%0A    print feature.shape%0A    #print feature%5B50%5D%0A%0A%0A    um_targets = vstack((((target%5B:,i%5D)%5B0%5D) for i in range(95))) #%5B0:385%5D%0A%0A    print um_targets.shape%0A%0A%0A%0A%0A    #print %22####################################################%22%0A    #print ((target%5B:,0%5D)%5B0%5D)%5B0:385%5D.shape      %0A                %0A%0A    train_size = int (0.6 * len(feature))%0A    validation_size = int (0.1 * len(feature))%0A%0A    train_d = feature%5B0:train_size%5D%0A    validation_d = feature%5Btrain_size:(train_size+validation_size)%5D%0A    test_d = feature%5B(train_size+validation_size):%5D%0A%0A    train_t = um_targets%5B0:train_size%5D%0A    validation_t = um_targets%5Btrain_size:(train_size+validation_size)%5D%0A    test_t = um_targets%5B(train_size+validation_size):%5D%0A%0A%0A    #print train_t.shape%0A    #print train_d.shape%0A    #print train_d%5B50%5D%0A%0A    #print validation_t%5B:,0%5D.shape%0A%0A    scaler = normalize_data(train_d)%0A    #scale the training data so that each feature has zero mean and unit variance%0A    scaled_tr_data = scaler.transform(train_d)%0A    %0A    #print (scaled_tr_data)%0A    %0A    scaled_validn_data = scaler.transform(validation_d)%0A    %0A    %0A    #scale the test data in a similar fashion%0A    scaled_test_data = scaler.transform(test_d)%0A%0A%0A%0A%0A    clf = AdaBoostClassifier(n_estimators=1000)%0A    clf.fit(scaled_tr_data, train_t%5B:,0%5D)%0A %0A    pred = clf.predict(scaled_test_data)  %0A%0A    print(%22Number of mislabeled points out of a total %25d  points : %25d%22 %25 (test_d.shape%5B0%5D, (test_t%5B:,0%5D != pred).sum()))%0A    print precision_recall_fscore_support(test_t%5B:,0%5D, pred)%0A    %0A    %0A    %0AUM = loadmat(%22C:%5CUsers%5CJoms%5CDesktop%5Cum%5Cum_all_data.mat%22) %0AUMM = loadmat(%22C:%5CUsers%5CJoms%5CDesktop%5Cumm%5Cumm_all_data.mat%22) %0AUU = loadmat(%22C:%5CUsers%5CJoms%5CDesktop%5Cuu%5Cuu_all_data.mat%22) %0A%0Aprint %22UM%22%0Aadaboost(UM)%0Aprint %22UMM%22%0Aadaboost(UMM)%0Aprint %22UU%22%0Aadaboost(UU)%0A

Create ada_boost_all_features.py