{ "cells": [ { "cell_type": "markdown", "id": "5908e829", "metadata": {}, "source": [ "# Optimization tutorial" ] }, { "cell_type": "code", "execution_count": 1, "id": "7e7ea27e-aca8-4bdc-bcdb-dda20d6ac045", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\user\\conda\\envs\\ice_testing\\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\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "from ice.remaining_useful_life_estimation.datasets import RulCmapss\n", "from ice.remaining_useful_life_estimation.models import MLP" ] }, { "cell_type": "markdown", "id": "f9f612b9-f990-40f8-9191-af341827f7d9", "metadata": {}, "source": [ "Create the MLP model and dataset class." ] }, { "cell_type": "code", "execution_count": 2, "id": "81f891c7-de45-448f-a65b-806f2446e6e5", "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Reading data/C-MAPSS/fd1_train.csv: 100%|██████████| 20631/20631 [00:00<00:00, 517496.66it/s]\n", "Reading data/C-MAPSS/fd2_train.csv: 100%|██████████| 53759/53759 [00:00<00:00, 539376.73it/s]\n", "Reading data/C-MAPSS/fd3_train.csv: 100%|██████████| 24720/24720 [00:00<00:00, 506176.62it/s]\n", "Reading data/C-MAPSS/fd4_train.csv: 100%|██████████| 61249/61249 [00:00<00:00, 539069.75it/s]\n", "Reading data/C-MAPSS/fd1_train.csv: 100%|██████████| 20631/20631 [00:00<00:00, 544734.35it/s]\n", "Reading data/C-MAPSS/fd2_train.csv: 100%|██████████| 53759/53759 [00:00<00:00, 481589.37it/s]\n", "Reading data/C-MAPSS/fd3_train.csv: 100%|██████████| 24720/24720 [00:00<00:00, 427933.68it/s]\n", "Reading data/C-MAPSS/fd4_train.csv: 100%|██████████| 61249/61249 [00:00<00:00, 546792.80it/s]\n", "Reading data/C-MAPSS/fd1_test.csv: 100%|██████████| 13097/13097 [00:00<00:00, 505412.69it/s]\n", "Reading data/C-MAPSS/fd2_test.csv: 100%|██████████| 33991/33991 [00:00<00:00, 478933.98it/s]\n", "Reading data/C-MAPSS/fd3_test.csv: 100%|██████████| 16598/16598 [00:00<00:00, 520419.66it/s]\n", "Reading data/C-MAPSS/fd4_test.csv: 100%|██████████| 41214/41214 [00:00<00:00, 537036.66it/s]\n", "Reading data/C-MAPSS/fd1_test.csv: 100%|██████████| 13097/13097 [00:00<00:00, 515225.24it/s]\n", "Reading data/C-MAPSS/fd2_test.csv: 100%|██████████| 33991/33991 [00:00<00:00, 520644.44it/s]\n", "Reading data/C-MAPSS/fd3_test.csv: 100%|██████████| 16598/16598 [00:00<00:00, 489809.10it/s]\n", "Reading data/C-MAPSS/fd4_test.csv: 100%|██████████| 41214/41214 [00:00<00:00, 537023.31it/s]\n" ] } ], "source": [ "dataset_class = RulCmapss()\n", "data, target = dataset_class.df[0], dataset_class.target[0]" ] }, { "cell_type": "code", "execution_count": 3, "id": "6fc9029e-7ce9-4cd8-9353-087b66556b17", "metadata": {}, "outputs": [], "source": [ "model = MLP(device=\"cuda\")" ] }, { "cell_type": "markdown", "id": "f8ff1a72-19f4-4389-9362-35a80b8fb851", "metadata": {}, "source": [ "Optimization **without changing the complexity** of the training process. Tune the lr of the training procedure using validation loss as optimization target" ] }, { "cell_type": "code", "execution_count": 4, "id": "c9e23868-09cb-4693-ad67-f1104245b7df", "metadata": { "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "[I 2024-08-13 09:53:33,784] A new study created in memory with name: /parameter_lr study\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "trial step with lr = 0.00018951382914416393\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Creating sequence of samples: 100%|██████████| 100/100 [00:00<00:00, 33442.07it/s]\n", "Epochs ...: 0%| | 0/5 [00:00