docstr: ...Test that estimated cumulants are correct
          
docstr_tok: ["...","Test","that","estimated","cumulants","are","correct"]
code: def test_hawkes_cumulants(self):
      """...Test that estimated cumulants are correct"""
  
      multi = Test.get_simulated_model()
      timestamps = multi.timestamps
      baseline = multi.hawkes_simu.baseline
      adjacency = multi.hawkes_simu.adjacency
      decays = multi.hawkes_simu.decays
      integration_support = 0.3
      n_nodes = multi.hawkes_simu.n_nodes
  
      theoretical_cumulant = HawkesTheoreticalCumulant(n_nodes)
      self.assertEqual(theoretical_cumulant.dimension, n_nodes)
      theoretical_cumulant.baseline = baseline
      theoretical_cumulant.adjacency = adjacency
  
      np.testing.assert_array_almost_equal(
          theoretical_cumulant.baseline, baseline
      )
      np.testing.assert_array_almost_equal(
          theoretical_cumulant.adjacency, adjacency
      )
      np.testing.assert_array_almost_equal(
          np.eye(theoretical_cumulant.dimension)
          - np.linalg.inv(theoretical_cumulant._R),
          adjacency,
      )
  
      theoretical_cumulant.compute_cumulants()
      expected_L = theoretical_cumulant.mean_intensity
      expected_C = theoretical_cumulant.covariance
      expected_K = theoretical_cumulant.skewness
  
      learner = HawkesCumulantMatching(
          integration_support=integration_support
      )
      learner._set_data(timestamps)
      self.assertFalse(learner._cumulant_computer.cumulants_ready)
      learner.compute_cumulants()
      self.assertTrue(learner._cumulant_computer.cumulants_ready)
  
      # Test 1 - mean intensity
      # Test 1.1 - relative magnitudes of mean intensity are the same as
      # realtive magnitudes of expected mean intensity
      self._test_relative_magnitudes(
          estimated=learner.mean_intensity,
          expected=expected_L,
          quantity_name="mean intensity",
          significance_threshold=1e-7,
      )
      # Test 1.2 - estimated mean intensity is close to expected mean intensity
      np.testing.assert_allclose(
          learner.mean_intensity,
          expected_L,
          atol=0.005,
          rtol=0.015,
      )
  
      # Test 2 - covariance
      # Test 2.1 - relative magnitudes of estimated covariances are the same
      # as relative magnitudes of expected covariances
      self._test_relative_magnitudes(
          estimated=learner.covariance,
          expected=expected_C,
          quantity_name="variance",
          significance_threshold=5.75e-5,
      )
      # Test 2.2 - estimated covariance is close to expected covariance
      np.testing.assert_allclose(
          learner.covariance,
          expected_C,
          atol=0.03,  # Can we design a test that succeed when tolerance is lower?
          rtol=0.05,
      )
  
      # Test 3 - skewness
      # Test 3.1 - relative magnitudes of estimated skewnesss are the same
      # as relative magnitudes of expected skewnesss
      self._test_relative_magnitudes(
          estimated=learner.skewness,
          expected=expected_K,
          quantity_name="skewness",
          significance_threshold=6.75e-5,
      )
      # Test 3.2 - estimated skewness is close to expected covariance
      np.testing.assert_allclose(
          learner.skewness,
          expected_K,
          atol=0.15,  # Can we design a test that succeed when tolerance is lower?
          rtol=0.2,
      )
  
      self.assertGreater(learner.approximate_optimal_cs_ratio(), 0.0)
  
      learner._set_data(timestamps)
      self.assertTrue(learner._cumulant_computer.cumulants_ready)
  
imports: import os
  import pickle
  import unittest
  import numpy
  from tick.base.inference import InferenceTest
  from tick.hawkes import HawkesCumulantMatching, HawkesCumulantMatchingTf, HawkesCumulantMatchingPyT
  from tick.hawkes.inference.hawkes_cumulant_matching import HawkesTheoreticalCumulant
label_desc: Use image node_id 4 for calling the Test obj's underlying member method code with example usage: obj.test_hawkes_cumulants() without return types