Commit 842f9596 authored by Alex Fout's avatar Alex Fout

created file, contains all feature extractors

parent 1f38fb32
import numpy as np
import scipy as sp
def correlation(raw_matrix):
corr = np.corrcoef(np.transpose(raw_matrix))
return corr[np.triu_indices(corr.shape[0], k=1, m=corr.shape[1])]
def coherence(raw_matrix):
coherences = []
for i in range(raw_matrix.shape[1]):
for j in range(i+1):
coherences.append(sp.signal.coherence(raw_matrix[:, i], raw_matrix[:, j])[0])
return np.hstack(coherences)
extractors = {
"correlation": correlation,
"coherence": coherence,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment