├── Pipfile ├── README.md ├── configs ├── baseline.json ├── cnn_ae_fd1.json ├── cnn_ae_fd2.json ├── cnn_ae_fd3.json ├── cnn_ae_fd4.json ├── cnn_fd1.json ├── cnn_fd2.json ├── cnn_fd3.json ├── cnn_fd4.json ├── cnn_pre_fd1.json ├── cnn_pre_fd2.json ├── cnn_pre_fd3.json └── cnn_pre_fd4.json ├── results └── semi_supervised.csv ├── src ├── building │ ├── __init__.py │ ├── build.py │ └── build_common.py ├── datasets │ ├── __init__.py │ ├── baseline.py │ ├── cmapss.py │ └── loader.py ├── evaluation │ ├── add_rul_score.py │ ├── export_results_semi_supervised.py │ └── plot_semi_supervised.py ├── hyperopt │ ├── hyperopt_semi_supervised.py │ └── hyperopt_supervised.py ├── lightning │ ├── autoencoder.py │ ├── baseline.py │ ├── loggers.py │ ├── metrics.py │ ├── mixins.py │ └── pretraining.py ├── models │ ├── layers.py │ └── networks.py ├── reproduce_baseline.py ├── reproduce_semi_supervised.py ├── run_baseline.py ├── run_pretraining.py ├── run_rbm.py └── run_semi_supervised.py └── tests ├── __init__.py ├── dataset_tests ├── __init__.py ├── templates.py ├── test_baseline.py ├── test_cmapss.py └── test_loader.py ├── lightning_tests ├── __init__.py ├── test_autoencoder.py ├── test_baseline.py ├── test_loggers.py ├── test_metrics.py └── test_pretraining.py ├── model_tests ├── __init__.py ├── test_layers.py └── test_networks.py └── test_building.py /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [[source]] 7 | name = "pytorch" 8 | url = "https://download.pytorch.org/whl/cu102" 9 | verify_ssl = false 10 | 11 | [packages] 12 | plotnine = "==0.7.1" 13 | numpy = "==1.19.1" 14 | mlflow = "==1.10.0" 15 | pytorch-lightning = "==0.10.0" 16 | pandas = "==1.1.3" 17 | tabulate = "==0.8.7" 18 | matplotlib = "*" 19 | tqdm = "==4.50.2" 20 | ray = "==1.0.0" 21 | scikit-learn = "==0.23.2" 22 | umap-learn = "==0.4.6" 23 | numba = "==0.51.2" 24 | PyTorch-ProbGraph = "==0.0.1" 25 | torch = "==1.6.0" 26 | 27 | [dev-packages] 28 | 29 | [requires] 30 | python_version = "3.7" 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Improving Semi-Supervised Learning for Remaining Useful Lifetime Estimation Through Self-Supervision 2 | 3 | This is the companion repository for the paper "*Improving Semi-Supervised Learning for Remaining Useful Lifetime Estimation Through Self-Supervision*". 4 | It is available as a manuscript on [arXiv](https://arxiv.org/abs/2108.08721) or as a full journal article in [IJPHM](https://papers.phmsociety.org/index.php/ijphm/article/view/3096). 5 | 6 | ## Installation 7 | 8 | ### Environment 9 | This project uses Python 3.7 and pipenv to manage its environment. Install pipenv as: 10 | 11 | ``` 12 | pip install -U pipenv 13 | ``` 14 | 15 | You can set up this project in a virtual environment afterwards with: 16 | 17 | ```shell 18 | cd 19 | pipenv install --skip-lock 20 | ``` 21 | 22 | Please make sure that the appropriate Nvidia driver, CUDA 10.2 and cuDNN are installed on your system. 23 | 24 | ### Data 25 | 26 | Download the NASA C-MAPSS dataset [here](https://ti.arc.nasa.gov/c/6/) and extract the content to ``/data/CMAPSS``. 27 | 28 | ### Verify Installation 29 | 30 | Test the installation by running the unit tests: 31 | 32 | ```shell 33 | pipenv shell 34 | export PYTHONPATH=$PYTHONPATH:./src 35 | python -m unittest -v 36 | ``` 37 | 38 | ## Usage 39 | 40 | ### Concerning Ray 41 | 42 | This project uses ``ray`` to parallelize the training. 43 | It expects a GPU and at least 3 CPU cores to run one training instance and will try to put two runs on one GPU if more CPU cores are available. 44 | If you want to customize these requirements, please edit the ``ray.remote`` function decorators in the file ``run_semi_supervised.py``. 45 | 46 | ### Basic Usage 47 | 48 | To start reproducing the results, enter the source directory of the project and open the pipenv shell if you haven't already: 49 | 50 | ```shell 51 | pipenv shell 52 | cd /src 53 | ``` 54 | 55 | To reproduce all baseline experiments call: 56 | 57 | ```shell 58 | python reproduce_baseline.py 2021 59 | ``` 60 | 61 | To reproduce each of the SSL methods call: 62 | 63 | ```shell 64 | python reproduce_semi_supervised.py 2021 --mode metric 65 | python reproduce_semi_supervised.py autoencoder --mode autoencoder 66 | python reproduce_semi_supervised.py rbm --mode rbm 67 | ``` 68 | 69 | ### Advanced Usage 70 | 71 | If you want to modify any of the experiments, you can start with the hyperparameter configurations. 72 | The ``config`` folder contains JSON configs for each experiment. 73 | 74 | If you want to run an autoencoder or self-supervised pre-training experiment, you can use the ``run_pretraining.py`` script. 75 | Pre-training experiments with RBMs can be run with the ``run_rbm.py`` script. 76 | Please consult the scripts help page for their usage with ``python