Results of RUL estimation using lstm-256#
This notebook presents experimental results of anomaly detection on the Tennessee Eastman Process dataset using the model AutoEncoderMLP-256.
Importing libraries.
from ice.remaining_useful_life_estimation.datasets import RulCmapss
from ice.remaining_useful_life_estimation.models import LSTM
import pandas as pd
import numpy as np
import torch
from tqdm.auto import trange
C:\Users\user\conda\envs\Latent\Lib\site-packages\tqdm\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
Initializing model class and train/test data split
dataset_class = RulCmapss()
data, target = dataset_class.df[0], dataset_class.target[0]
test_data, test_target = dataset_class.test[0], dataset_class.test_target[0]
Training
metrics = []
for i in trange(5): # 5
torch.random.manual_seed(i)
model_class = LSTM(
window_size=32,
batch_size= 64,
lr=1e-4,
num_epochs=35,
verbose=False,
device='cuda'
)
model_class.fit(data, target)
metrics.append(model_class.evaluate(test_data, test_target))
0%| | 0/5 [00:00<?, ?it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 25000.32it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33333.10it/s]
20%|██ | 1/5 [00:47<03:09, 47.29s/it]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33341.05it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33341.05it/s]
40%|████ | 2/5 [01:33<02:19, 46.56s/it]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 24998.83it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 49985.75it/s]
60%|██████ | 3/5 [02:19<01:32, 46.38s/it]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 11192.27it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33333.10it/s]
80%|████████ | 4/5 [03:06<00:46, 46.70s/it]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33322.51it/s]
Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33335.75it/s]
100%|██████████| 5/5 [03:54<00:00, 46.88s/it]
Printing metric
rmse = []
score = []
for metrics_i in metrics:
rmse.append(metrics_i["rmse"])
score.append(metrics_i["score"])
rmse_mean, rmse_std = np.mean(rmse, axis=0), np.std(rmse, axis=0)
score_mean, score_std = np.mean(score, axis=0), np.std(score, axis=0)
print(f'rmse: {np.mean(rmse):.6f} ± {2*np.std(rmse):.6f}')
print(f'score: {np.mean(score):.6f} ± {2*np.std(score):.6f}')
rmse: 14.456039 ± 0.461288
score: 54669.804238 ± 15056.124157
Parameter esimation
model_class.model_param_estimation()
(944129, (0.8843235832452774, 0.06986449102077215))