MCPcopy Index your code
hub / github.com/stumpy-dev/stumpy / update

Method update

stumpy/floss.py:604–700  ·  view source on GitHub ↗

Ingress a new data point, `t`, onto the time series, `T`, followed by egressing the oldest single data point from `T`. Then, update the 1-dimensional corrected arc curve (CAC_1D) and the matrix profile. Parameters ---------- t : float A s

(self, t)

Source from the content-addressed store, hash-verified

602 self._cac = np.ones(self._k, dtype=np.float64) * -1
603
604 def update(self, t):
605 """
606 Ingress a new data point, `t`, onto the time series, `T`, followed by egressing
607 the oldest single data point from `T`. Then, update the 1-dimensional corrected
608 arc curve (CAC_1D) and the matrix profile.
609
610 Parameters
611 ----------
612 t : float
613 A single new data point to be appended to `T`
614
615 Returns
616 -------
617 None
618
619 Notes
620 -----
621 DOI: 10.1109/ICDM.2017.21 \
622 <https://www.cs.ucr.edu/~eamonn/Segmentation_ICDM.pdf>`__
623
624 See Section C
625
626 This is the implementation for Fast Low-cost Online Semantic
627 Segmentation (FLOSS).
628 """
629 self._T[:-1] = self._T[1:]
630 self._T_isfinite[:-1] = self._T_isfinite[1:]
631 self._finite_T[:-1] = self._finite_T[1:]
632 self._finite_Q[:-1] = self._finite_Q[1:]
633
634 self._T[-1] = t
635 self._T_isfinite[-1] = np.isfinite(t)
636 self._finite_T[-1] = t
637 if not np.isfinite(t):
638 self._finite_T[-1] = 0.0
639 self._finite_Q[-1] = self._finite_T[-1]
640 excl_zone = int(np.ceil(self._m / config.STUMPY_EXCL_ZONE_DENOM))
641 # Note that the start of the exclusion zone is relative to
642 # the unchanging length of the matrix profile index
643 zone_start = max(0, self._k - excl_zone)
644
645 # Egress
646 # Remove the first element in the matrix profile index
647 # Shift mp up by one and replace the last row with new values
648 self._mp[:-1, :] = self._mp[1:, :]
649 self._mp[-1, 0] = np.inf
650 self._mp[-1, 3] = self._last_idx
651
652 # Ingress
653 if self._normalize:
654 self._T_subseq_isconstant[:-1] = self._T_subseq_isconstant[1:]
655 self._Q_subseq_isconstant = core.process_isconstant(
656 self._T[-self._m :], self._m, self._T_subseq_isconstant_func
657 )
658 self._T_subseq_isconstant[-1] = self._Q_subseq_isconstant
659
660 self._M_T[:-1] = self._M_T[1:]
661 self._Σ_T[:-1] = self._Σ_T[1:]

Callers 2

__init__.pyFile · 0.45
allcFunction · 0.45

Calls 1

_cacFunction · 0.85

Tested by

no test coverage detected