Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_Hankelcovariances():
"""Test Hankel Covariances"""
x = np.random.randn(2, 3, 100)
cov = HankelCovariances()
cov.fit(x)
cov.fit_transform(x)
assert_equal(cov.get_params(), dict(estimator='scm', delays=4))
cov = HankelCovariances(delays=[1, 2])
cov.fit(x)
cov.fit_transform(x)
def test_Hankelcovariances():
"""Test Hankel Covariances"""
x = np.random.randn(2, 3, 100)
cov = HankelCovariances()
cov.fit(x)
cov.fit_transform(x)
assert_equal(cov.get_params(), dict(estimator='scm', delays=4))
cov = HankelCovariances(delays=[1, 2])
cov.fit(x)
cov.fit_transform(x)
LogisticRegression('l2'))
# Induced activity models
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['p1', 'p2', 'p3', 'p4']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['p1', 'p2', 'p3', 'p4']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
for p in np.unique(patients):
print('Patient %s' % p)
clfs = deepcopy(array_clfs)
ix = patients == p
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['ca', 'de', 'fp', 'ja', 'mv', 'wc', 'zt']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
fnames = glob('./fhpred/data/*/*.mat')
for fname in fnames:
data = loadmat(fname)
p = fname[-18:-16]
LogisticRegression('l2'))
# Induced activity models
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['p1', 'p2', 'p3', 'p4']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['p1', 'p2', 'p3', 'p4']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
for p in np.unique(patients):
clfs = deepcopy(array_clfs.values())
LogisticRegression('l2'))
# Induced activity models
baseclf = make_pipeline(ElectrodeSelection(10, metric=dict(mean='logeuclid',
distance='riemann')),
TangentSpace('riemann'),
LogisticRegression('l1'))
array_clfs['Cosp'] = make_pipeline(CospCovariances(fs=1000, window=32,
overlap=0.95, fmax=300,
fmin=1),
CospBoostingClassifier(baseclf))
array_clfs['HankelCov'] = make_pipeline(DownSampler(2),
HankelCovariances(delays=[2, 4, 8, 12, 16], estimator='oas'),
TangentSpace('logeuclid'),
LogisticRegression('l1'))
array_clfs['CSSP'] = make_pipeline(HankelCovariances(delays=[2, 4, 8, 12, 16],
estimator='oas'),
CSP(30),
LogisticRegression('l1'))
patients = dataframe1.PatientID.values
index = array_clfs.keys() + ['Ensemble']
columns = ['ca', 'de', 'fp', 'ja', 'mv', 'wc', 'zt']
res_acc = pd.DataFrame(index=index, columns=columns)
res_auc = pd.DataFrame(index=index, columns=columns)
fnames = glob('./fhpred/data/*/*.mat')