Skip to content

Commit 046d779

Browse files
committed
Updated notebooks after modifying som collect_samples method.
1 parent 0d2da5a commit 046d779

File tree

5 files changed

+59
-25
lines changed

5 files changed

+59
-25
lines changed

notebooks/boston_housing.ipynb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
}
163163
],
164164
"conversionMethod": "pd.DataFrame",
165-
"ref": "191be38d-2731-4b01-b070-70479100c48d",
165+
"ref": "e138cdf3-e814-44aa-9e6f-8d7ac31913a4",
166166
"rows": [
167167
[
168168
"0",
@@ -491,7 +491,7 @@
491491
}
492492
],
493493
"conversionMethod": "pd.DataFrame",
494-
"ref": "11450940-5100-4b5a-ba25-e981ec9086b6",
494+
"ref": "42a0e774-c2c9-4d76-81a6-e4270650b92c",
495495
"rows": [
496496
[
497497
"count",
@@ -994,7 +994,7 @@
994994
"name": "stderr",
995995
"output_type": "stream",
996996
"text": [
997-
"Training SOM: 100%|██████████| 125/125 [00:16<00:00, 7.36epoch/s]\n"
997+
"Training SOM: 100%|██████████| 125/125 [00:42<00:00, 2.92epoch/s]\n"
998998
]
999999
}
10001000
],
@@ -1130,13 +1130,18 @@
11301130
"outputs": [],
11311131
"source": [
11321132
"predictions = []\n",
1133+
"bmus_idx_map = som.build_bmus_data_map(\n",
1134+
" data=train_features,\n",
1135+
" return_indices=True, # False means we want the features of each sample and not the indices\n",
1136+
")\n",
11331137
"for idx, (test_feature, test_target) in enumerate(zip(test_features, test_targets)):\n",
11341138
" \n",
11351139
" collected_features, collected_targets = som.collect_samples(\n",
11361140
" query_sample=test_feature,\n",
11371141
" historical_samples=train_features,\n",
11381142
" historical_outputs=train_targets,\n",
1139-
" min_buffer_threshold=100 # Collect 30 historical samples to train a model\n",
1143+
" min_buffer_threshold=100, # Collect 30 historical samples to train a model\n",
1144+
" bmus_idx_map=bmus_idx_map,\n",
11401145
" )\n",
11411146
" \n",
11421147
" X = collected_features.numpy()\n",
@@ -1244,7 +1249,7 @@
12441249
],
12451250
"metadata": {
12461251
"kernelspec": {
1247-
"display_name": ".venv",
1252+
"display_name": ".venv_sensing",
12481253
"language": "python",
12491254
"name": "python3"
12501255
},

notebooks/energy_efficiency.ipynb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
}
143143
],
144144
"conversionMethod": "pd.DataFrame",
145-
"ref": "443e0aff-34b5-4b48-a582-2fa539dbad73",
145+
"ref": "54803c65-4d2d-4883-b314-b77097128e09",
146146
"rows": [
147147
[
148148
"0",
@@ -414,7 +414,7 @@
414414
}
415415
],
416416
"conversionMethod": "pd.DataFrame",
417-
"ref": "44e1ec84-7321-4c56-b470-6ddb0daa5e37",
417+
"ref": "8ac4cc70-224d-4091-838e-ebaeee192468",
418418
"rows": [
419419
[
420420
"count",
@@ -849,7 +849,7 @@
849849
"name": "stderr",
850850
"output_type": "stream",
851851
"text": [
852-
"Training SOM: 100%|██████████| 125/125 [00:12<00:00, 10.24epoch/s]\n"
852+
"Training SOM: 100%|██████████| 125/125 [00:42<00:00, 2.97epoch/s]\n"
853853
]
854854
}
855855
],
@@ -1071,13 +1071,18 @@
10711071
"outputs": [],
10721072
"source": [
10731073
"predictions = []\n",
1074+
"bmus_idx_map = som.build_bmus_data_map(\n",
1075+
" data=train_features,\n",
1076+
" return_indices=True, # False means we want the features of each sample and not the indices\n",
1077+
")\n",
10741078
"for idx, (test_feature, test_target) in enumerate(zip(test_features, test_targets_heating)):\n",
10751079
" \n",
10761080
" collected_features, collected_targets = som.collect_samples(\n",
10771081
" query_sample=test_feature,\n",
10781082
" historical_samples=train_features,\n",
10791083
" historical_outputs=train_targets_heating,\n",
1080-
" min_buffer_threshold=150 # Collect 425 historical samples to train a model\n",
1084+
" min_buffer_threshold=150, # Collect 425 historical samples to train a model\n",
1085+
" bmus_idx_map=bmus_idx_map,\n",
10811086
" )\n",
10821087
" \n",
10831088
" X = collected_features.numpy()\n",
@@ -1185,7 +1190,7 @@
11851190
],
11861191
"metadata": {
11871192
"kernelspec": {
1188-
"display_name": ".venv",
1193+
"display_name": ".venv_sensing",
11891194
"language": "python",
11901195
"name": "python3"
11911196
},

notebooks/get_data.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@
12931293
],
12941294
"metadata": {
12951295
"kernelspec": {
1296-
"display_name": ".venv",
1296+
"display_name": ".venv_sensing",
12971297
"language": "python",
12981298
"name": "python3"
12991299
},

notebooks/iris.ipynb

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
}
134134
],
135135
"conversionMethod": "pd.DataFrame",
136-
"ref": "1198812d-a3ef-4b6e-8957-4d5201eecc75",
136+
"ref": "337885f5-c2ae-4187-b5d4-81cb39680b47",
137137
"rows": [
138138
[
139139
"0",
@@ -311,7 +311,7 @@
311311
}
312312
],
313313
"conversionMethod": "pd.DataFrame",
314-
"ref": "cb7dc608-ebcd-4a20-940f-f7d5dd5d2243",
314+
"ref": "eaaf9bfb-c28a-4322-9401-1066d0f72e48",
315315
"rows": [
316316
[
317317
"count",
@@ -629,7 +629,14 @@
629629
"name": "stderr",
630630
"output_type": "stream",
631631
"text": [
632-
"Training SOM: 100%|██████████| 100/100 [00:02<00:00, 45.46epoch/s]\n"
632+
"Training SOM: 0%| | 0/100 [00:00<?, ?epoch/s]"
633+
]
634+
},
635+
{
636+
"name": "stderr",
637+
"output_type": "stream",
638+
"text": [
639+
"Training SOM: 100%|██████████| 100/100 [00:08<00:00, 12.06epoch/s]\n"
633640
]
634641
}
635642
],
@@ -719,18 +726,23 @@
719726
},
720727
{
721728
"cell_type": "code",
722-
"execution_count": 20,
729+
"execution_count": 23,
723730
"metadata": {},
724731
"outputs": [],
725732
"source": [
726733
"predictions = []\n",
734+
"bmus_idx_map = som.build_bmus_data_map(\n",
735+
" data=train_features,\n",
736+
" return_indices=True, # False means we want the features of each sample and not the indices\n",
737+
")\n",
727738
"for idx, (test_feature, test_target) in enumerate(zip(test_features, test_targets)):\n",
728-
" \n",
739+
" \n",
729740
" collected_features, collected_targets = som.collect_samples(\n",
730741
" query_sample=test_feature,\n",
731742
" historical_samples=train_features,\n",
732743
" historical_outputs=train_targets,\n",
733-
" min_buffer_threshold=30 # Collect 20 historical samples to train a model\n",
744+
" min_buffer_threshold=30, # Collect 20 historical samples to train a model\n",
745+
" bmus_idx_map=bmus_idx_map,\n",
734746
" )\n",
735747
" \n",
736748
" X = collected_features.numpy()\n",
@@ -762,7 +774,7 @@
762774
},
763775
{
764776
"cell_type": "code",
765-
"execution_count": 21,
777+
"execution_count": 24,
766778
"metadata": {},
767779
"outputs": [],
768780
"source": [
@@ -782,7 +794,7 @@
782794
},
783795
{
784796
"cell_type": "code",
785-
"execution_count": 22,
797+
"execution_count": 25,
786798
"metadata": {},
787799
"outputs": [
788800
{
@@ -812,7 +824,7 @@
812824
},
813825
{
814826
"cell_type": "code",
815-
"execution_count": 23,
827+
"execution_count": 26,
816828
"metadata": {},
817829
"outputs": [
818830
{

notebooks/wine.ipynb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
}
167167
],
168168
"conversionMethod": "pd.DataFrame",
169-
"ref": "6429f9e5-3223-4fcb-9626-09775f5a173a",
169+
"ref": "b1c02221-fa87-4177-a697-a36be67e0a6a",
170170
"rows": [
171171
[
172172
"0",
@@ -502,7 +502,7 @@
502502
}
503503
],
504504
"conversionMethod": "pd.DataFrame",
505-
"ref": "29f23741-6c1b-4531-877f-93dd3454ef74",
505+
"ref": "cebf9ebc-1ab1-4f91-9ac9-329a1c4c71b7",
506506
"rows": [
507507
[
508508
"count",
@@ -1015,7 +1015,14 @@
10151015
"name": "stderr",
10161016
"output_type": "stream",
10171017
"text": [
1018-
"Training SOM: 100%|██████████| 100/100 [00:02<00:00, 38.53epoch/s]\n"
1018+
"Training SOM: 5%|▌ | 5/100 [00:00<00:05, 17.79epoch/s]"
1019+
]
1020+
},
1021+
{
1022+
"name": "stderr",
1023+
"output_type": "stream",
1024+
"text": [
1025+
"Training SOM: 100%|██████████| 100/100 [00:06<00:00, 16.15epoch/s]\n"
10191026
]
10201027
}
10211028
],
@@ -1110,13 +1117,18 @@
11101117
"outputs": [],
11111118
"source": [
11121119
"predictions = []\n",
1120+
"bmus_idx_map = som.build_bmus_data_map(\n",
1121+
" data=train_features,\n",
1122+
" return_indices=True, # False means we want the features of each sample and not the indices\n",
1123+
")\n",
11131124
"for idx, (test_feature, test_target) in enumerate(zip(test_features, test_targets)):\n",
11141125
" \n",
11151126
" collected_features, collected_targets = som.collect_samples(\n",
11161127
" query_sample=test_feature,\n",
11171128
" historical_samples=train_features,\n",
11181129
" historical_outputs=train_targets,\n",
1119-
" min_buffer_threshold=30 # Collect 30 historical samples to train a model\n",
1130+
" min_buffer_threshold=30, # Collect 30 historical samples to train a model\n",
1131+
" bmus_idx_map=bmus_idx_map,\n",
11201132
" )\n",
11211133
" \n",
11221134
" X = collected_features.numpy()\n",
@@ -1226,7 +1238,7 @@
12261238
],
12271239
"metadata": {
12281240
"kernelspec": {
1229-
"display_name": ".venv",
1241+
"display_name": ".venv_sensing",
12301242
"language": "python",
12311243
"name": "python3"
12321244
},

0 commit comments

Comments
 (0)