PyITS

December 12, 2024 · View on GitHub

Welcome to PyITS

A Unified Python Toolkit for Industrial Time-Series Analytics

Python version powered by Pytorch MIT license Community GitHub contributors GitHub Repo stars GitHub Repo forks README in English

⦿ Motivation: Industrial Time-Series (ITS) analytics is essential across diverse sectors, including manufacturing, energy, transportation, and healthcare. While general time-series models have made significant advancements, ITS encompasses specialized tasks such as fault diagnosis, process monitoring, soft sensing, RUC prediction, and predictive maintenance. These tasks require unique data processing, training, and evaluation protocols, making existing toolkits unsuitable for ITS applications. Furthermore, implementation details for these protocols are often not disclosed in current literature. Therefore, the area of ITS analytics needs a dedicated toolkit. PyITS is created to fill in this blank.

⦿ Mission: PyITS is designed to be a versatile toolbox that streamlines the application of modern machine learning techniques for Industrial Time-Series (ITS) analytics. Our mission is twofold: (1) Enable engineers to quickly implement and compare existing algorithms, facilitating the efficient completion of ITS projects. (2) Provide researchers with a robust collection of updated baselines and standardized experimental protocols, allowing them to focus on algorithmic innovation. PyITS continuously integrates both classical and state-of-the-art machine learning algorithms, offering unified APIs across various models and tasks. Additionally, we provide comprehensive documentation and interactive tutorials to guide beginners through different applications.

🤗 Please star this repo to help others notice PyITS if you think it is a useful toolkit. This really means a lot to our open-source research. Thank you!

❖ Available Algorithms

PyITS supports fault diagnosis, process monitoring, soft sensing, RUC prediction, and predictive maintenance tasks on ITS datasets. Suppose T is the historical length, at the time-step tt, the supported tasks are discribed as follows:

  • SS: Soft sensor, which aims to estimate the value of the quality variable (yty_t). Available input data include the historical values of process variables xtT+1:tx_{t-\mathrm{T}+1:t} and quality variable ytT+1:t1y_{t-\mathrm{T}+1:t-1}.
  • PM: Process monitoring, which aims to predicts the next-step quality variable (yt+1y_{t+1}). Available input data include the historical values of process variables xtT+1:tx_{t-\mathrm{T}+1:t} and quality variable ytT+1:ty_{t-\mathrm{T}+1:t}.
  • FD: Fault diagnosis, which aims to determines the correct status of a given patch, including normal and various fault types. Available input data include the historical values of all variables ztT+1:tz_{t-\mathrm{T}+1:t}.
  • RUL: RUL prediction, which aims to forecasts the remaining time before a fault occurs. Available input data include the historical values of all variables ztT+1:tz_{t-\mathrm{T}+1:t}.
  • PdM: Predictive maintainance, which aims to estimates whether a fault occurrs within a specified future window. Available input data include the historical values of all variables ztT+1:tz_{t-\mathrm{T}+1:t}.

The table below shows the availability of each algorithm for different tasks. The symbol indicates the algorithm is available for the corresponding task (note that some models are specifically designed for typical tasks, and PyITS modifies the data processing and output protocol to extend the spectrum of supported tasks).

TypeModelPaperSSPMFDRULPdMRemarks
Foundation modelAutoformerNIPS2021Transformer-based time-series foundational model
Foundation modelCrossformerICLR2023Transformer-based time-series foundational model
Foundation modelETSformerarxivTransformer-based time-series foundational model
Foundation modelFEDformerICML2022Transformer-based time-series foundational model
Foundation modelInformerAAAI2021Transformer-based time-series foundational model
Foundation modelNonstationary TransformerNIPS2022Transformer-based time-series foundational model
Foundation modelPatchTSTICLR2023Transformer-based time-series foundational model
Foundation modelPathformerICLR2024Transformer-based time-series foundational model
Foundation modelPAttnNIPS2024Transformer-based time-series foundational model
Foundation modelPyraformerICLR2022Transformer-based time-series foundational model
Foundation modelReformerICLR2020Transformer-based time-series foundational model
Foundation modelTimeXerNIPS2024Transformer-based time-series foundational model
Foundation modelTransformerNIPS2017Transformer-based time-series foundational model
Foundation modeliTransformerICLR2024Transformer-based time-series foundational model
Foundation modelFITSICLR2024MLP-based time-series foundational model
Foundation modelDLinearAAAI2023MLP-based time-series foundational model
Foundation modelLightTSPACMMOD2023MLP-based time-series foundational model
Foundation modelFreTSNIPS2023MLP-based time-series foundational model
Foundation modelTiDETMLR2023MLP-based time-series foundational model
Foundation modelTimeMixerICLR2024MLP-based time-series foundational model
Foundation modelTriformerIJCAI2022MLP-based time-series foundational model
Foundation modelTSMixerTMLR2023MLP-based time-series foundational model
Foundation modelMambaarxivRNN-based time-series foundational model
Foundation modelLSTMRNN-based time-series foundational model
Foundation modelSegRNNarxivRNN-based time-series foundational model
Foundation modelMICNICLR2023CNN-based time-series foundational model
Foundation modelSCINetNIPS2022CNN-based time-series foundational model
Foundation modelTCNarxivCNN-based time-series foundational model
Foundation modelTimesNetICLR2023CNN-based time-series foundational model
Foundation modelKoopaNIPS2023Other time-series foundational model
Foundation modelFiLMNIPS2022Other time-series foundational model
Task-specific modelDLSTMTII2022Originally developed for SS task
Task-specific modelDTGRUTII2023Originally developed for RUL task
Task-specific modelAdaNetTII2024Originally developed for RUL task
Task-specific modelDeepPLSTNNLS2023Originally developed for PdM task
Task-specific modelRSNTII2023Originally developed for FD task
Task-specific modelMCNTSMC2024Originally developed for FD task
Task-specific modelMCTANTNNLS2023Originally developed for SS task
Task-specific modelDLformerTNNLS2024Originally developed for RUL task
Task-specific modelTR-LTTII2022Originally developed for RUL task

