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

Add FEDformer as an imputation model #330

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
- conda-forge::h5py
- conda-forge::numpy
- conda-forge::scipy
- conda-forge::sympy
- conda-forge::python
- conda-forge::einops
- conda-forge::pandas
Expand All @@ -26,8 +27,8 @@ dependencies:

# optional
- pyg::pyg
- pyg::pytorch-scatter
- pyg::pytorch-sparse
- pyg::pytorch-scatter

# test
- conda-forge::pytest-cov
Expand Down
2 changes: 2 additions & 0 deletions pypots/imputation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .transformer import Transformer
from .timesnet import TimesNet
from .etsformer import ETSformer
from .fedformer import FEDformer
from .crossformer import Crossformer
from .autoformer import Autoformer
from .dlinear import DLinear
Expand All @@ -30,6 +31,7 @@
"SAITS",
"Transformer",
"ETSformer",
"FEDformer",
"Crossformer",
"TimesNet",
"PatchTST",
Expand Down
17 changes: 17 additions & 0 deletions pypots/imputation/fedformer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
The package of the partially-observed time-series imputation model FEDformer.

Refer to the paper "Wu, H., Xu, J., Wang, J., & Long, M. (2021).
FEDformer: Decomposition transformers with auto-correlation for long-term series forecasting. NeurIPS 2021.".

"""

# Created by Wenjie Du <wenjay.du@gmail.com>
# License: BSD-3-Clause


from .model import FEDformer

__all__ = [
"FEDformer",
]
24 changes: 24 additions & 0 deletions pypots/imputation/fedformer/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Dataset class for FEDformer.
"""

# Created by Wenjie Du <wenjay.du@gmail.com>
# License: BSD-3-Clause

from typing import Union

from ..saits.data import DatasetForSAITS


class DatasetForFEDformer(DatasetForSAITS):
"""Actually FEDformer uses the same data strategy as SAITS, needs MIT for training."""

def __init__(
self,
data: Union[dict, str],
return_X_ori: bool,
return_labels: bool,
file_type: str = "h5py",
rate: float = 0.2,
):
super().__init__(data, return_X_ori, return_labels, file_type, rate)
Loading
Loading