예제 #1
0
def test_FGDA_transform():
    """Test transform of FGDA"""
    covset = generate_cov(10,3)
    labels = np.array([0,1]).repeat(5)
    ts = FGDA(metric='riemann')
    ts.fit(covset,labels)
    ts.transform(covset)
def test_FGDA_transform():
    """Test transform of FGDA."""
    covset = generate_cov(10, 3)
    labels = np.array([0, 1]).repeat(5)
    ts = FGDA(metric='riemann')
    ts.fit(covset, labels)
    ts.transform(covset)
예제 #3
0
def test_FGDA_init(tsupdate, metric, get_covmats, get_labels):
    n_classes, n_trials, n_channels = 2, 6, 3
    labels = get_labels(n_trials, n_classes)
    covmats = get_covmats(n_trials, n_channels)
    ts = FGDA(metric=metric, tsupdate=tsupdate)
    ts.fit(covmats, labels)
    Xtr = ts.transform(covmats)
    assert Xtr.shape == (n_trials, n_channels, n_channels)
예제 #4
0
def learn_ts_fgda(X_train, y_train, T=0, NT=1):

    classes = [T, NT]
    train_fgda = FGDA()

    train_fgda.fit(X=X_train, y=y_train)

    X_train_fgda = train_fgda.transform(X=X_train)

    centroids_train_fgda = [
        mean_covariance(X_train_fgda[y_train == l, :, :], metric='riemann')
        for l in classes
    ]

    return X_train_fgda, centroids_train_fgda, train_fgda
def test_FGDA_fit():
    """Test Fit of FGDA."""
    covset = generate_cov(10, 3)
    labels = np.array([0, 1]).repeat(5)
    ts = FGDA(metric='riemann')
    ts.fit(covset, labels)