コード例 #1
0
def prepare_data_holdout_given_split(path_samples):

    # ------ Fetch samples
    samples_train = fetch_samples(os.path.join(path_samples, 'train'))
    samples_test = fetch_samples(os.path.join(path_samples, 'test'))
    #samples_test = fetch_samples(os.path.join(path_samples, 'validation'))

    # ------ Create feature vector from already splitted dataset
    X_train, X_test, Y_train, Y_test, class_names, fvector_labels = create_fvector_train_test(
        samples_train, samples_test)

    return X_train, X_test, Y_train, Y_test, class_names, fvector_labels, samples_train, samples_test
コード例 #2
0
def prepare_data_gridCrossvalidation(path_samples):

    # ------ Fetch samples
    samples_train = fetch_samples(os.path.join(path_samples, 'train'))
    samples_test = fetch_samples(os.path.join(path_samples, 'test'))

    test_fold = []
    for sample in samples_train:
        test_fold.append(sample['fold'])

    # ------ Create feature vector
    X_train, X_test, Y_train, Y_test, class_names, fvector_labels = create_fvector_train_test(
        samples_train, samples_test)

    folds = PredefinedSplit(test_fold)

    return X_train, X_test, Y_train, Y_test, class_names, fvector_labels, folds, samples_train, samples_test
コード例 #3
0
def prepare_data_crossvalidation(path_samples):

    # ------ Fetch samples
    samples = fetch_samples(path_samples)

    # ------ Create feature vector
    X, Y, class_names, fvector_labels = create_fvector(samples)

    return X, Y, class_names, fvector_labels, samples
コード例 #4
0
def prepare_data_holdout_random_split(path_samples):

    # ------ Fetch samples
    samples = fetch_samples(path_samples)

    # ------ Create feature vector
    X, Y, class_names, fvector_labels = create_fvector(samples)

    # ------ Split Dataset
    X_train, X_test, Y_train, Y_test = split_dataset(X, Y)

    return X_train, X_test, Y_train, Y_test, class_names, fvector_labels, samples
コード例 #5
0
def prepare_data_crossvalidation_given_split(path_samples):

    # ------ Fetch samples
    samples = fetch_samples(path_samples)

    test_fold = []
    for sample in samples:
        test_fold.append(sample['fold'])

    # ------ Create feature vector
    X, Y, class_names, fvector_labels = create_fvector(samples)

    folds = PredefinedSplit(test_fold)

    return X, Y, class_names, fvector_labels, folds, samples