Skip to content

Commit

Permalink
Resolve merge conflits
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarandas committed Feb 14, 2021
2 parents ac5400e + ae74f7c commit bb7ba74
Show file tree
Hide file tree
Showing 22 changed files with 1,187 additions and 1,032 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
Changelog
=========

Version 0.1.4
=============
- Bugfixes
- Fixed a bug on the progress bar not being displayed if the signal is passed already divided into windows (`#49 <https://github.com/fraunhoferportugal/tsfel/issues/49>`_)
- Fixed a bug on the ``distance`` feature (`#54 <https://github.com/fraunhoferportugal/tsfel/issues/54>`_)
- Fixed a bug raising zero division in the ECDF slope feature (`#57 <https://github.com/fraunhoferportugal/tsfel/pull/57>`_)
- Fixed a bug when adding customised features using the JSON
- Fixed a bug on LPC was returning inconsistent values (`#58 <https://github.com/fraunhoferportugal/tsfel/pull/58>`_)
- Fixed a bug on normalised autocorrelation (`#64 <https://github.com/fraunhoferportugal/tsfel/pull/64>`_)

- Improvements
- Refactoring of some code sections and overall improved stability
- The documentation has been improved and a FAQ section was created
- The ``window_splitter`` parameter is now deprecated. If the user selected a ``window_size`` it is assumed that the signal must be divided into windows.
- Unit tests improvements

- New features
- Added to return the size of the feature vector from the configuration dictionary (`#50 <https://github.com/fraunhoferportugal/tsfel/issues/50>`_)


Version 0.1.3
=============
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ X = tsfel.time_series_features_extractor(cfg, df)
| ECDF | 1 |
| ECDF Percentile | 1 |
| ECDF Percentile Count | 1 |
| ECDF Slope | 1 |
| Histogram | 1 |
| Interquartile range | 1 |
| Kurtosis | 1 |
Expand Down
38 changes: 38 additions & 0 deletions docs/descriptions/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
===
FAQ
===


* **Does TSFEL work on Windows?**

Yes. By default we disabled multiprocessing in Windows. The multiprocessing in Windows was not completely stable. If you want to enable you can se ``n_jobs`` variable accordingly at your own risk.


* **Is it mandatory to pass the sampling rate?**

No. However, please note that some spectral features rely on the sampling rate to be calculated correctly. Therefore, if you have access to the sampling rate, it is a good practice to pass the correct value. The default sampling rate value is set to 100 Hz. In case you do not have access to the sampling rate, you might refrain from using spectral features.


* **Does TSFEL work with unevenly sampled data?**

TSFEL does not handle unevenly sampled data by default. Some of the features (e.g. spectral domain) require that you state the sampling frequency to compute the feature values correctly. A workaround to analyse unevenly spaced time series is to transform the data into equally spaced observations using interpolation (e.g. linear interpolation). After that you could use TSFEL directly on this converted equally spaced data.


* **Does TSFEL allow to extract features from multi-dimensional time series with variable lengths?**

Yes, it is possible, indeed. That's actually one of the functionalities that weren't adequately addressed by similar packages when we started the development of TSFEL. I recommend that the time series be stored in a data file and processed using the dataset_features_extractor. We are still updating the documentation of this functionality. In the meantime, you can read Section 2.2.1. Data ingestion and preprocessing of `TSFEL publication <https://www.sciencedirect.com/science/article/pii/S2352711020300017/>`_ which addresses that topic.


* **Do I have examples showcasing a complete pipeline using TSFEL?**

Sure, we provide several notebooks with examples of complete classification pipelines using TSFEL. The notebooks are available `here <https://github.com/fraunhoferportugal/tsfel/tree/development/notebooks/>`_. If you want to share a notebook with additional pipelines, please feel free to reach us.


* **Why should I use TSFEL?**

TSFEL assists researchers on exploratory feature extraction tasks on time series without requiring significant programming effort. All the features used in TSFEL have been delicately implemented and are unit tested. TSFEL also has an enthusiastic team of maintainers that would be happy to help you addressing doubts and solving issues.


* **How can I give the authors credit for their work?**

