class_docstr: Injects random trend changes into a time series.
  
  At a high level, the transform tracks the velocity (trend) of a time series
  and then, when injecting a trend change at a particular time, it scales
  the current velocity by a random factor. The disturbance to the velocity is 
  persisted to values in the near future, thus emulating a sudden change of trend.
  
  Let, ``(a,b)`` be the scale range. If the first trend change happens at time ``t*``, 
  it is injected as follows:
  
  .. math::
      \tilde{y}_{t^*} = y_{t^*-1} + v_{t^*} + \Delta v_{t^*} \\
      \begin{align*}
      \text{where } & \Delta v_{t^*} = Sign \times Z \times v_{t^*}, \\
      & v_{t^*} = y_{t^*} - y_{t^*-1}
      & Z \sim Unif(a,b), \\
      & Sign \text{ is a random sign} \\
      \end{align*}
  
  Afterward, the trend change is persisted and ``y_t`` (for ``t > t*``) is changed as follows:
  
  .. math::
      \tilde{y}_{t} = \tilde{y}_{t-1} + v_t + \beta \times \Delta v_{t^*}
code: def __init__(
      self,
      alpha: float = 0.5,
      beta: float = 0.95,
      pos_prob: float = 0.5,
      scale_range: Tuple[float, float] = (0.5, 3.0),
      **kwargs,
  ):
      super().__init__(**kwargs)
      """
          :param alpha: The recency weight to use when calculating recency-weighted
              standard deviation.
          :param beta: A parameter controlling the degree of trend change persistence.
          :param pos_prob: The probably with which a shock's sign is positive.
          :param scale_range: The range of possible values by which a time series's
              velocity will be scaled.
          """
      assert all(0 <= param <= 1 for param in (alpha, beta, pos_prob))
      self.alpha = alpha
      self.beta = beta
      self.scale_range = scale_range
      self.pos_prob = pos_prob
  
imports: from abc import abstractmethod
  from typing import Tuple
  import numpy
  import pandas
  from merlion.transform.base import Identity, TransformBase
  from merlion.transform.bound import LowerUpperClip
  from merlion.utils.time_series import UnivariateTimeSeries, TimeSeries
label_desc: Use image node_id 1 to create a new TrendChange object from inherited base classes: Anomalize with example: obj = TrendChange(alpha, beta, pos_prob, scale_range)