Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial release, new features, and bug fix #75

Merged
merged 23 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5325d25
fix: add missing https:// in the issue-template config file;
WenjieDu Apr 22, 2023
44335be
Add unit-test cases for `pypots-cli` (#72)
WenjieDu Apr 23, 2023
d84e595
fix: only report coverage if file .coverage exists;
WenjieDu Apr 23, 2023
a54cea3
Merge branch 'main' into dev
WenjieDu Apr 23, 2023
07128b4
fix: remove cli-testing case of show-coverage to avoid mis-calculation;
WenjieDu Apr 23, 2023
dd6b793
fix: must not delete .coverage file after testing;
WenjieDu Apr 23, 2023
568b3c5
Fix bugs in the code-coverage report (#73)
WenjieDu Apr 23, 2023
f330f85
feat: default disabling early-stopping mechanism during model training;
WenjieDu Apr 24, 2023
c27f22c
fix: return correct val_X and test_X in gene_physionet2012() when art…
WenjieDu Apr 24, 2023
ea04dd6
feat: add pypots.random.set_random_seed();
WenjieDu Apr 24, 2023
0787260
feat: enable `return_labels` in Dataset classes;
WenjieDu Apr 24, 2023
895f9bc
refactor: remove autoflake that is not quite useful;
WenjieDu Apr 25, 2023
504bdd0
feat: enable automatically saving model into file if necessary;
WenjieDu Apr 25, 2023
e2485de
fix: remove typing.Literal which is not supported in python 3.7;
WenjieDu Apr 25, 2023
922bbfb
fix: the disordered labels in the returned data;
WenjieDu Apr 25, 2023
c7b6e26
fix: mistaken logical code in auto_save_model_if_necessary;
WenjieDu Apr 25, 2023
ea560d4
Add devcontainer config (#76)
WenjieDu Apr 27, 2023
4df32de
fix: set return_labels=False for training Dataset for CRLI and VaDER;
WenjieDu Apr 27, 2023
baab39e
feat: add git stale config file;
WenjieDu Apr 27, 2023
cce28bd
doc: remove tutorials dir, will create a new repo to put all tutorials;
WenjieDu Apr 27, 2023
4b25fb6
fix: remove tutorials from checking;
WenjieDu Apr 27, 2023
1f42c77
feat: add jupyterlab as a dev dependency, update README;
WenjieDu Apr 27, 2023
39b2bbe
doc: update README to add the link of BrewedPOTS;
WenjieDu Apr 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Some IDEs or editors like PhCharm may not support comments in JSON files, but it is still valid JSON.
// About configurations for GitHub codebase, please refer to
// https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/setting-up-your-python-project-for-codespaces

{
"name": "PyPOTS developing environment",

"image": "mcr.microsoft.com/devcontainers/universal:2",

"features": {
"ghcr.io/devcontainers/features/conda:1": {},
},

// Please select the machine type with 4GB memory, otherwise the conda command below will exit with code 137,
// which is out of memory.
"postCreateCommand": "conda env create -f environment-dev.yml",
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ blank_issues_enabled: true
version: 2.1
contact_links:
- name: PyPOTS Community on Slack
url: pypots-dev.slack.com
url: https://pypots-dev.slack.com
about: General usage questions, community discussions, and the development team are here.
22 changes: 22 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 7

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 3

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- keep

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
7 changes: 4 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ jobs:

- name: Test with pytest
run: |
# run tests separately here due to Segmentation Fault in test_clustering when run all in
# run tests separately here due to Segmentation Fault in test_clustering when run all in
# one command with `pytest` on MacOS. Bugs not caught, so this is a trade-off to avoid SF.
python -m pytest -rA pypots/tests/test_classification.py -n auto --cov=pypots --dist=loadgroup
python -m pytest -rA pypots/tests/test_classification.py -n auto --cov=pypots --dist=loadgroup
python -m pytest -rA pypots/tests/test_imputation.py -n auto --cov=pypots --cov-append --dist=loadgroup
python -m pytest -rA pypots/tests/test_clustering.py -n auto --cov=pypots --cov-append --dist=loadgroup
python -m pytest -rA pypots/tests/test_forecasting.py -n auto --cov=pypots --cov-append --dist=loadgroup
python -m pytest -rA pypots/tests/test_data.py -n auto --cov=pypots --cov-append --dist=loadgroup
python -m pytest -rA pypots/tests/test_utils.py -n auto --cov=pypots --cov-append --dist=loadgroup
python -m pytest -rA pypots/tests/test_cli.py -n auto --cov=pypots --cov-append --dist=loadgroup

- name: Generate the LCOV report
run: |
Expand All @@ -58,4 +59,4 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: 'coverage.lcov'
path-to-lcov: 'coverage.lcov'
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ repos:
- id: end-of-file-fixer
- id: check-yaml

# hooks for optimizing imports
- repo: https://github.com/PyCQA/autoflake
rev: v2.1.1
hooks:
- id: autoflake
args: [
--check,
--remove-all-unused-imports,
]

# hooks for linting code
- repo: https://github.com/psf/black
rev: 22.10.0
Expand Down
106 changes: 64 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,61 @@
**<p align="center">A Python Toolbox for Data Mining on Partially-Observed Time Series</p>**

<p align="center">
<img alt="Python version" src="https://img.shields.io/badge/Python->v3.6-yellow?color=88ada6">
<img alt="powered by Pytorch" src="https://img.shields.io/static/v1?label=PyTorch&message=%E2%9D%A4%EF%B8%8F&color=bbcdc5&logo=pytorch">
<img alt="Python version" src="https://img.shields.io/badge/Python-v3.7--3.10-88ada6?logo=python&logoColor=white">
<img alt="powered by Pytorch" src="https://img.shields.io/badge/PyTorch-❤️-bbcdc5?logo=pytorch&logoColor=white">
<a href="https://pypi.org/project/">
<img alt="the latest release version" src="https://img.shields.io/github/v/release/wenjiedu/pypots?color=e0eee8&include_prereleases&label=Release">
</a>
<a href="https://github.com/WenjieDu/PyPOTS/blob/main/LICENSE">
<img alt="GPL3 license" src="https://img.shields.io/badge/License-GPL--v3-c0ebd7">
</a>
<a href="https://join.slack.com/t/pypots-dev/shared_invite/zt-1gq6ufwsi-p0OZdW~e9UW_IA4_f1OfxA">
<img alt="Slack Workspace" src="https://img.shields.io/badge/Slack-PyPOTS-grey?logo=slack&color=7bcfa6">
<a href="https://github.com/WenjieDu/PyPOTS/blob/main/README.md#-community">
<img alt="Community" src="https://img.shields.io/badge/join_us-community!-7fecad">
</a>
<a href="https://github.com/sponsors/WenjieDu">
<img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/wenjiedu?label=Sponsors&color=7fecad&logo=githubsponsors">
<img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/wenjiedu?label=Sponsors&color=7bcfa6&logo=githubsponsors">
</a>
<a href="https://github.com/WenjieDu/PyPOTS/stargazers">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/wenjiedu/pypots?logo=Github&color=7bcfa6&label=Stars">
</a>
<a href="https://github.com/WenjieDu/PyPOTS/forks">
<img alt="GitHub Repo forks" src="https://img.shields.io/github/forks/wenjiedu/pypots?logo=Github&color=2edfa3&label=Forks">
</a>
<a href="https://github.com/WenjieDu/PyPOTS">
<img alt="Repo size" src="https://img.shields.io/github/repo-size/WenjieDu/PyPOTS?color=25f8cb&label=Repo%20Size&logo=Github">
<a href="https://codeclimate.com/github/WenjieDu/PyPOTS">
<img alt="Code Climate maintainability" src="https://img.shields.io/codeclimate/maintainability-percentage/WenjieDu/PyPOTS?color=25f8cb&label=Maintainability&logo=codeclimate">
</a>
<a href="https://coveralls.io/github/WenjieDu/PyPOTS">
<a href="https://coveralls.io/github/WenjieDu/PyPOTS">
<img alt="Coveralls coverage" src="https://img.shields.io/coverallsCoverage/github/WenjieDu/PyPOTS?branch=main&logo=coveralls&color=00e09e&label=Coverage">
</a>
<a href="https://anaconda.org/conda-forge/pypots">
<img alt="Conda downloads" src="https://img.shields.io/conda/dn/conda-forge/pypots?label=Conda%20Downloads&color=48c0a3">
<a href="https://github.com/WenjieDu/PyPOTS/actions/workflows/testing.yml">
<img alt="GitHub Testing" src="https://img.shields.io/github/actions/workflow/status/wenjiedu/pypots/testing.yml?logo=github&color=48c0a3&label=CI">
</a>
<a href="https://pypi.org/project/pypots">
<img alt="PyPI downloads" src="https://static.pepy.tech/personalized-badge/pypots?period=total&units=international_system&left_color=grey&right_color=teal&left_text=PyPI%20Downloads">
<a href="https://doi.org/10.5281/zenodo.6823221">
<img alt="Zenodo DOI" src="https://img.shields.io/badge/DOI-10.5281/zenodo.6823221-21a675">
</a>
<a href="https://github.com/WenjieDu/PyPOTS/actions/workflows/testing.yml">
<img alt="GitHub Testing" src="https://github.com/WenjieDu/PyPOTS/actions/workflows/testing.yml/badge.svg">
<a href="https://anaconda.org/conda-forge/pypots">
<img alt="Conda downloads" src="https://img.shields.io/conda/dn/conda-forge/pypots?label=Conda%20Downloads&color=057748&logo=anaconda&logoColor=white">
</a>
<a href="https://doi.org/10.5281/zenodo.6823221">
<img alt="Zenodo DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.6823221.svg">
<a href="https://pypi.org/project/pypots">
<img alt="PyPI downloads" src="https://static.pepy.tech/personalized-badge/pypots?period=total&units=international_system&left_color=grey&right_color=teal&left_text=PyPI%20Downloads&logo=github">
</a>

</p>

⦿ `Motivation`: Due to all kinds of reasons like failure of collection sensors, communication error, and unexpected malfunction, missing values are common to see in time series from the real-world environment. This makes partially-observed time series (POTS) a pervasive problem in open-world modeling and prevents advanced data analysis. Although this problem is important, the area of data mining on POTS still lacks a dedicated toolkit. PyPOTS is created to fill in this blank.

⦿ `Mission`: PyPOTS is born to become a handy toolbox that is going to make data mining on POTS easy rather than tedious, to help engineers and researchers focus more on the core problems in their hands rather than on how to deal with the missing parts in their data. PyPOTS will keep integrating classical and the latest state-of-the-art data mining algorithms for partially-observed multivariate time series. For sure, besides various algorithms, PyPOTS is going to have unified APIs together with detailed documentation and interactive examples across algorithms as tutorials.

<a href="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/WenjieDu/TSDB"><img src="https://raw.githubusercontent.com/WenjieDu/TSDB/main/docs/_static/figs/TSDB_logo.svg?sanitize=true" align="left" width="160"/></a>
To make various open-source time-series datasets readily available to our users, PyPOTS gets supported by project [TSDB (Time-Series Data Base)](https://github.com/WenjieDu/TSDB), a toolbox making loading time-series datasets super easy!
<a href="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/WenjieDu/TSDB"><img src="https://raw.githubusercontent.com/WenjieDu/TSDB/main/docs/_static/figs/TSDB_logo.svg?sanitize=true" align="left" width="160" alt="TSDB logo"/></a>
To make various open-source time-series datasets readily available to our users, PyPOTS gets supported by project [TSDB (Time-Series Data Base)](https://github.com/WenjieDu/TSDB), a toolbox making loading time-series datasets super easy!

Visit [TSDB](https://github.com/WenjieDu/TSDB) right now to know more about this handy tool 🛠! It now supports a total of 119 open-source datasets.
<br clear="left">


## ❖ Installation
PyPOTS now is available on <a href="https://anaconda.org/conda-forge/pypots"><img alt="on Anaconda" align="center"
src="https://img.shields.io/badge/Anaconda--lightgreen?style=social&logo=anaconda"></a>❗️
PyPOTS now is available on <a href="https://anaconda.org/conda-forge/pypots"><img alt="on Anaconda" align="center"
src="https://img.shields.io/badge/Anaconda--lightgreen?style=social&logo=anaconda"></a>❗️

Install it with `conda install pypots`, you may need to specify the channel with option `-c conda-forge`

Expand All @@ -66,8 +68,21 @@ Install the latest release from PyPI:
or install from the source code with the latest features not officially released in a version:
> pip install https://github.com/WenjieDu/PyPOTS/archive/main.zip

<details open>
<summary><b>Below is an example applying SAITS in PyPOTS to impute missing values in the dataset PhysioNet2012:</b></summary>

## ❖ Usage
<a href="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/WenjieDu/BrewedPOTS"><img src="https://raw.githubusercontent.com/WenjieDu/BrewedPOTS/main/figs/BrewedPOTS_logo.jpg" align="left" width="160" alt="BrewedPOTS logo"/></a>
PyPOTS tutorials have been released. Considering the future workload on it, I separate the tutorials into a single repo,
and you can find them in [BrewedPOTS](https://github.com/WenjieDu/BrewedPOTS).

If you have further questions, please refer to PyPOTS documentation [📑http:https://pypots.readthedocs.io](http:https://pypots.readthedocs.io).
Besides, you can also
[raise an issue](https://github.com/WenjieDu/PyPOTS/issues) or
[ask in our community](#-community).

We present you a usage example of imputing missing values in time series with PyPOTS below, you can click it to view.

<details>
<summary><b>Click here to see an example applying SAITS on PhysioNet2012 for imputation:</b></summary>

``` python
import numpy as np
Expand All @@ -93,12 +108,13 @@ mae = cal_mae(imputation, X_intact, indicating_mask) # calculate mean absolute
```
</details>


## ❖ Available Algorithms
PyPOTS supports imputation, classification, clustering, and forecasting tasks on multivariate time series with missing values. The currently available algorithms of four tasks are cataloged in the following table with four partitions. The paper references are all listed at the bottom of this readme file. Please refer to them if you want more details.

| ***`Imputation`*** | 🚥 | 🚥 | 🚥 |
|:----------------------:|:------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------:|
| **Type** | **Abbr.** | **Full name of the algorithm/model/paper** | **Year** |
| **Type** | **Abbr.** | **Full name of the algorithm/model/paper** | **Year** |
| Neural Net | SAITS | Self-Attention-based Imputation for Time Series [^1] | 2023 |
| Neural Net | Transformer | Attention is All you Need [^2];<br>Self-Attention-based Imputation for Time Series [^1];<br><sub>Note: proposed in [^2], and re-implemented as an imputation model in [^1].</sub> | 2017 |
| Neural Net | BRITS | Bidirectional Recurrent Imputation for Time Series [^3] | 2018 |
Expand All @@ -118,9 +134,9 @@ PyPOTS supports imputation, classification, clustering, and forecasting tasks on


## ❖ Citing PyPOTS
We are pursuing to publish a short paper introducing PyPOTS in prestigious academic venues, e.g. JMLR (track for
[Machine Learning Open Source Software](https://www.jmlr.org/mloss/)). Before that, PyPOTS is using its DOI from Zenodo
for reference. If you use PyPOTS in your research, please cite it as below and 🌟star this repository to make others
We are pursuing to publish a short paper introducing PyPOTS in prestigious academic venues, e.g. JMLR (track for
[Machine Learning Open Source Software](https://www.jmlr.org/mloss/)). Before that, PyPOTS is using its DOI from Zenodo
for reference. If you use PyPOTS in your research, please cite it as below and 🌟star this repository to make others
notice this work. 🤗

```bibtex
Expand All @@ -136,21 +152,31 @@ doi = {10.5281/zenodo.6823221},

or

`Wenjie Du. (2022).
PyPOTS: A Python Toolbox for Data Mining on Partially-Observed Time Series.
`Wenjie Du. (2022).
PyPOTS: A Python Toolbox for Data Mining on Partially-Observed Time Series.
Zenodo. https://doi.org/10.5281/zenodo.6823221`


## ❖ Community
We care about the feedback from our users, so we're building PyPOTS community on

- [Slack](https://pypots-dev.slack.com);
- [WeChat (微信公众号)](https://mp.weixin.qq.com/s/m6j83SJNgz-xySSZd-DTBw). We also run a group chat on WeChat, and you can get the QR code from the official account after following it;

If you have any suggestions or want to contribute ideas or share time-series related papers, join us and tell.
PyPOTS community is open, transparent, and surely friendly. Let's work together to build and improve PyPOTS 💪!


## ❖ Contribution
You're very welcome to contribute to this exciting project!
You're very welcome to contribute to this exciting project!

By committing your code, you'll
- make your well-established model out-of-the-box for PyPOTS users to run;
- be listed as one of [PyPOTS contributors](https://github.com/WenjieDu/PyPOTS/graphs/contributors): <a href="https://github.com/wenjiedu/pypots/graphs/contributors"><img align="center" src="https://contrib.rocks/image?repo=wenjiedu/pypots"></a>;
- get mentioned in our [release notes](https://github.com/WenjieDu/PyPOTS/releases);
You can also contribute to PyPOTS by simply staring🌟 this repo to help more people notice it.
Your star is your recognition to PyPOTS, and it matters!
1. make your well-established model out-of-the-box for PyPOTS users to run (Similar to [**Scikit-learn**](https://scikit-learn.org/stable/faq.html#what-are-the-inclusion-criteria-for-new-algorithms), we set current inclusion criteria as: the paper should be published for at least 1 year, have 10+ citations, and the usefulness to our users can be claimed);
2. be listed as one of [PyPOTS contributors](https://github.com/WenjieDu/PyPOTS/graphs/contributors): <a href="https://github.com/wenjiedu/pypots/graphs/contributors"><img align="center" src="https://contrib.rocks/image?repo=wenjiedu/pypots"></a>;
3. get mentioned in our [release notes](https://github.com/WenjieDu/PyPOTS/releases);

You can also contribute to PyPOTS by simply staring🌟 this repo to help more people notice it.
Your star is your recognition to PyPOTS, and it matters!

<details open>
<summary><b><i>👏 Click here to view PyPOTS stargazers and forkers.<br>We're so proud to have more and more awesome users, as well as more bright ✨stars: </i></b></summary>
Expand All @@ -160,13 +186,9 @@ Your star is your recognition to PyPOTS, and it matters!


## ❖ Attention 👀
The documentation and tutorials are under construction.

‼️ PyPOTS is currently under developing. If you like it and look forward to its growth, <ins>please give PyPOTS a star
and watch it to keep you posted on its progress and to let me know that its development is meaningful</ins>. If you have
any feedback, or want to contribute ideas/suggestions or share time-series related algorithms/papers, please join PyPOTS
community and chat on <a href="https://join.slack.com/t/pypots-dev/shared_invite/zt-1gq6ufwsi-p0OZdW~e9UW_IA4_f1OfxA"><img alt="Slack Workspace" align="center" src="https://img.shields.io/badge/Slack-join_us!-grey?logo=slack&color=teal"></a>,
or create an issue. If you have any additional questions or have interests in collaboration, please take a look at
‼️ PyPOTS is currently under developing. If you like it and look forward to its growth, <ins>please give PyPOTS a star
and watch it to keep you posted on its progress and to let me know that its development is meaningful</ins>.
If you have any additional questions or have interests in collaboration, please take a look at
[my GitHub profile](https://github.com/WenjieDu) and feel free to contact me 🤝.

Thank you all for your attention! 😃
Expand Down
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ dependencies:
- conda-forge::black
- conda-forge::flake8
- conda-forge::pre-commit
- conda-forge::jupyterlab
Loading