• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WenjieDu / PyPOTS / 4676447045

pending completion
4676447045

Pull #48

github

GitHub
Merge 30b47daba into ce199d307
Pull Request #48: Add the lint-code workflow and pypots-cli to help development

79 of 79 new or added lines in 7 files covered. (100.0%)

2854 of 3389 relevant lines covered (84.21%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.33
/pypots/data/load_specific_datasets.py
1
"""
1✔
2
Functions to load supported open-source time-series datasets.
3
"""
4

5
# Created by Wenjie Du <wenjay.du@gmail.com>
6
# License: GLP-v3
7

8

9
import tsdb
1✔
10

11
from pypots.data.load_preprocessing import preprocess_physionet2012
1✔
12
from pypots.utils.logging import logger
1✔
13

14
# currently supported datasets
15
SUPPORTED_DATASETS = [
1✔
16
    "physionet_2012",
17
]
18

19
# preprocessing functions of the supported datasets
20
PREPROCESSING_FUNC = {
1✔
21
    "physionet_2012": preprocess_physionet2012,
22
}
23

24

25
def list_supported_datasets() -> list:
1✔
26
    """Return the datasets natively supported by PyPOTS so far.
27

28
    Returns
29
    -------
30
    SUPPORTED_DATASETS : list,
31
        A list including all supported datasets.
32

33
    """
34
    return SUPPORTED_DATASETS
×
35

36

37
def load_specific_dataset(dataset_name: str, use_cache: bool = True) -> dict:
1✔
38
    """Load specific datasets supported by PyPOTS.
39
    Different from tsdb.load_dataset(), which only produces merely raw data,
40
    load_specific_dataset here does some preprocessing operations,
41
    like truncating time series to generate samples with the same length.
42

43
    Parameters
44
    ----------
45
    dataset_name : str,
46
        The name of the dataset to be loaded, which should be supported, i.e. in SUPPORTED_DATASETS.
47

48
    use_cache :
49
        Whether to use cache. This is an argument of tsdb.load_dataset().
50

51
    Returns
52
    -------
53
    data : dict,
54
        A dict contains the preprocessed dataset.
55
        Users only need to continue the preprocessing steps to generate the data they want,
56
        e.g. standardizing and splitting.
57

58
    """
59
    logger.info(
×
60
        f"Loading the dataset {dataset_name} with TSDB (https://github.com/WenjieDu/Time_Series_Database)..."
61
    )
62
    assert dataset_name in SUPPORTED_DATASETS, (
×
63
        f"Dataset {dataset_name} is not supported. "
64
        f"If you believe this dataset is valuable to be supported by PyPOTS,"
65
        f"please create an issue on GitHub "
66
        f"https://github.com/WenjieDu/PyPOTS/issues"
67
    )
68
    logger.info(f"Starting preprocessing {dataset_name}...")
×
69
    data = tsdb.load_dataset(dataset_name, use_cache)
×
70
    data = PREPROCESSING_FUNC[dataset_name](data)
×
71
    return data
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc