Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
brain_age_from_eeg
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
hackathon
brain_age_from_eeg
Commits
bb4e067a
Commit
bb4e067a
authored
May 24, 2017
by
Alex Fout
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed tabs to spaces
parent
855ffc8d
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
15 additions
and
15 deletions
+15
15
feature_extractors.py
feature_extractors.py
+15
15
No files found.
feature_extractors.py
View file @
bb4e067a
...
...
@@ 31,12 +31,12 @@ def coherence(raw_matrix):
def
rms
(
raw_matrix
):
"""
Calculates the root mean square value of a time series
Calculates the root mean square value of a time series
:param raw_matrix: data matrix where rows are examples and columns are raw features
:type raw_matrix: ndarray
:return: feature matrix where rows are examples and columns are calculated features
:rtype: ndarray
"""
"""
rmsValues
=
[]
for
i
in
range
(
raw_matrix
.
shape
[
1
]):
x
=
raw_matrix
[:,
i
]
...
...
@@ 46,12 +46,12 @@ def rms(raw_matrix):
def
meanAbs
(
raw_matrix
):
"""
Calculates the mean of absolute values
Calculates the mean of absolute values
:param raw_matrix: data matrix where rows are examples and columns are raw features
:type raw_matrix: ndarray
:return: feature matrix where rows are examples and columns are calculated features
:rtype: ndarray
"""
"""
meanAbsValues
=
[]
for
i
in
range
(
raw_matrix
.
shape
[
1
]):
x
=
raw_matrix
[:,
i
]
...
...
@@ 61,12 +61,12 @@ def meanAbs(raw_matrix):
def
std
(
raw_matrix
):
"""
standard deviation of a time series
standard deviation of a time series
:param raw_matrix: data matrix where rows are examples and columns are raw features
:type raw_matrix: ndarray
:return: feature matrix where rows are examples and columns are calculated features
:rtype: ndarray
"""
"""
stdValues
=
[]
for
i
in
range
(
raw_matrix
.
shape
[
1
]):
x
=
raw_matrix
[:,
i
]
...
...
@@ 76,20 +76,20 @@ def std(raw_matrix):
def
subBandRatio
(
raw_matrix
,
nBands
=
6
):
"""
The ratio of the mean of absolute values, between adjacent columns
Note: This measure was used in a paper where the columns of the matrix represent the
frequency bands
The ratio of the mean of absolute values, between adjacent columns
Note: This measure was used in a paper where the columns of the matrix represent the
frequency bands
:param raw_matrix: data matrix where rows are examples and columns are raw features
:type raw_matrix: ndarray
:return: feature matrix where rows are examples and columns are calculated features
:rtype: ndarray
"""
ratio
=
[]
channel
=
int
(
raw_matrix
.
shape
[
1
]
/
nBands
)
"""
ratio
=
[]
channel
=
int
(
raw_matrix
.
shape
[
1
]
/
nBands
)
for
i
in
range
(
channel
):
x
=
raw_matrix
[:,
i
*
nBands
:(
i
+
1
)
*
nBands
]
for
j
in
range
(
x
.
shape
[
1
]

1
):
ratio
.
append
(
np
.
mean
(
np
.
abs
(
x
[:,
j
]))
/
np
.
mean
(
np
.
abs
(
x
[:,
j
+
1
])))
x
=
raw_matrix
[:,
i
*
nBands
:(
i
+
1
)
*
nBands
]
for
j
in
range
(
x
.
shape
[
1
]

1
):
ratio
.
append
(
np
.
mean
(
np
.
abs
(
x
[:,
j
]))
/
np
.
mean
(
np
.
abs
(
x
[:,
j
+
1
])))
return
np
.
hstack
(
ratio
)
extractors
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment