Added components for the temperature features extraction.

sociality-task
= 2022-03-28 12:37:02 +00:00
parent 1902d02a86
commit 393dab72f5
4 changed files with 70 additions and 51 deletions

View File

@ -495,9 +495,17 @@ EMPATICA_TEMPERATURE:
CONTAINER: TEMP CONTAINER: TEMP
PROVIDERS: PROVIDERS:
DBDP: DBDP:
COMPUTE: False COMPUTE: True
FEATURES: ["maxtemp", "mintemp", "avgtemp", "mediantemp", "modetemp", "stdtemp", "diffmaxmodetemp", "diffminmodetemp", "entropytemp"] FEATURES: ["maxtemp", "mintemp", "avgtemp", "mediantemp", "modetemp", "stdtemp", "diffmaxmodetemp", "diffminmodetemp", "entropytemp"]
SRC_SCRIPT: src/features/empatica_temperature/dbdp/main.py SRC_SCRIPT: src/features/empatica_temperature/dbdp/main.py
CF:
COMPUTE: True
FEATURES: ["autocorrelations", "countAboveMean", "countBelowMean", "maximum", "minimum", "meanAbsChange", "longestStrikeAboveMean",
"longestStrikeBelowMean", "stdDev", "median", "meanChange", "numberOfZeroCrossings", "absEnergy", "linearTrendSlope",
"ratioBeyondRSigma", "binnedEntropy", "numOfPeaksAutocorr", "numberOfZeroCrossingsAutocorr", "areaAutocorr",
"calcMeanCrossingRateAutocorr", "countAboveMeanAutocorr", "sumPer", "sumSquared", "squareSumOfComponent",
"sumOfSquareComponents"]
SRC_SCRIPT: src/features/empatica_temperature/cf/main.py
# See https://www.rapids.science/latest/features/empatica-electrodermal-activity/ # See https://www.rapids.science/latest/features/empatica-electrodermal-activity/
EMPATICA_ELECTRODERMAL_ACTIVITY: EMPATICA_ELECTRODERMAL_ACTIVITY:
@ -509,14 +517,11 @@ EMPATICA_ELECTRODERMAL_ACTIVITY:
SRC_SCRIPT: src/features/empatica_electrodermal_activity/dbdp/main.py SRC_SCRIPT: src/features/empatica_electrodermal_activity/dbdp/main.py
CF: CF:
COMPUTE: True COMPUTE: True
FEATURES: ['mean', 'std', 'q25', 'q75', 'qd', 'deriv', 'power', 'numPeaks', 'ratePeaks', 'powerPeaks', FEATURES: ['mean', 'std', 'q25', 'q75', 'qd', 'deriv', 'power', 'numPeaks', 'ratePeaks', 'powerPeaks', 'sumPosDeriv', 'propPosDeriv', 'derivTonic',
'sumPosDeriv', 'propPosDeriv', 'derivTonic', 'sigTonicDifference', 'freqFeats', 'sigTonicDifference', 'freqFeats','maxPeakAmplitudeChangeBefore', 'maxPeakAmplitudeChangeAfter', 'avgPeakAmplitudeChangeBefore',
'maxPeakAmplitudeChangeBefore', 'maxPeakAmplitudeChangeAfter', 'avgPeakAmplitudeChangeAfter', 'avgPeakChangeRatio', 'maxPeakIncreaseTime', 'maxPeakDecreaseTime', 'maxPeakDuration', 'maxPeakChangeRatio',
'avgPeakAmplitudeChangeBefore', 'avgPeakAmplitudeChangeAfter', 'avgPeakChangeRatio', 'avgPeakIncreaseTime', 'avgPeakDecreaseTime', 'avgPeakDuration', 'maxPeakResponseSlopeBefore', 'maxPeakResponseSlopeAfter', 'signalOverallChange',
'maxPeakIncreaseTime', 'maxPeakDecreaseTime', 'maxPeakDuration', 'maxPeakChangeRatio', 'changeDuration', 'changeRate', 'significantIncrease', 'significantDecrease']
'avgPeakIncreaseTime', 'avgPeakDecreaseTime', 'avgPeakDuration', 'maxPeakResponseSlopeBefore',
'maxPeakResponseSlopeAfter', 'signalOverallChange', 'changeDuration', 'changeRate',
'significantIncrease', 'significantDecrease']
SRC_SCRIPT: src/features/empatica_electrodermal_activity/cf/main.py SRC_SCRIPT: src/features/empatica_electrodermal_activity/cf/main.py
# See https://www.rapids.science/latest/features/empatica-blood-volume-pulse/ # See https://www.rapids.science/latest/features/empatica-blood-volume-pulse/

View File

@ -13,34 +13,22 @@ dependencies:
- attrs=20.3.0 - attrs=20.3.0
- binaryornot=0.4.4 - binaryornot=0.4.4
- blas=1.0 - blas=1.0
- brotli=1.0.9
- brotlipy=0.7.0 - brotlipy=0.7.0
- bzip2=1.0.8 - bzip2=1.0.8
- ca-certificates=2022.2.1 - ca-certificates=2021.7.5
- certifi=2021.10.8 - certifi=2021.5.30
- cffi=1.14.4 - cffi=1.14.4
- chardet=3.0.4 - chardet=3.0.4
- click=7.1.2 - click=7.1.2
- colorama=0.4.4 - colorama=0.4.4
- cookiecutter=1.6.0 - cookiecutter=1.6.0
- cryptography=3.3.1 - cryptography=3.3.1
- cycler=0.11.0
- datrie=0.8.2 - datrie=0.8.2
- dbus=1.13.18
- docutils=0.16 - docutils=0.16
- expat=2.4.4
- fontconfig=2.13.1
- fonttools=4.25.0
- freetype=2.11.0
- future=0.18.2 - future=0.18.2
- giflib=5.2.1
- gitdb=4.0.5 - gitdb=4.0.5
- gitdb2=4.0.2 - gitdb2=4.0.2
- gitpython=3.1.11 - gitpython=3.1.11
- glib=2.69.1
- gst-plugins-base=1.14.0
- gstreamer=1.14.0
- icu=58.2
- idna=2.10 - idna=2.10
- imbalanced-learn=0.6.2 - imbalanced-learn=0.6.2
- importlib-metadata=2.0.0 - importlib-metadata=2.0.0
@ -49,10 +37,7 @@ dependencies:
- jinja2=2.11.2 - jinja2=2.11.2
- jinja2-time=0.2.0 - jinja2-time=0.2.0
- joblib=1.0.0 - joblib=1.0.0
- jpeg=9d
- jsonschema=3.2.0 - jsonschema=3.2.0
- kiwisolver=1.3.2
- lcms2=2.12
- ld_impl_linux-64=2.36.1 - ld_impl_linux-64=2.36.1
- libblas=3.8.0 - libblas=3.8.0
- libcblas=3.8.0 - libcblas=3.8.0
@ -66,38 +51,24 @@ dependencies:
- libgfortran - libgfortran
- liblapack=3.8.0 - liblapack=3.8.0
- libopenblas=0.3.10 - libopenblas=0.3.10
- libpng=1.6.37
- libstdcxx-ng=11.2.0 - libstdcxx-ng=11.2.0
- libtiff=4.2.0
- libuuid=1.0.3
- libwebp=1.2.2
- libwebp-base=1.2.2
- libxcb=1.14
- libxgboost=0.90 - libxgboost=0.90
- libxml2=2.9.12
- libzlib=1.2.11 - libzlib=1.2.11
- lightgbm=3.1.1 - lightgbm=3.1.1
- llvm-openmp=10.0.0 - llvm-openmp=10.0.0
- lz4-c=1.9.3
- markupsafe=1.1.1 - markupsafe=1.1.1
- matplotlib=3.5.1
- matplotlib-base=3.5.1
- mkl - mkl
- mkl-service=2.3.0 - mkl-service=2.3.0
- mkl_fft=1.2.0 - mkl_fft=1.2.0
- mkl_random=1.1.1 - mkl_random=1.1.1
- more-itertools=8.6.0 - more-itertools=8.6.0
- munkres=1.1.4
- ncurses=6.2 - ncurses=6.2
- numpy=1.19.2 - numpy=1.19.2
- numpy-base=1.19.2 - numpy-base=1.19.2
- openblas=0.3.4 - openblas=0.3.4
- openssl=1.1.1m - openssl=1.1.1k
- packaging=21.3
- pandas=1.1.5 - pandas=1.1.5
- pbr=5.5.1 - pbr=5.5.1
- pcre=8.45
- pillow=9.0.1
- pip=20.3.3 - pip=20.3.3
- plotly=4.14.1 - plotly=4.14.1
- poyo=0.5.0 - poyo=0.5.0
@ -106,28 +77,24 @@ dependencies:
- pycparser=2.20 - pycparser=2.20
- pyerfa=1.7.1.1 - pyerfa=1.7.1.1
- pyopenssl=20.0.1 - pyopenssl=20.0.1
- pyqt=5.9.2
- pysocks=1.7.1 - pysocks=1.7.1
- python=3.7.9 - python=3.7.9
- python-dateutil=2.8.1 - python-dateutil=2.8.1
- python_abi=3.7 - python_abi=3.7
- pytz=2020.4 - pytz=2020.4
- pyyaml=5.3.1 - pyyaml=5.3.1
- qt=5.9.7
- readline=8.0 - readline=8.0
- requests=2.25.0 - requests=2.25.0
- retrying=1.3.3 - retrying=1.3.3
- scikit-learn=0.23.2 - scikit-learn=0.23.2
- scipy=1.5.2 - scipy=1.5.2
- setuptools=51.0.0 - setuptools=51.0.0
- sip=4.19.8
- six=1.15.0 - six=1.15.0
- smmap=3.0.4 - smmap=3.0.4
- smmap2=3.0.1 - smmap2=3.0.1
- sqlite=3.33.0 - sqlite=3.33.0
- threadpoolctl=2.1.0 - threadpoolctl=2.1.0
- tk=8.6.10 - tk=8.6.10
- tornado=6.1
- tqdm=4.62.0 - tqdm=4.62.0
- urllib3=1.25.11 - urllib3=1.25.11
- wheel=0.36.2 - wheel=0.36.2
@ -138,23 +105,26 @@ dependencies:
- yaml=0.2.5 - yaml=0.2.5
- zipp=3.4.0 - zipp=3.4.0
- zlib=1.2.11 - zlib=1.2.11
- zstd=1.4.9
- pip: - pip:
- amply==0.1.4 - amply==0.1.4
- bidict==0.21.4 - bidict==0.22.0
- biosppy==0.8.0 - biosppy==0.8.0
- build==0.7.0
- cached-property==1.5.2 - cached-property==1.5.2
- calculatingfeatures==0.1.1 - calculatingfeatures==0.1.1
- configargparse==0.15.1 - configargparse==0.15.1
- cycler==0.11.0
- decorator==4.4.2 - decorator==4.4.2
- fonttools==4.31.2
- h5py==3.6.0 - h5py==3.6.0
- ipython-genutils==0.2.0 - ipython-genutils==0.2.0
- jupyter-core==4.6.3 - jupyter-core==4.6.3
- kiwisolver==1.4.1
- matplotlib==3.5.1
- nbformat==5.0.7 - nbformat==5.0.7
- opencv-python==4.5.5.64 - opencv-python==4.5.5.64
- packaging==21.3
- peakutils==1.3.3 - peakutils==1.3.3
- pep517==0.12.0 - pillow==9.0.1
- pulp==2.4 - pulp==2.4
- pyparsing==2.4.7 - pyparsing==2.4.7
- pyrsistent==0.15.5 - pyrsistent==0.15.5
@ -162,7 +132,7 @@ dependencies:
- ratelimiter==1.2.0.post0 - ratelimiter==1.2.0.post0
- shortuuid==1.0.8 - shortuuid==1.0.8
- snakemake==5.30.2 - snakemake==5.30.2
- tomli==2.0.1
- toposort==1.5 - toposort==1.5
- traitlets==4.3.3 - traitlets==4.3.3
- typing-extensions==4.1.1
prefix: /opt/conda/envs/rapids prefix: /opt/conda/envs/rapids

View File

@ -18,7 +18,7 @@ def extractEDAFeaturesFromIntradayData(eda_intraday_data, features, time_segment
eda_intraday_features = pd.DataFrame() eda_intraday_features = pd.DataFrame()
# apply a method from calculate features module # apply methods from calculate features module
eda_intraday_features = \ eda_intraday_features = \
eda_intraday_data.groupby('local_segment').apply(\ eda_intraday_data.groupby('local_segment').apply(\
lambda x: calculateFeatures(convertInputInto2d(x['electrodermal_activity'], x.shape[0]), fs=4, featureNames=features)) lambda x: calculateFeatures(convertInputInto2d(x['electrodermal_activity'], x.shape[0]), fs=4, featureNames=features))

View File

@ -0,0 +1,44 @@
import pandas as pd
from scipy.stats import entropy
from CalculatingFeatures.helper_functions import convert1DEmpaticaToArray, convertInputInto2d, genericFeatureNames
from CalculatingFeatures.calculate_features import calculateFeatures
import sys
def extractTempFeaturesFromIntradayData(temperature_intraday_data, features, time_segment, filter_data_by_segment):
temperature_intraday_features = pd.DataFrame(columns=["local_segment"] + features)
if not temperature_intraday_data.empty:
temperature_intraday_data = filter_data_by_segment(temperature_intraday_data, time_segment)
if not temperature_intraday_data.empty:
temperature_intraday_features = pd.DataFrame()
# apply methods from calculate features module
temperature_intraday_features = \
temperature_intraday_data.groupby('local_segment').apply(\
lambda x: calculateFeatures(convertInputInto2d(x['temperature'], x.shape[0]), fs=4, featureNames=features))
temperature_intraday_features.reset_index(inplace=True)
return temperature_intraday_features
def cf_features(sensor_data_files, time_segment, provider, filter_data_by_segment, *args, **kwargs):
temperature_intraday_data = pd.read_csv(sensor_data_files["sensor_data"])
requested_intraday_features = provider["FEATURES"]
# name of the features this function can compute
base_intraday_features_names = genericFeatureNames
# the subset of requested features this function can compute
intraday_features_to_compute = list(set(requested_intraday_features) & set(base_intraday_features_names))
# extract features from intraday data
temperature_intraday_features = extractTempFeaturesFromIntradayData(temperature_intraday_data,
intraday_features_to_compute, time_segment,
filter_data_by_segment)
return temperature_intraday_features