def main(): dataset = 'koelstra-approach' class_id = 0 ground_truth_variable_count = 3 attr_count = attribute_counts[dataset][class_id] # attr_count = None # Load our dataset into memory Xs, ys = libcv._load_full_dataset(dataset, class_id, ground_truth_variable_count) # Perform cross-validation on the dataset, using RFE to achieve the target attr_count actual, predicted = cross_validate_combined_dataset(Xs, ys, attr_count, threaded=False) print_report(actual, attr_count, class_id, dataset, predicted)
def main(): parser = argparse.ArgumentParser(description='Perform cross-validation on the dataset, cross-validating the behavior of one specific subject.') parser.add_argument('dataset', help='name of the dataset folder') parser.add_argument('class_id', type=int, help='target class id, 0-2') parser.add_argument('ground_truth_count', type=int, help='number of ground truth values, 1-3') parser.add_argument('rfe', type=int, default=1, help='perform RFE?') args = parser.parse_args() print args attr_count = None if args.rfe == 0 else attribute_counts[args.dataset][args.class_id] # Load our dataset into memory Xs, ys = libcv._load_full_dataset(args.dataset, args.class_id, args.ground_truth_count) # Perform cross-validation on the dataset, using RFE to achieve the target attr_count actual, predicted = cross_validate_combined_dataset(Xs, ys, attr_count, threaded=False) print_report(actual, attr_count, args.class_id, args.dataset, predicted)
from sklearn.grid_search import GridSearchCV parser = argparse.ArgumentParser(description='Perform cross-validation on the dataset, cross-validating the behavior of one specific subject.') parser.add_argument('dataset', help='name of the dataset folder') parser.add_argument('class_id', type=int, help='target class id, 0-2') parser.add_argument('ground_truth_count', type=int, help='number of ground truth values, 1-3') args = parser.parse_args() print args ############################################################################## # Load and prepare data set # # dataset for grid search Xs, ys = libcv._load_full_dataset(args.dataset, args.class_id, args.ground_truth_count) X = to_float(flatten(Xs)) y = flatten(ys) # It is usually a good idea to scale the data for SVM training. # We are cheating a bit in this example in scaling all of the data, # instead of fitting the transformation on the training set and # just applying it on the test set. scaler = StandardScaler() X = scaler.fit_transform(X) ############################################################################## # Train classifier # # For an initial search, a logarithmic grid with basis