|
620 | 620 | "\n",
|
621 | 621 | "```\n",
|
622 | 622 | "mps, indices = stumpy.mstump(df, m, discords=True)\n",
|
623 |
| - "motifs_idx = np.argsort(mps, axis=1)[:, :2]\n", |
| 623 | + "discords_idx = np.argsort(-mps, axis=1)[:, :2]\n", |
624 | 624 | "k = 2\n",
|
625 |
| - "S = stumpy.subspace(df, m, motifs_idx[k][0], indices[k][motifs_idx[k][0]], k, discords=True)\n", |
| 625 | + "S = stumpy.subspace(df, m, discords_idx[k][0], indices[k][discords_idx[k][0]], k, discords=True)\n", |
626 | 626 | "```\n",
|
627 | 627 | "\n",
|
628 |
| - "Instead of returning the smallest average distance, this returns the largest average distance across $k$ dimensions. This ability to return discords is unique to STUMPY and was not published in the original paper. Also note that it is possible to include specific dimensions and search for discords at the same time:\n", |
| 628 | + "Instead of returning the smallest average distance, this returns the largest average distance across $k$ dimensions. However, note that we use `-mps` (i.e., multiply `mps` by `-1.0`) before sorting in order to focus on discords. This ability to return discords is unique to STUMPY and was not published in the original paper. Also note that it is possible to include specific dimensions and search for discords at the same time:\n", |
629 | 629 | "\n",
|
630 | 630 | "\n",
|
631 | 631 | "```\n",
|
632 | 632 | "mps, indices = stumpy.mstump(df, m, include=[0, 1], discords=True)\n",
|
633 |
| - "motifs_idx = np.argsort(mps, axis=1)[:, :2]\n", |
| 633 | + "discords_idx = np.argsort(-mps, axis=1)[:, :2]\n", |
634 | 634 | "k = 2\n",
|
635 |
| - "S = stumpy.subspace(df, m, motifs_idx[k][0], indices[k][motifs_idx[k][0]], k, include=[0, 1], discords=True)\n", |
| 635 | + "S = stumpy.subspace(df, m, discords_idx[k][0], indices[k][discords_idx[k][0]], k, include=[0, 1], discords=True)\n", |
636 | 636 | "```\n",
|
637 | 637 | "\n",
|
638 | 638 | "In this case, the dimensions listed in `include` are honored first and then all subsequent dimensions are sorted by their largest average distance across $k$ dimensions."
|
|
672 | 672 | "name": "python",
|
673 | 673 | "nbconvert_exporter": "python",
|
674 | 674 | "pygments_lexer": "ipython3",
|
675 |
| - "version": "3.9.6" |
| 675 | + "version": "3.9.7" |
676 | 676 | }
|
677 | 677 | },
|
678 | 678 | "nbformat": 4,
|
|
0 commit comments