If you used TSFEL we would be appreciated if you star our `GitHub <https://github.com/fraunhoferportugal/tsfel/>`_ repository. In case you use TSFEL during your research, you would be happy if you can `cite our work <https://www.sciencedirect.com/science/article/pii/S2352711020300017/>`_.
4 changes: 4 additions & 0 deletions docs/descriptions/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ Let us start by downloading a some data. A complete dataset description can be f
import numpy as np
import pandas as pd
<<<<<<< HEAD
Load the dataset from online repository
=======
# Load the dataset from online repository
>>>>>>> development
!wget https://archive.ics.uci.edu/ml/machine-learning-databases/00240/UCI%20HAR%20Dataset.zip

# Unzip the dataset
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Contents
Get Started <descriptions/get_started>
Feature List <descriptions/feature_list>
Personalised Features <descriptions/personal>
Frequently Asked Questions <descriptions/faq>
Module Reference <descriptions/modules>
Authors <authors>
Changelog <changelog>
Expand Down
117 changes: 30 additions & 87 deletions notebooks/TSFEL_HAR_Example.ipynb

Large diffs are not rendered by default.

252 changes: 64 additions & 188 deletions notebooks/TSFEL_SMARTWATCH_HAR_Example.ipynb

Large diffs are not rendered by default.

147 changes: 44 additions & 103 deletions notebooks/TSFEL_predicting_NormalVsPathologicalknee.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pandas >= 0.25.3
# tsfel/feature_extraction/features_utils.py: 1
# tsfel/utils/calculate_complexity.py: 4
# tsfel/utils/signal_processing.py: 3
scipy >= 1.4.1
scipy >= 1.5.1

# tsfel/__init__.py: 2
# tsfel/setup.py: 1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setuptools.setup(
name="tsfel",
version="0.1.3",
version="0.1.4",
author="Fraunhofer Portugal",
description="Library for time series feature extraction",
long_description=long_description,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_calc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def pre_process(sensor_data):
settings5 = tsfel.get_features_by_domain()
settings6 = tsfel.extract_sheet('Features')
settings7 = tsfel.extract_sheet('Features_test', path_json=personal_path_json)
settings8 = tsfel.get_features_by_tag('inertial')
settings10 = tsfel.get_features_by_tag()

# Signal processing
data_new = tsfel.merge_time_series(sensor_data, resample_rate, time_unit)
Expand Down
72 changes: 41 additions & 31 deletions tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,6 @@ def test_ecdf_percentile():
np.testing.assert_almost_equal(ecdf_percentile(noiseWave), (-0.8095410722491809, 0.796916231269631))


def test_ecdf_slope():
np.testing.assert_almost_equal(ecdf_slope(const0), np.inf)
np.testing.assert_almost_equal(ecdf_slope(const1), np.inf)
np.testing.assert_almost_equal(ecdf_slope(constNeg), np.inf)
np.testing.assert_almost_equal(ecdf_slope(constF), np.inf)
np.testing.assert_almost_equal(ecdf_slope(lin), 0.05)
np.testing.assert_almost_equal(ecdf_slope(lin0), 0.0475)
np.testing.assert_almost_equal(ecdf_slope(wave), 0.3535534)
np.testing.assert_almost_equal(ecdf_slope(offsetWave), 0.3535534)
np.testing.assert_almost_equal(ecdf_slope(noiseWave), 0.3594095)


def test_ecdf_percentile_count():
np.testing.assert_almost_equal(ecdf_percentile_count(const0), (0, 0))
np.testing.assert_almost_equal(ecdf_percentile_count(const1), (1, 1))
Expand Down Expand Up @@ -753,25 +741,47 @@ def test_fft_mean_coeff():


def test_lpcc():
np.testing.assert_almost_equal(lpcc(const0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(const1), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(constNeg), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(constF), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(lin), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(lin0), (0.017793342850434657, 0.12419699587050197, 0.17985773867565555,
0.13749027713829948, 0.14521059821841656, 0.14362411136332903,
0.14403924127165643, 0.14362411136332903, 0.14521059821841656,
0.13749027713829948, 0.17985773867565555, 0.12419699587050197))
np.testing.assert_almost_equal(lpcc(wave), (8.08705689884851e-07, 0.10193422882411193, 0.0051922525746904875,
0.0003496693593067946, 2.355214618130234e-05, 1.2419899263690914e-06,
3.091008802744081e-06, 1.2419899263690914e-06, 2.355214618130234e-05,
0.0003496693593067946, 0.0051922525746904875, 0.10193422882411193))
np.testing.assert_almost_equal(lpcc(offsetWave), (8.087054868870942e-07, 0.10193422882503231, 0.005192252575236202,
0.0003496693583308415, 2.3552147454092374e-05,
1.241991615337501e-06, 3.0910069449505212e-06,
1.241991615337501e-06, 2.3552147454092374e-05,
0.0003496693583308415, 0.005192252575236202, 0.10193422882503231))
np.testing.assert_almost_equal(lpcc(noiseWave), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(const0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
np.testing.assert_almost_equal(lpcc(const1), ((0.020164333842602966, 0.9865688990210231, 0.5256081668917854,
0.36558947821279086, 0.2920451699576349, 0.25507545331173936,
0.23917931511018226, 0.23917931511018226, 0.25507545331173936,
0.2920451699576349, 0.36558947821279086, 0.5256081668917854,
0.9865688990210231)))
np.testing.assert_almost_equal(lpcc(constNeg), (0.020164333842602966, 0.9865688990210231, 0.5256081668917854,
0.36558947821279086, 0.2920451699576349, 0.25507545331173936,
0.23917931511018226, 0.23917931511018226, 0.25507545331173936,
0.2920451699576349, 0.36558947821279086, 0.5256081668917854,
0.9865688990210231))
np.testing.assert_almost_equal(lpcc(constF), (0.020164333842599635, 0.9865688990210177, 0.5256081668917822,
0.365589478212793, 0.29204516995764224, 0.2550754533117383,
0.2391793151101857, 0.2391793151101857, 0.2550754533117383,
0.29204516995764224, 0.365589478212793, 0.5256081668917822,
0.9865688990210177))
np.testing.assert_almost_equal(lpcc(lin), (0.009787922299081098, 0.9403087900526141, 0.45515839811652303,
0.2959902388191573, 0.2226794080995073, 0.18587538078947108,
0.17006234165994988, 0.17006234165994988, 0.18587538078947108,
0.2226794080995073, 0.2959902388191573, 0.45515839811652303,
0.9403087900526141))
np.testing.assert_almost_equal(lpcc(lin0), (0.14693248468111308, 0.7098379679548503, 0.27136979375401815,
0.12066884688694682, 0.054365468824491156, 0.022184966988290034,
0.00867554638640014, 0.00867554638640014, 0.022184966988290034,
0.054365468824491156, 0.12066884688694682, 0.27136979375401815,
0.7098379679548503))
np.testing.assert_almost_equal(lpcc(wave), (0.27326478573784635, 2.2503511377184005, 1.3120406566259146,
0.9508372630850437, 0.8377303045711273, 0.7195725472552679,
0.715238952271539, 0.715238952271539, 0.7195725472552679,
0.8377303045711273, 0.9508372630850437, 1.3120406566259146,
2.2503511377184005))
np.testing.assert_almost_equal(lpcc(offsetWave), (0.5435105244008235, 1.5815770053561224, 1.1189968861619681,
0.9577304362743059, 0.8832739401503552, 0.8458651104475441,
0.8295606293469393, 0.8295606293469393, 0.8458651104475441,
0.8832739401503552, 0.9577304362743059, 1.1189968861619681,
1.5815770053561224))
np.testing.assert_almost_equal(lpcc(noiseWave), (0.332943861278751, 0.535742501182159, 0.6994290294792235,
0.699314211544821, 0.6700910097813829, 0.67785538535114,
0.7162476787322745, 0.7162476787322745, 0.67785538535114,
0.6700910097813829, 0.699314211544821, 0.6994290294792235,
0.535742501182159))


def test_spectral_entropy():
Expand Down
15 changes: 13 additions & 2 deletions tests/test_features_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import tsfel


FEATURES_JSON = tsfel.__path__[0] + '/feature_extraction/features.json'

settings0 = tsfel.load_json(FEATURES_JSON)
Expand All @@ -13,4 +12,16 @@

settings4 = tsfel.get_features_by_domain(None)

settings5 = tsfel.extract_sheet('Features')
settings5 = tsfel.extract_sheet('Features')

settings6 = tsfel.get_features_by_tag('audio')

settings7 = tsfel.get_features_by_tag('inertial')

settings8 = tsfel.get_features_by_tag('ecg')

settings9 = tsfel.get_features_by_tag('eeg')

settings10 = tsfel.get_features_by_tag('emg')

settings11 = tsfel.get_features_by_tag(None)
Loading

0 comments on commit bb7ba74

Please sign in to comment.