target_names = ['class-0', 'class-1'] path = os.getcwd() result_path_neurochaos = path + '/NEUROCHAOS-RESULTS/' + classification_type + '/' + folder_name + '-neurochaos/' # Creating Folder to save the results try: os.makedirs(result_path_neurochaos) except OSError: print("Creation of the result directory %s failed" % result_path_neurochaos) else: print("Successfully created the result directory %s" % result_path_neurochaos) full_artificial_data, full_artificial_label, full_artificial_test_data, full_artificial_test_label = get_data( classification_type) num_classes = len(np.unique(full_artificial_label)) # Number of classes print("**** Genome data details ******") for class_label in range(np.max(full_artificial_label) + 1): print("Total Data instance in Class -", class_label, " = ", full_artificial_label.tolist().count([class_label])) print(" train data = ", (full_artificial_data.shape[0])) print("val data = ", (full_artificial_test_data.shape[0])) print("initial neural activity = ", initial_neural_activity, "discrimination threshold = ", discrimination_threshold, "epsilon = ", epsilon)
folder_name = "svm_occd-train_ccd-test" target_names = ['class-0', 'class-1'] path = os.getcwd() result_path_svm_rbf = path + '/NEUROCHAOS-RESULTS/' + folder_name + '/' # Creating Folder to save the results try: os.makedirs(result_path_svm_rbf) except OSError: print("Creation of the result directory %s failed" % result_path_svm_rbf) else: print("Successfully created the result directory %s" % result_path_svm_rbf) ## TEST DATA ccd_train_data, ccd_train_label, ccd_test_data, ccd_test_label = get_data( classification_type_test) ## TRAIN DATA occd_train_data, occd_train_label, occd_test_data, occd_test_label = get_data( classification_type_train) num_classes = len(np.unique(ccd_train_label)) # Number of classes print("**** Sythetic data data details ******") for class_label in range(np.max(ccd_train_label) + 1): print("Total Data instance in Class -", class_label, " = ", ccd_train_label.tolist().count([class_label])) print(" OCCD train data = ", (occd_train_data.shape[0])) print("CCD validation data = ", (ccd_train_data.shape[0])) # Start of svm_rbf classifier
@author: harik """ import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.metrics import confusion_matrix as cm import os from sklearn.metrics import (precision_score, recall_score, f1_score, accuracy_score, mean_squared_error, mean_absolute_error) from sklearn.svm import LinearSVC from load_data_synthetic import get_data import ChaosFEX.feature_extractor as CFX DATA_NAME = "concentric_circle_noise" TRAINDATA, TRAINLABEL, X_TEST, Y_TEST = get_data(DATA_NAME) INITIAL_NEURAL_ACTIVITY = [0.22] DISCRIMINATION_THRESHOLD = [0.96] EPSILON = np.arange(0.01, 0.201, 0.001) ACCURACY = np.zeros((len(DISCRIMINATION_THRESHOLD), len(INITIAL_NEURAL_ACTIVITY), len(EPSILON))) FSCORE = np.zeros((len(DISCRIMINATION_THRESHOLD), len(INITIAL_NEURAL_ACTIVITY), len(EPSILON))) Q = np.zeros((len(DISCRIMINATION_THRESHOLD), len(INITIAL_NEURAL_ACTIVITY), len(EPSILON))) B = np.zeros((len(DISCRIMINATION_THRESHOLD), len(INITIAL_NEURAL_ACTIVITY), len(EPSILON))) EPS = np.zeros((len(DISCRIMINATION_THRESHOLD), len(INITIAL_NEURAL_ACTIVITY), len(EPSILON)))