Skip to content

Commit

Permalink
docs: update example notebooks (#51)
Browse files Browse the repository at this point in the history
* docs: update and re-run all example notebooks

* docs: fix argument names in docstrings
  • Loading branch information
tilman151 authored Nov 16, 2023
1 parent 1b6f2b9 commit 69004bc
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 630 deletions.
92 changes: 49 additions & 43 deletions docs/examples/adarul.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2023-06-13T13:52:16.521279735Z",
"start_time": "2023-06-13T13:52:15.033977874Z"
"end_time": "2023-11-16T14:02:18.606749736Z",
"start_time": "2023-11-16T14:02:16.904318303Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -42,8 +42,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2023-06-13T13:52:16.788563939Z",
"start_time": "2023-06-13T13:52:16.521775963Z"
"end_time": "2023-11-16T14:02:18.834709633Z",
"start_time": "2023-11-16T14:02:18.608371867Z"
}
},
"outputs": [
Expand Down Expand Up @@ -83,8 +83,8 @@
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2023-06-13T13:54:08.719456405Z",
"start_time": "2023-06-13T13:52:16.790944129Z"
"end_time": "2023-11-16T14:03:51.238690150Z",
"start_time": "2023-11-16T14:02:18.834977822Z"
}
},
"outputs": [
Expand All @@ -97,8 +97,10 @@
"----------------------------------------------------------------\n",
"0 | train_loss | MeanSquaredError | 0 \n",
"1 | val_loss | MeanSquaredError | 0 \n",
"2 | _feature_extractor | ActivationDropoutWrapper | 62.5 K\n",
"3 | _regressor | FullyConnectedHead | 6.3 K \n",
"2 | test_loss | MeanSquaredError | 0 \n",
"3 | evaluator | AdaptionEvaluator | 0 \n",
"4 | _feature_extractor | ActivationDropoutWrapper | 62.5 K\n",
"5 | _regressor | FullyConnectedHead | 6.3 K \n",
"----------------------------------------------------------------\n",
"68.7 K Trainable params\n",
"0 Non-trainable params\n",
Expand All @@ -112,7 +114,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "f0482d0d9bcf4fed9ee80144d4768e21"
"model_id": "8955d63606284c038e7c46f4ac715bf4"
}
},
"metadata": {},
Expand All @@ -124,7 +126,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "51a1bf984cd94c1c8bc2c9e8e12410dc"
"model_id": "26e2b87dbf144b80824762f64fa5f380"
}
},
"metadata": {},
Expand All @@ -136,7 +138,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "40f32180d1664716afcacba73a85cc77"
"model_id": "625a04b373054424896fb9fde921e80f"
}
},
"metadata": {},
Expand Down Expand Up @@ -168,8 +170,8 @@
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2023-06-13T13:54:22.009053349Z",
"start_time": "2023-06-13T13:54:08.721360656Z"
"end_time": "2023-11-16T14:04:03.035152695Z",
"start_time": "2023-11-16T14:03:51.238597478Z"
}
},
"outputs": [
Expand Down Expand Up @@ -199,7 +201,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "a28ddb7f70584546afd2a8012b2fa4a1"
"model_id": "fe5a6f05c6e9431094ba9afc33e674f0"
}
},
"metadata": {},
Expand All @@ -219,7 +221,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "8a9861bab7254a469e77d14d2d099895"
"model_id": "60e18cd8aeb3447e81275989fb8fc445"
}
},
"metadata": {},
Expand All @@ -231,7 +233,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "a0e90d98cb0f4922ade78793e7c36fcf"
"model_id": "6cd1bb27a4624a71975daca2658abec1"
}
},
"metadata": {},
Expand All @@ -250,7 +252,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "dd10463d106245759bf7df76141c5ecf"
"model_id": "455a25a04c3045f8886cc83e655a2b42"
}
},
"metadata": {},
Expand All @@ -263,16 +265,16 @@
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
" Test metric DataLoader 0 DataLoader 1\n",
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
" test/source/rmse 24.638370513916016\n",
" test/source/score 1310.9384765625\n",
" test/target/rmse 31.75853157043457\n",
" test/target/score 2995.100341796875\n",
" test/source/rmse 24.635229110717773\n",
" test/source/score 1310.8724365234375\n",
" test/target/rmse 31.754472732543945\n",
" test/target/score 2988.716064453125\n",
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
]
},
{
"data": {
"text/plain": "[{'test/source/rmse/dataloader_idx_0': 24.638370513916016,\n 'test/source/score/dataloader_idx_0': 1310.9384765625},\n {'test/target/rmse/dataloader_idx_1': 31.75853157043457,\n 'test/target/score/dataloader_idx_1': 2995.100341796875}]"
"text/plain": "[{'test/source/rmse/dataloader_idx_0': 24.635229110717773,\n 'test/source/score/dataloader_idx_0': 1310.8724365234375},\n {'test/target/rmse/dataloader_idx_1': 31.754472732543945,\n 'test/target/score/dataloader_idx_1': 2988.716064453125}]"
},
"execution_count": 4,
"metadata": {},
Expand Down Expand Up @@ -300,8 +302,8 @@
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2023-06-13T13:54:22.059818733Z",
"start_time": "2023-06-13T13:54:22.007844833Z"
"end_time": "2023-11-16T14:04:03.083226295Z",
"start_time": "2023-11-16T14:04:03.034510227Z"
}
},
"outputs": [
Expand All @@ -321,17 +323,19 @@
" percent_broken: 1.0\n",
" batch_size: 10\n",
"feature_extractor:\n",
" _convert_: all\n",
" _target_: rul_adapt.model.ActivationDropoutWrapper\n",
" wrapped:\n",
" _target_: rul_adapt.model.LstmExtractor\n",
" input_channels: 14\n",
" lstm_units:\n",
" units:\n",
" - 32\n",
" - 32\n",
" - 32\n",
" bidirectional: true\n",
" dropout: 0.5\n",
"regressor:\n",
" _convert_: all\n",
" _target_: rul_adapt.model.FullyConnectedHead\n",
" input_channels: 64\n",
" act_func_on_last_layer: false\n",
Expand All @@ -341,6 +345,7 @@
" - 1\n",
" dropout: 0.5\n",
"domain_disc:\n",
" _convert_: all\n",
" _target_: rul_adapt.model.FullyConnectedHead\n",
" input_channels: 64\n",
" act_func_on_last_layer: false\n",
Expand All @@ -367,8 +372,7 @@
"trainer:\n",
" _target_: pytorch_lightning.Trainer\n",
" max_epochs: 20\n",
" limit_train_batches: 36\n",
"\n"
" limit_train_batches: 36\n"
]
}
],
Expand All @@ -392,8 +396,8 @@
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2023-06-13T13:57:50.813643098Z",
"start_time": "2023-06-13T13:57:44.737726224Z"
"end_time": "2023-11-16T14:09:36.657065211Z",
"start_time": "2023-11-16T14:09:30.286988058Z"
}
},
"outputs": [
Expand All @@ -405,15 +409,17 @@
"TPU available: False, using: 0 TPU cores\n",
"IPU available: False, using: 0 IPUs\n",
"HPU available: False, using: 0 HPUs\n",
"/home/tilman/Programming/rul-adapt/.venv/lib/python3.8/site-packages/pytorch_lightning/callbacks/model_checkpoint.py:613: UserWarning: Checkpoint directory /home/tilman/Programming/rul-adapt/examples/lightning_logs/version_70/checkpoints exists and is not empty.\n",
"/home/tilman/Programming/rul-adapt/.venv/lib/python3.8/site-packages/pytorch_lightning/callbacks/model_checkpoint.py:613: UserWarning: Checkpoint directory /home/tilman/Programming/rul-adapt/docs/examples/lightning_logs/version_24/checkpoints exists and is not empty.\n",
" rank_zero_warn(f\"Checkpoint directory {dirpath} exists and is not empty.\")\n",
"\n",
" | Name | Type | Params\n",
"----------------------------------------------------------\n",
"0 | train_loss | MeanSquaredError | 0 \n",
"1 | val_loss | MeanSquaredError | 0 \n",
"2 | _feature_extractor | CnnExtractor | 5.3 K \n",
"3 | _regressor | FullyConnectedHead | 81 \n",
"2 | test_loss | MeanSquaredError | 0 \n",
"3 | evaluator | AdaptionEvaluator | 0 \n",
"4 | _feature_extractor | CnnExtractor | 5.3 K \n",
"5 | _regressor | FullyConnectedHead | 81 \n",
"----------------------------------------------------------\n",
"5.4 K Trainable params\n",
"0 Non-trainable params\n",
Expand All @@ -427,7 +433,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "fba79650766b4004ac9369cdc3905124"
"model_id": "8c2a29c85a3449e3b0a6237034fe7477"
}
},
"metadata": {},
Expand Down Expand Up @@ -464,7 +470,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "490aa272190a4daeadafababd9ed73a6"
"model_id": "796994b72921489fb85490c2bdf876a4"
}
},
"metadata": {},
Expand All @@ -476,7 +482,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "1abea8ac5fad41ccaae139a658bc7a3f"
"model_id": "2b8111c44ecd4039b2b94ff0cbd1b926"
}
},
"metadata": {},
Expand All @@ -488,7 +494,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "0780ccf9bef04bf6b8d1f91fe21218de"
"model_id": "9e0491af3e2b42e1835d5b206a64d712"
}
},
"metadata": {},
Expand All @@ -507,7 +513,7 @@
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "be087729f37c49e4a5a52ee27e0910b9"
"model_id": "41a242a13d4843359f25b3ec0c4993d2"
}
},
"metadata": {},
Expand All @@ -520,16 +526,16 @@
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
" Test metric DataLoader 0 DataLoader 1\n",
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n",
" test/source/rmse 114.05007934570312\n",
" test/source/score 4811891.5\n",
" test/target/rmse 114.94615173339844\n",
" test/target/score 4405463.5\n",
" test/source/rmse 65.23387908935547\n",
" test/source/score 70147.4921875\n",
" test/target/rmse 66.29417419433594\n",
" test/target/score 64386.578125\n",
"────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
]
},
{
"data": {
"text/plain": "[{'test/source/rmse/dataloader_idx_0': 114.05007934570312,\n 'test/source/score/dataloader_idx_0': 4811891.5},\n {'test/target/rmse/dataloader_idx_1': 114.94615173339844,\n 'test/target/score/dataloader_idx_1': 4405463.5}]"
"text/plain": "[{'test/source/rmse/dataloader_idx_0': 65.23387908935547,\n 'test/source/score/dataloader_idx_0': 70147.4921875},\n {'test/target/rmse/dataloader_idx_1': 66.29417419433594,\n 'test/target/score/dataloader_idx_1': 64386.578125}]"
},
"execution_count": 7,
"metadata": {},
Expand All @@ -547,7 +553,7 @@
"\n",
"feature_extractor = rul_adapt.model.CnnExtractor(\n",
" input_channels=14,\n",
" conv_filters=[16, 16, 16],\n",
" units=[16, 16, 16],\n",
" seq_len=30,\n",
" fc_units=8,\n",
")\n",
Expand Down
Loading

0 comments on commit 69004bc

Please sign in to comment.