docstr: If the priors are close to real parameters, the result is very accurate
docstr_tok: ["If","the","priors","are","close","to","real","parameters",",","the","result","is","very","accurate"]
code: def test_em_with_close_priors(self):
      """If the priors are close to real parameters, the result is very accurate"""
      df, sm, node_states, true_lv_values = naive_bayes_plus_parents(
          p_c=0.6,
          parents=1,
          children=2,
          percentage_not_missing=0,
      )
      correct_cpds = get_correct_cpds(
          df, sm, node_states, true_lv_values
      )
      priors = EMSingleLatentVariable.get_default_priors(
          sm, node_states, "z"
      )
      cte = 200
  
      # Setting boxes
      for el in ["c_1", "c_0", "z"]:
          priors[el].loc[:] = correct_cpds[el] * cte
  
      em = EMSingleLatentVariable(
          data=df,
          sm=sm,
          node_states=node_states,
          lv_name="z",
          priors=priors,
      )
      em.run(n_runs=20, stopping_delta=0.01, verbose=2)
  
      max_error, rmse_error = compare_result_with_ideal(
          em.cpds, sm, df, true_lv_values, node_states
      )
      assert max_error < 0.01
      assert rmse_error < 4e-3
  
imports: from collections import Counter
  from typing import Any, AnyStr, Dict, Iterable, List, Set, Tuple, Union
  import numpy
  import pandas
  import pytest
  from causalnex.estimator.em import EMSingleLatentVariable
  from causalnex.network import BayesianNetwork
  from causalnex.structure.structuremodel import StructureModel
  from causalnex.utils.data_utils import states_to_df
label_desc: Use image node_id 3 for calling the TestPriors obj's underlying member method code with example usage: obj.test_em_with_close_priors() without return types