code: def test_relative_frequency():
      assert (
          np.abs(
              _relative_frequency(np.array([True, True, False, True]))
              - 4 / 5
          )
          < 0.1
      )
  
file_path: dowhy/tests/gcm/test_anomaly_attribution.py
imports: import networkx
  import numpy
  import pandas
  from flaky import flaky
  from pytest import approx
  from dowhy.gcm import AdditiveNoiseModel, InverseDensityScorer, InvertibleStructuralCausalModel, MedianCDFQuantileScorer, attribute_anomalies, auto, fit
  from dowhy.gcm.anomaly import _relative_frequency, attribute_anomaly_scores
  from dowhy.gcm.density_estimators import GaussianMixtureDensityEstimator
  from dowhy.gcm.ml import PredictionModel
label_desc: Use image node_id 6 for calling a global function with example usage: test_relative_frequency() without return types