Preprocessor
Baseclass for preprocessing as well as the preprocessing classes for the supported datasets.
- class ecgan.preprocessing.preprocessor.BasePreprocessor(cfg, dataset_name)[source]
Bases:
abc.ABCBase class for preprocessors.
Generally, preprocessors expect data to be in
<target_dir>/<dataset_name>/raw(e.g.data/mitbih/raw) withtarget_dirbeing given in the config. Processed data should always be saved asdata.pklandlabel.pklinto<target_dir>/<dataset_name>/processed(e.g.data/mitbih/processed).- Parameters
cfg (
PreprocessingConfig) -- Configuration determining data source and desired preprocessing.dataset_name (
str) -- Name of dataset which has to be preprocessed.
- class ecgan.preprocessing.preprocessor.ExtractedBeatsPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the MITBIH/PTB dataset to retrieve beatwise segmented data.
The data is already preprocessed according to Kachuee et al. 2018.
- preprocess()[source]
Preprocess the dataset.
Load the raw CSV data, reshape the univariate series into multivariate series, extract labels, call the _preprocess_worker to cleanse and resample the data. Each initial raw sample has 187 values and contains the label in the last column.
- Return type
Tuple[ndarray,ndarray]- Returns
Tuple of data and labels in a framework compatible format.
- class ecgan.preprocessing.preprocessor.MitbihExtractedBeatsPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.ExtractedBeatsPreprocessorPreprocess the MITBIH dataset from Kachuee et al. 2018.
- class ecgan.preprocessing.preprocessor.PtbExtractedBeatsPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.ExtractedBeatsPreprocessorPreprocess the PTB dataset from Kachuee et al. 2018.
- class ecgan.preprocessing.preprocessor.CMUMoCapPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the CMU MoCap subset used in Zhou et al. 2019.
- preprocess()[source]
Preprocess the dataset.
Load the raw CSV data, reshape the univariate series into multivariate series, extract labels, call the _preprocess_worker to cleanse and resample the data.
Data is sampled as described in Zhou et al. 2019.
- Return type
Tuple[ndarray,ndarray]- Returns
Tuple of data and labels in a framework compatible format.
- class ecgan.preprocessing.preprocessor.ExtendedCMUMoCapPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.CMUMoCapPreprocessorPreprocess the CMU MoCap subset used in Zhou et al. 2019.
The original dataset by Zhou et al. is extended an additional class _dancing_.
- preprocess()[source]
Preprocess the dataset.
Load the raw CSV data, reshape the univariate series into multivariate series, extract labels, call the _preprocess_worker to cleanse and resample the data.
Data is sampled as described in Zhou et al. 2019. Extended data of class _dancing_ is sampled same as the _walking_ class in the original.
- Return type
Tuple[ndarray,ndarray]- Returns
Tuple of data and labels in a framework compatible format.
- class ecgan.preprocessing.preprocessor.ElectricDevicesPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the Electric Devices Dataset from TODO.
- class ecgan.preprocessing.preprocessor.WaferPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the Electric Devices Dataset from TODO.
- class ecgan.preprocessing.preprocessor.MitbihBeatganPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the MITBIH dataset from Zhou et al. 2019.
- preprocess()[source]
Preprocess the MITBIH BEATGAN dataset.
Since the data itself is already preprocessed according to the paper, data classes are concatenated, reshaped and labeled according to the format used in ECGAN. Data can be additionally resampled, additional cleansing is not supported.
It can be useful to remove the second dim (the second feature) since the leads differ across many series.
Warning
The data has not been validated and might be erroneous.
- Return type
Tuple[ndarray,ndarray]
- class ecgan.preprocessing.preprocessor.ShaoxingPreprocessor(cfg, dataset_name)[source]
Bases:
ecgan.preprocessing.preprocessor.BasePreprocessorPreprocess the Shaoxing dataset from Zheng et al. 2020.