Exemplo n.º 1
0
def load_tfd_fold(fold=0):
    """
    Return train, val, test data for the particular fold.
    """
    # note that the training set used here is the 'unlabeled' set in TFD
    x_train, _, _ = tfd.load_proper_fold(fold, 'unlabeled', scale=True)
    x_val, _, _ = tfd.load_proper_fold(fold, 'val', scale=True)
    x_test, _, _ = tfd.load_proper_fold(fold, 'test', scale=True)

    imsz = np.prod(x_train.shape[1:])

    return x_train.reshape(x_train.shape[0], imsz), \
            x_val.reshape(x_val.shape[0], imsz), \
            x_test.reshape(x_test.shape[0], imsz)
Exemplo n.º 2
0
def load_tfd_fold(fold=0):
    """
    Return train, val, test data for the particular fold.
    """
    # note that the training set used here is the 'unlabeled' set in TFD
    x_train, _, _ = tfd.load_proper_fold(fold, 'unlabeled', scale=True)
    x_val,   _, _ = tfd.load_proper_fold(fold, 'val', scale=True)
    x_test,  _, _ = tfd.load_proper_fold(fold, 'test', scale=True)

    imsz = np.prod(x_train.shape[1:])

    return x_train.reshape(x_train.shape[0], imsz), \
            x_val.reshape(x_val.shape[0], imsz), \
            x_test.reshape(x_test.shape[0], imsz)
Exemplo n.º 3
0
def load_tfd_all_folds(set_name='val', n_folds=5):
    x = []
    for i_fold in range(n_folds):
        #xx, _, _ = tfd.load_fold(i_fold, set_name, scale=True)
        xx, _, _ = tfd.load_proper_fold(i_fold, set_name, scale=True)
        x.append(xx.reshape(xx.shape[0], np.prod(xx.shape[1:])))
    return x
Exemplo n.º 4
0
def load_tfd_all_folds(set_name='val', n_folds=5):
    x = []
    for i_fold in range(n_folds):
        #xx, _, _ = tfd.load_fold(i_fold, set_name, scale=True)
        xx, _, _ = tfd.load_proper_fold(i_fold, set_name, scale=True)
        x.append(xx.reshape(xx.shape[0], np.prod(xx.shape[1:])))
    return x
Exemplo n.º 5
0
def load_train_data(dataset='mnist'):
    if dataset == 'mnist':
        train_data, _, _ = mnistio.load_data()
    elif dataset == 'tfd':
        train_data, _, _ = tfd.load_proper_fold(0, 'unlabeled', scale=True)
        train_data = train_data.reshape(train_data.shape[0], np.prod(train_data.shape[1:]))

    return train_data
Exemplo n.º 6
0
def load_train_data(dataset='mnist'):
    if dataset == 'mnist':
        train_data, _, _ = mnistio.load_data()
    elif dataset == 'tfd':
        train_data, _, _ = tfd.load_proper_fold(0, 'unlabeled', scale=True)
        train_data = train_data.reshape(train_data.shape[0],
                                        np.prod(train_data.shape[1:]))

    return train_data