✨ Contribute your model right now to enhance your research impact! Your work will be widely used and cited by the community. Refer to the models/Transformer.py to see how to devise your model with PyITS.

❖ Available Datasets

PyITS incorporates several ITS datasets for task validation. The table below shows the availability of each dataset for different tasks. The symbol indicates the dataset is available for the corresponding task (note that some datasets may lack the required labels for typical tasks). You can download each dataset either from the source link or from our zipped file, which is available on Google Drive and Baidu Disk.

DatasetPaperSourceSSPMFDRULPdMRemarks
SRUControl Eng. Pract.2003githubSulfur Recovery Unit
DebutanizerTII2020githubDebutanizer Column
TEPMeasurement2023githubTennessee Eastman Process
CWRUarxivofficialCase Western Reserve University Bearing Fault Dataset
C-MAPSSETFA2021officialTurbofan Engine Degradation Simulation from NASA
NASA-Li-ionNASA2007officialCharging and discharging experiments on Li-Ion batteries from NASA
SWaTCRITIS2016officialSecure Water Treatment Equipment Anomaly Dataset
SKABKaggle2020kaggleSkoltech Anomaly Benchmark

✨ Contribute related datasets right now to enhance your research impact! Your work will be widely used and cited by the community. Refer to the data_provider/data_generator.py to see how to incorporate your datasets with PyITS.

❖ PyITS Composition

The PyITS framework consists of three main components: data_provider, model, and estimator. This modular architecture ensures flexibility, scalability, and ease of use across diverse ITS applications.

  • Data provider: it aims to process the dataset with diverse features and protocols to provide appropriate inputs for different ITS tasks. It inherits from the base class data_provider/Base_Dataset, which standardizes data handling procedures across the framework. Each dataset has a unique data_provider class, while each ITS task to execute corresponds to a specific in-class method within the data_provider class.
  • Model: it serves as the encoder to generate representations from the input data provided by Data provider. Leveraging advanced machine learning algorithms, the model captures intricate dependencies inherent in ITS data. Notably, the models are generally designed to be task-agnostic, allowing it to be used across different tasks.
  • Estimator: it wraps the data_provider, model, and decoder for a given task, defining the training and evaluation protocols. The decoder, which is cascaded from the model, transforms the encoded representations into task-specific outputs. For example, in the SS task, the decoder is an affine layer that transforms the representation zz into a real-valued estimate of the quality variable yy; in the PdM task, the decoder is an affine layer followed by a softmax layer that transforms zz into a probability vector, indicating the likelihood of anomalies occurring at corresponding time stamps.

❖ Installation

We will release a package on PyPI and anaconda very soon. Before that, you can install PyITS by cloning it.

git clone https://github.com/Master-PLC/PyITS.git

❖ Usage

We present you two usage examples of performing soft sensor with iTransformer as the model and SRU as the dataset below, you can click it to view.

Click here to see an example applying iTransformer on SRU for process monitoring:
python run.py --task_name process_monitoring --model iTransformer --data SRU --is_training 1
Click here to see an example applying iTransformer on SRU for process monitoring with your own python script:
from data_provider.data_generator import Dataset_SRU
from estimator.foundation.process_monitoring_estimator import Process_Monitoring_Estimator
from models.iTransformer import Model
from utils.argument_parser import parse_arguments
from utils.logger import Logger
from utils.tools import load_device, seed_everything


if __name__ == '__main__':
    args = parse_arguments()

    ## fix seed
    seed_everything(args.fix_seed)

    ## build logger
    logger = Logger(log_dir=args.save_dir, remove_old=args.remove_log)

    ## load device
    args.device = load_device(gpu_ids=args.gpu_ids)

    ## build dataset
    dataset = Dataset_SRU(args, logger)
    args = dataset.generate_data(task_name=args.task_name)
    train_data = dataset.get_data(flag='train')

    ## build model
    model = Model(args).float().to(args.device)

    ## build estimator
    estimator = Process_Monitoring_Estimator(args, dataset=dataset, model=model, device=args.device, logger=logger)

    ## training and testing
    estimator.fit()
    estimator.test()

Saving the above code as toy.py, you can run it with the following command:

python toy.py --task_name process_monitoring --model iTransformer --data SRU --is_training 1

❖ Contribution and community

We warmly invite you to contribute to PyITS. By committing your code:

  1. You can make your works readily available for PyITS users to run, which helps your work gain more recognition and credits.
  2. You will be listed as a PyITS contributor and a volunteer developer.
  3. Your contributions will be highlighted in PyITS release notes.

Refer to the data_provider/data_generator.py, models/Transformer.py and estimator/foundation/soft_sensor_estimator.py to see how to include your own dataset, model and estimator in PyITS.

We invite you to join the PyITS community on WeChat (微信公众号). We also run a group chat on WeChat, and you can get the access by scanning the QR code. By joining the community, you can get the latest updates on PyITS, share your ideas, and discuss with other members.

❖ Acknowledgement

Some aspects of the implementation are based on the following repositories: