Code Monkey home page Code Monkey logo

flirt's Introduction

FLIRT

Python Versions PyPI Documentation Status Binder DOI

⭐️ Simple. Robust. Powerful.

FLIRT is a Feature generation tooLkIt for weaRable daTa such as that from your smartwatch or smart ring. With FLIRT you can easily transform wearable data into meaningful features which can then be used for example in machine learning or AI models.

In contrast to other existing toolkits, FLIRT (1) focuses on physiological data recorded with (consumer) wearables and (2) calculates features based on a sliding-window approach. FLIRT is an easy-to-use, robust and efficient feature generation toolkit for your wearable device!

FLIRT Workflow

➡️ Are you ready to FLIRT with your wearable data?

Main Features

A few things that FLIRT can do:

  • Loading data from common wearable device formats such as from the Empatica E4 or Holter ECGs
  • Overlapping sliding-window approach for feature calculation
  • Calculating HRV (heart-rate variability) features from NN intervals (aka inter-beat intervals)
  • Deriving features for EDA (electrodermal activity)
  • Computing features for ACC (accelerometer)
  • Provide and prepare features in one comprehensive DataFrame, so that they can directly be used for further steps (e.g. training machine learning models)

😎 FLIRT provides high-level implementations for fast and easy utilization of feature generators (see flirt.simple).

🤓 For advanced users, who wish to adapt algorithms and parameters do their needs, FLIRT also provides low-level implementations. They allow for extensive configuration possibilities in feature generation and the specification of which algorithms to use for generating features.

Installation

FLIRT is available from PyPI and can be installed via pip:

pip install flirt

Alternatively, you can checkout the source code from the GitHub repository:

git clone https://github.com/im-ethz/flirt

Quick example

Generate a comprehensive set of features for an Empatica E4 data archive with a single line of code 🚀

import flirt
features = flirt.with_.empatica('./1234567890_A12345.zip')

Check out the documentation and exemplary Jupyter notebooks.

Roadmap

Things FLIRT will be able to do in the future:

  • Use FLIRT with Oura's smart ring and other consumer-grade wearable devices
  • Use FLIRT with Apple Health to derive meaningful features from long-term data recordings
  • Feature generation for additional sensor modalities such as: blood oxygen saturation, blood volume changes, respiration rate, and step counts

People

Made with ❤️ at ETH Zurich.
Check out all authors.

In collaboration with the Digital Biomarker Discovery Pipeline.

FAQs

  • How does FLIRT distinguish from other physiological data processing packages such as neurokit?
    While FLIRT works with physiological data like other packages, it places special emphasis on the inherent challenges of data processing obtained from (consumer) wearable devices such as smartwaches instead of professional, medical-grade recording devices such as ECGs or EEGs. As an example, when processing data from smartwatches, one could be confronted with inaccurate data, which needs artifact removal, or measurement gaps, which need to be dealt with.

Citation

Original article: FLIRT: A Feature Generation Toolkit for Wearable Data

@article{flirt2021,
  title={{{FLIRT}}: A {{Feature Generation Toolkit}} for {{Wearable Data}}},
  author={Föll, Simon and Maritsch, Martin and Spinola, Federica and Mishra, Varun and Barata, Filipe and Kowatsch, Tobias and Fleisch, Elgar and Wortmann, Felix},
  year={2021},
  journal={Computer Methods and Programs in Biomedicine},
  doi={10.1016/j.cmpb.2021.106461},
}

flirt's People

Contributors

adrian-lison avatar masquare avatar sfsouthpalatinate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flirt's Issues

Project unmaintained?

Is the project being maintained?

There have been open issues and pull requests for a long time.

Terminology for "lineintegral" feature

Heyhey,

This issue was initiated by a discussion in which Felix was confused by usage of the phrase "lineintegral" instead of just an integral. As we understood it, line integral is usually over multi-dimensional field/vector/line or along a curve. In the flirt package, I think the integral is only calculated for 1D lines right? (HRV, EDA, ACC-x, ACC-y, ACC-z, ACC-l2, etc.), so we think it should be called integral instead of line integral. Let me know if this is not the case, then I don't have to update my figures ;)

Cheers,
Eva

Unattributed Source Code?

Hi,

I was looking at your code base today and wanted to use your __cvx_eda implementation. After looking around online I found what looks to be an original implementation which isn't attributed in your code. Furthermore, the original source uses a GPL license which I believe asks that people who use the code also use a GPL license in addition to attributing the code. Anyway, I could be missing something so I just wanted to point it out on here.

Thanks

EDA features not being extracted

Hello,

I'm having trouble extracting EDA features with the WESAD dataset and flirt. Here is a reprex:

import pathlib
import zipfile
import tempfile

import flirt

def test_extract_features_e4(WESAD_zip_path, subject_index=0, hrv=True, eda=True):
    '''
    args:
        WESAD_zip_path: str path to your WESAD zip file
        subject_index: int which subject to extract, between 0 and 14
        hrv: bool passed to get_features_for_empatica_archive -> hrv_features
        eda: bool passed to get_features_for_empatica_archive -> eda_features
    '''
    with zipfile.ZipFile(WESAD_zip_path, mode="r") as archive:
    
        e4s=[x for x in archive.namelist() if "E4_Data" in x]
        
        target=e4s[subject_index]
        
        with tempfile.TemporaryDirectory() as tmpdirname:
            print("extracting ", target)
            archive.extract(target, path=tmpdirname)

            e4_zip = [x for x in pathlib.Path(tmpdirname).rglob('*.*')].pop()
            features = flirt.simple.get_features_for_empatica_archive(e4_zip, 60, 10, hrv_features=hrv, eda_features=hrv, acc_features=False)
            
            

    archive.close()
    return features

## here, put the path to your full WESAD zip file download; no need to extract
download_path = pathlib.Path("~/Downloads/WESAD.zip").expanduser()

# run flirt
test_extract_features_e4(download_path, subject_index=0, hrv=False)

Output:

extracting  WESAD/S10/S10_E4_Data.zip
Received empty input features, returning empty df

Similarly, if I unzip the files and run the EDA module directly:

eda = flirt.reader.empatica.read_eda_file_into_df("/Users/tinashetapera/Downloads/WESAD/S8/S8_E4_Data/EDA.csv")
flirt.get_eda_features(eda['eda'], 250, 5)

image

I downloaded the dataset from here and it should be identical to the paper. Colleagues of mine have successfully extracted both HRV and EDA features with no trouble.

I believe it may be a Mac M2 issue as there doesn't seem to be any other reasonable explanation, but please let me know what configurations you'd like to check against.

Setup:
Macbook Air M2
OSX Ventura 13.0
miniconda: conda 4.14.0
Python: Python 3.10.6
flirt:

pip show flirt
Name: flirt
Version: 0.0.2
Summary: Wearable Data Processing Toolkit
Home-page: https://github.com/im-ethz/flirt
Author: ETH Zurich – Chair of Information Management
Author-email: 
License: MIT
Location: /opt/homebrew/Caskroom/miniconda/base/envs/hinf5300/lib/python3.10/site-packages
Requires: astropy, cvxopt, ishneholterlib, joblib, numba, numpy, pandas, scipy, tqdm
Required-by: 

Thanks in advance for any help you can provide!

NumbaDeprecationWarning

Python 3.11.3
Numba: 0.57.1

flirt/lib/entropy/fractal.py:106: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.