def test_covariances(): """Test fit Covariances""" x = np.random.randn(2, 3, 100) cov = Covariances() cov.fit(x) cov.fit_transform(x) assert_equal(cov.get_params(), dict(estimator='scm'))
def test_covariances(estimator, rndstate): """Test Covariances""" n_matrices, n_channels, n_times = 2, 3, 100 x = rndstate.randn(n_matrices, n_channels, n_times) cov = Covariances(estimator=estimator) cov.fit(x) covmats = cov.fit_transform(x) assert cov.get_params() == dict(estimator=estimator) assert covmats.shape == (n_matrices, n_channels, n_channels) assert is_spd(covmats)
f_name = dire + '/' + name subject = name.split('_') data = loadmat(f_name) data_IS = data[list(data.keys())[-1]] data_tensor = [data_IS[0][0]] for j in range(len(data_IS)): if j == 0: k = 1 else: k = 0 for i in range(k, len(data_IS[j])): temp = [data_IS[j][i]] data_tensor = np.concatenate((data_tensor, temp), axis=0) cov = Covariances(estimator='lwf') ts = TangentSpace() cov.fit(data_tensor, label) cov_train = cov.transform(data_tensor) ts.fit(cov_train, label) ts_train = ts.transform(cov_train) ts_shape = (np.shape(ts_train)) pca = PCA() ann = MLPClassifier(max_iter=5000) clf = BaggingClassifier(base_estimator=ann, bootstrap=True) pipe = Pipeline(steps=[('pca', pca), ('clf', clf)]) param_grid = { 'pca__n_components': [20, 30, 40, 50, 60, 70, 80, 90, 100], 'clf__base_estimator__hidden_layer_sizes': [(10), (20), (30), (40), (50), (60), (70), (80), (90), (100), (110), (120), (130), (140), (150), (160), (170), (180)], 'clf__n_estimators': [ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150,
def test_covariances(): """Test fit Covariances""" x = np.random.randn(2, 3, 100) cov = Covariances() cov.fit(x) cov.fit_transform(x)
def test_covariances(): """Test fit Covariances""" x = np.random.randn(2,3,100) cov = Covariances() cov.fit(x) cov.fit_transform(x)