train_x,train_y,test_x,test_y = train_test_split(x_all_2,y_all,1) print(y_all) #print(train_x) print(train_y) #print(test_x) #print(test_y) #print(x_all) #print(y_all) #referenceのカラーコード #カラーコードのタグの数width=4,length=4の場合16個のタグに対応 width = 3 length = 4 #colorcode(test_y,width,length) #SVM best_pred=svm(train_x,train_y,test_x,test_y) #print(best_pred) #print('a') #colorcode(best_pred,width,length) #k近傍法 #best_pred=kNN(train_x,train_y,test_x,test_y) #colorcode(best_pred,width,length) # PCA-SVM #transformed, targets = pCA(x_all_2, y_all) #train_x_pca,train_y_pca,test_x_pca,test_y_pca = train_test_split(transformed,targets,1) #best_pred = svm(train_x_pca, train_y_pca, test_x_pca, test_y_pca) #colorcode(best_pred, width, length)
y_all.append(i) except FileNotFoundError as e: print(e) #train_test_split(特徴量,目的関数,1つの厚さにおけるtrainデータの数) train_x, train_y, test_x, test_y = train_test_split(x_all, y_all, 1) #print(train_x) #print(train_y) #print(test_x) #print(test_y) #print(x_all) #print(y_all) #referenceのカラーコード #カラーコードのタグの数width=4,length=4の場合16個のタグに対応 width = 4 length = 4 colorcode(test_y, width, length) #SVM best_pred = svm(train_x, train_y, test_x, test_y) colorcode(best_pred, width, length) #k近傍法 best_pred = kNN(train_x, train_y, test_x, test_y) colorcode(best_pred, width, length) # PCA-SVM transformed, targets = pCA(x_all, y_all) train_x_pca, train_y_pca, test_x_pca, test_y_pca = train_test_split( transformed, targets, 1) best_pred = svm(train_x_pca, train_y_pca, test_x_pca, test_y_pca) colorcode(best_pred, width, length)
else: X_all = np.append(X_all, x_all, axis=1) l = l + 1 #print(y_list) y_all = np.array(y_list) #print(X_all.T) #print(y_all.shape) X_train, X_test, y_train, y_test = train_test_split(X_all.T, y_all, test_size=0.2) #print(X_test) print(y_test) print('\nSVM') best_pred = svm(X_train, y_train, X_test, y_test) print('\nK近傍法') best_pred = kNN(X_train, y_train, X_test, y_test) print('\nPCA') A, B = pCA(X_all.T, y_all) print('\nICA') C, D = iCA(X_all.T, y_all) #以下測定データのラベル付け ''' for w in sample_list: os.chdir('/Users/toshinari/Downloads/SVM_file/ALL_RESULT/ALL_file/Trans/{}'.format(w)) file_list = sorted(glob.glob('/Users/toshinari/Downloads/OneDrive_1_2019-6-27/20190624/*.txt'))