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

Update the docs for TimeMixer #500

Merged
merged 27 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e9b9b03
docs: update README_zh;
WenjieDu Jun 26, 2024
a385c56
docs: update docs;
WenjieDu Jul 1, 2024
f2c73a5
Merge branch 'dev' into (docs)update
WenjieDu Jul 24, 2024
7a15e04
docs: update the docs;
WenjieDu Jul 24, 2024
a8631ee
docs: update docs;
WenjieDu Jul 25, 2024
04008dc
docs: update the install page;
WenjieDu Jul 26, 2024
4c143c5
docs: add lib logos;
WenjieDu Jul 28, 2024
2acf54d
docs: update docs;
WenjieDu Aug 11, 2024
0ad8c52
Merge branch 'dev' into (docs)update
WenjieDu Aug 11, 2024
0bb727b
fix: try to upgrade doc building env;
WenjieDu Aug 11, 2024
f792204
docs: update docs;
WenjieDu Aug 13, 2024
3570ad7
docs: update milestones;
WenjieDu Aug 13, 2024
94280be
docs: update docs;
WenjieDu Aug 14, 2024
42a93e2
no message
WenjieDu Aug 14, 2024
2d089d3
docs: update docs;
WenjieDu Aug 14, 2024
3465e9f
tsdb.load_dataset to tsdb.load
eroell Aug 15, 2024
a6b515e
Merge pull request #494 from eroell/doc/tsdb-load
WenjieDu Aug 15, 2024
7b8b55a
docs: update readme files;
WenjieDu Aug 19, 2024
ec508a6
Doc update Quickstart Example (#497)
eroell Aug 22, 2024
d06187d
docs: update readme files;
WenjieDu Aug 29, 2024
bcec72a
Merge branch 'main' into (docs)update
WenjieDu Aug 29, 2024
e1f3376
docs: update docs;
WenjieDu Sep 3, 2024
942cdb2
docs: add the icon for Jetbrains IDEA;
WenjieDu Sep 3, 2024
c96294a
docs: add TimeMixer docs;
WenjieDu Sep 3, 2024
e8e127c
docs: add TimeMixer into README;
WenjieDu Sep 3, 2024
57d9789
Merge branch 'dev' into (docs)update
WenjieDu Sep 3, 2024
6f6714f
test: make the TimeMixer smaller for a faster test;
WenjieDu Sep 3, 2024
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
Binary file added .idea/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 45 additions & 42 deletions README.md

Large diffs are not rendered by default.

87 changes: 45 additions & 42 deletions README_zh.md

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ You can also find a simple and quick-start tutorial notebook on Google Colab

# Data preprocessing. Tedious, but PyPOTS can help. 🤓
data = load_specific_dataset('physionet_2012') # PyPOTS will automatically download and extract it.
X = data['X']
num_samples = len(X['RecordID'].unique())
X = X.drop(['RecordID', 'Time'], axis = 1)
X = StandardScaler().fit_transform(X.to_numpy())
X = X.reshape(num_samples, 48, -1)
X = data['train_X']
num_samples = len(X)
X = StandardScaler().fit_transform(X.reshape(-1, X.shape[-1])).reshape(X.shape)
X_ori = X # keep X_ori for validation
X = mcar(X, 0.1) # randomly hold out 10% observed values as ground truth
dataset = {"X": X} # X for model input
print(X.shape) # (11988, 48, 37), 11988 samples, 48 time steps, 37 features
print(X.shape) # (7671, 48, 37), 7671 samples, 48 time steps, 37 features

# initialize the model
saits = SAITS(
Expand All @@ -55,7 +53,7 @@ You can also find a simple and quick-start tutorial notebook on Google Colab
model_saving_strategy="best", # only save the model with the best validation performance
)

# train the model. Here I use the whole dataset as the training set, because ground truth is not visible to the model.
# train the model. Here I consider the train dataset only, and evaluate on it, because ground truth is not visible to the model.
saits.fit(dataset)
# impute the originally-missing values and artificially-missing values
imputation = saits.impute(dataset)
Expand All @@ -64,6 +62,6 @@ You can also find a simple and quick-start tutorial notebook on Google Colab
mae = calc_mae(imputation, np.nan_to_num(X_ori), indicating_mask) # calculate mean absolute error on the ground truth (artificially-missing values)

# the best model has been already saved, but you can still manually save it with function save_model() as below
saits.save_model(saving_dir="examples/saits",file_name="manually_saved_saits_model")
saits.save(saving_path="examples/saits/manually_saved_saits_model")
# you can load the saved model into a new initialized model
saits.load_model("examples/saits/manually_saved_saits_model")
saits.load("examples/saits/manually_saved_saits_model.pypots")
6 changes: 4 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ The paper references are all listed at the bottom of this readme file.
+----------------+-----------------------------------------------------------+------+------+------+------+------+-----------------------+
| Type | Algorithm | IMPU | FORE | CLAS | CLUS | ANOD | Year - Venue |
+================+===========================================================+======+======+======+======+======+=======================+
| Neural Net | ImputeFormer :cite:`nie2024imputeformer` | ✅ | | | | | ``2024 - KDD`` |
| Neural Net | TimeMixer :cite:`wang2024timemixer` | ✅ | | | | | ``2024 - ICLR`` |
+----------------+-----------------------------------------------------------+------+------+------+------+------+-----------------------+
| Neural Net | iTransformer🧑‍🔧 :cite:`liu2024itransformer` | ✅ | | | | | ``2024 - ICLR`` |
+----------------+-----------------------------------------------------------+------+------+------+------+------+-----------------------+
| Neural Net | ImputeFormer :cite:`nie2024imputeformer` | ✅ | | | | | ``2024 - KDD`` |
+----------------+-----------------------------------------------------------+------+------+------+------+------+-----------------------+
| Neural Net | SAITS :cite:`du2023SAITS` | ✅ | | | | | ``2023 - ESWA`` |
+----------------+-----------------------------------------------------------+------+------+------+------+------+-----------------------+
| Neural Net | FreTS🧑‍🔧 :cite:`yi2023frets` | ✅ | | | | | ``2023 - NeurIPS`` |
Expand Down Expand Up @@ -333,7 +335,7 @@ By committing your code, you'll
`pypots/imputation/template <https://github.com/WenjieDu/PyPOTS/tree/main/pypots/imputation/template>`_) to quickly start;
2. become one of `PyPOTS contributors <https://github.com/WenjieDu/PyPOTS/graphs/contributors>`_ and
be listed as a volunteer developer `on the PyPOTS website <https://pypots.com/about/#volunteer-developers>`_;
3. get mentioned in our `release notes <https://github.com/WenjieDu/PyPOTS/releases>`_;
3. get mentioned in PyPOTS `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!
Expand Down
9 changes: 9 additions & 0 deletions docs/pypots.imputation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ pypots.imputation.transformer
:show-inheritance:
:inherited-members:

pypots.imputation.timemixer
------------------------------------

.. automodule:: pypots.imputation.timemixer
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

pypots.imputation.imputeformer
------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions pypots/data/load_specific_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def list_supported_datasets() -> list:

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

Expand All @@ -45,7 +45,7 @@ def load_specific_dataset(dataset_name: str, use_cache: bool = True) -> dict:
The name of the dataset to be loaded, which should be supported, i.e. in SUPPORTED_DATASETS.

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

Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions tests/imputation/timemixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class TestTimeMixer(unittest.TestCase):
DATA["n_features"],
n_layers=2,
top_k=5,
d_model=512,
d_ffn=512,
d_model=32,
d_ffn=32,
dropout=0.1,
epochs=EPOCHS,
saving_path=saving_path,
Expand Down
Loading