Skip to content

Commit 585fc4c

Browse files
committed
add new example
1 parent c112477 commit 585fc4c

File tree

1 file changed

+105
-20
lines changed

1 file changed

+105
-20
lines changed

docs/Tutorial_DAMP.ipynb

Lines changed: 105 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
{
4545
"cell_type": "code",
46-
"execution_count": 3,
46+
"execution_count": 2,
4747
"id": "c9564cff",
4848
"metadata": {},
4949
"outputs": [],
@@ -69,7 +69,7 @@
6969
},
7070
{
7171
"cell_type": "code",
72-
"execution_count": 4,
72+
"execution_count": 3,
7373
"id": "409dad09",
7474
"metadata": {},
7575
"outputs": [],
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"cell_type": "code",
131-
"execution_count": 5,
131+
"execution_count": 4,
132132
"id": "c21c4587",
133133
"metadata": {},
134134
"outputs": [],
@@ -152,7 +152,7 @@
152152
},
153153
{
154154
"cell_type": "code",
155-
"execution_count": 6,
155+
"execution_count": 5,
156156
"id": "dd1f7b3d",
157157
"metadata": {},
158158
"outputs": [],
@@ -222,7 +222,7 @@
222222
},
223223
{
224224
"cell_type": "code",
225-
"execution_count": 7,
225+
"execution_count": 6,
226226
"id": "5e45d72c",
227227
"metadata": {},
228228
"outputs": [
@@ -235,7 +235,7 @@
235235
" [ 0, 56]])"
236236
]
237237
},
238-
"execution_count": 7,
238+
"execution_count": 6,
239239
"metadata": {},
240240
"output_type": "execute_result"
241241
}
@@ -256,7 +256,7 @@
256256
},
257257
{
258258
"cell_type": "code",
259-
"execution_count": 8,
259+
"execution_count": 7,
260260
"id": "79663447",
261261
"metadata": {},
262262
"outputs": [],
@@ -350,7 +350,7 @@
350350
},
351351
{
352352
"cell_type": "code",
353-
"execution_count": 9,
353+
"execution_count": 8,
354354
"id": "c76317b5",
355355
"metadata": {},
356356
"outputs": [],
@@ -429,7 +429,7 @@
429429
},
430430
{
431431
"cell_type": "code",
432-
"execution_count": 14,
432+
"execution_count": 9,
433433
"id": "769bddad",
434434
"metadata": {},
435435
"outputs": [],
@@ -521,7 +521,7 @@
521521
},
522522
{
523523
"cell_type": "code",
524-
"execution_count": 15,
524+
"execution_count": 10,
525525
"id": "2cfbc771",
526526
"metadata": {},
527527
"outputs": [],
@@ -536,7 +536,7 @@
536536
},
537537
{
538538
"cell_type": "code",
539-
"execution_count": 16,
539+
"execution_count": 11,
540540
"id": "a935f31f",
541541
"metadata": {},
542542
"outputs": [
@@ -546,7 +546,7 @@
546546
"text": [
547547
"discord_dist: 8.500883427933504\n",
548548
"discord_index: 209\n",
549-
"running time [sec]: 4.833993911743164\n"
549+
"running time [sec]: 5.248243093490601\n"
550550
]
551551
}
552552
],
@@ -566,7 +566,7 @@
566566
},
567567
{
568568
"cell_type": "code",
569-
"execution_count": 17,
569+
"execution_count": 12,
570570
"id": "2b461592",
571571
"metadata": {},
572572
"outputs": [
@@ -576,7 +576,7 @@
576576
"text": [
577577
"discord_dist: 8.500883427933504\n",
578578
"discord_index: 209\n",
579-
"running time [sec]: 2.2122771739959717\n"
579+
"running time [sec]: 2.2584328651428223\n"
580580
]
581581
}
582582
],
@@ -597,15 +597,100 @@
597597
},
598598
{
599599
"cell_type": "markdown",
600-
"id": "90688aa9",
600+
"id": "d5fccfb3",
601601
"metadata": {},
602602
"source": [
603603
"## Example 2"
604604
]
605605
},
606606
{
607607
"cell_type": "code",
608-
"execution_count": 18,
608+
"execution_count": 13,
609+
"id": "d8e9fa63",
610+
"metadata": {},
611+
"outputs": [],
612+
"source": [
613+
"seed = 100\n",
614+
"np.random.seed(seed)\n",
615+
"\n",
616+
"T = np.random.rand(100000)\n",
617+
"m = 50\n",
618+
"split_index = 5000"
619+
]
620+
},
621+
{
622+
"cell_type": "code",
623+
"execution_count": 14,
624+
"id": "263bca9c",
625+
"metadata": {},
626+
"outputs": [
627+
{
628+
"name": "stdout",
629+
"output_type": "stream",
630+
"text": [
631+
"discord_dist: 7.606279752022369\n",
632+
"discord_index: 8109\n",
633+
"running time [sec]: 5.100044012069702\n"
634+
]
635+
}
636+
],
637+
"source": [
638+
"naive_DAMP(T, m, split_index) # dummpy run\n",
639+
"\n",
640+
"t_start = time.time()\n",
641+
"excl_zone_denom = core.config.STUMPY_EXCL_ZONE_DENOM\n",
642+
"core.config.STUMPY_EXCL_ZONE_DENOM = 1\n",
643+
"PL, discord_score, discord_idx = naive_DAMP(T, m, split_index)\n",
644+
"core.config.STUMPY_EXCL_ZONE_DENOM = excl_zone_denom\n",
645+
"t_end = time.time()\n",
646+
"\n",
647+
"print('discord_dist: ', discord_score)\n",
648+
"print('discord_index: ', discord_idx)\n",
649+
"print('running time [sec]: ', t_end - t_start)"
650+
]
651+
},
652+
{
653+
"cell_type": "code",
654+
"execution_count": 15,
655+
"id": "78d09bda",
656+
"metadata": {},
657+
"outputs": [
658+
{
659+
"name": "stdout",
660+
"output_type": "stream",
661+
"text": [
662+
"discord_dist: 7.606279752022363\n",
663+
"discord_index: 8109\n",
664+
"running time [sec]: 6.70897912979126\n"
665+
]
666+
}
667+
],
668+
"source": [
669+
"DAMP(T, m, split_index) # dummpy run\n",
670+
"\n",
671+
"t_start = time.time()\n",
672+
"excl_zone_denom = core.config.STUMPY_EXCL_ZONE_DENOM\n",
673+
"core.config.STUMPY_EXCL_ZONE_DENOM = 1\n",
674+
"PL, discord_score, discord_idx = DAMP(T, m, split_index)\n",
675+
"core.config.STUMPY_EXCL_ZONE_DENOM = excl_zone_denom\n",
676+
"t_end = time.time()\n",
677+
"\n",
678+
"print('discord_dist: ', discord_score)\n",
679+
"print('discord_index: ', discord_idx)\n",
680+
"print('running time [sec]: ', t_end - t_start)"
681+
]
682+
},
683+
{
684+
"cell_type": "markdown",
685+
"id": "90688aa9",
686+
"metadata": {},
687+
"source": [
688+
"## Example 3"
689+
]
690+
},
691+
{
692+
"cell_type": "code",
693+
"execution_count": 16,
609694
"id": "6d64f488",
610695
"metadata": {},
611696
"outputs": [],
@@ -620,7 +705,7 @@
620705
},
621706
{
622707
"cell_type": "code",
623-
"execution_count": 19,
708+
"execution_count": 17,
624709
"id": "159e03dc",
625710
"metadata": {},
626711
"outputs": [
@@ -630,7 +715,7 @@
630715
"text": [
631716
"discord_dist: 29.42331306408431\n",
632717
"discord_index: 6110\n",
633-
"running time [sec]: 5.537461042404175\n"
718+
"running time [sec]: 5.572257995605469\n"
634719
]
635720
}
636721
],
@@ -651,7 +736,7 @@
651736
},
652737
{
653738
"cell_type": "code",
654-
"execution_count": 20,
739+
"execution_count": 18,
655740
"id": "9ef28e10",
656741
"metadata": {},
657742
"outputs": [
@@ -661,7 +746,7 @@
661746
"text": [
662747
"discord_dist: 29.423313064084333\n",
663748
"discord_index: 6110\n",
664-
"running time [sec]: 55.6033251285553\n"
749+
"running time [sec]: 55.545814990997314\n"
665750
]
666751
}
667752
],

0 commit comments

Comments
 (0)