code: def test_trend_change(self):
      print()
      logger.info("test_trend_change\n" + "-" * 80 + "\n")
  
      # Create a multivariate time series with some trend changes and split it into train & test
      n, d = 300, 4
      ms = np.array(
          [
              [10, -8, 12, 50],
              [-10, 3, 0, 9],
              [-3, 2, -10, 0],
              [-2, -3, 5, -3],
              [6, -1, 1, 15],
          ]
      )
      bs = np.array(
          [
              [0, 5, 2, 3],
              [0, 0, 0, 0],
              [10, -2, -9, 8],
              [-3, 66, 2, 0],
              [85, -9, 21, 3],
          ]
      )
      sigma_basis = [
          U / np.trace(U) + np.eye(d)
          for U in np.random.randn(len(ms), d, d)
      ]
      t = np.arange(n * len(ms)).reshape(-1, 1)
      x = np.concatenate(
          [
              m * t[i * n : (i + 1) * n] + b + np.random.randn(n, d) @ U
              for i, (m, b, U) in enumerate(zip(ms, bs, sigma_basis))
          ]
      )
      x = np.concatenate((bs[0].reshape(1, -1), x))
      ts = TimeSeries.from_pd(x, freq="1min")
      train, test = ts.bisect(ts.time_stamps[2 * n])
  
      # Initialize & train BOCPD with automatic change kind detection.
      # Make sure we choose trend change & correctly detect the level shift in the training data
      bocpd = BOCPD(
          BOCPDConfig(
              change_kind=ChangeKind.Auto,
              cp_prior=1e-2,
              lag=1,
              min_likelihood=1e-12,
          )
      )
      train_scores = bocpd.train(train).to_pd().iloc[:, 0].abs()
      self.assertEqual(bocpd.change_kind, ChangeKind.TrendChange)
      self.assertGreater(train_scores.iloc[n - 1], 2)
  
      # Evaluate trained BOCPD model on the test data & make sure it has perfect precision & recall
      self.standard_check(
          bocpd=bocpd, test_data=test, n=n, name="trend_change"
      )
  
file_path: merlion/tests/change_point/test_bocpd.py
imports: import logging
  import os
  from os.path import abspath, dirname, join
  import sys
  import unittest
  import numpy
  import pandas
  from merlion.models.anomaly.change_point.bocpd import BOCPD, BOCPDConfig, ChangeKind
  from merlion.utils.time_series import TimeSeries
label_desc: Use image node_id 4 for calling the TestBOCPD obj's underlying member method code with example usage: obj.test_trend_change() without return types