docstr: If we provide initial parameters close to the real ones,
  EM should converge to values close to the real ones
  EM will still converge to a solution different to whether we observed all missing values
docstr_tok: ["If","we","provide","initial","parameters","close","to","the","real","ones",",","EM","should","converge","to","values","close","to","the","real","ones","EM","will","still","converge","to","a","solution","different","to","whether","we","observed","all","missing","values"]
code: def test_initial_params_provided(self):
      """
      If we provide initial parameters close to the real ones,
      EM should converge to values close to the real ones
      EM will still converge to a solution different to whether we observed all missing values
      """
      df, sm, node_states, true_lv_values = naive_bayes_plus_parents(
          p_c=0.6,
          parents=1,
          children=2,
          percentage_not_missing=0,
          samples=5000,
      )
      correct_cpds = get_correct_cpds(
          df, sm, node_states, true_lv_values
      )
      correct_cpds.pop("p_0", None)
  
      em = EMSingleLatentVariable(
          data=df,
          sm=sm,
          node_states=node_states,
          lv_name="z",
          initial_params=correct_cpds,
      )
      em.run(n_runs=20, stopping_delta=0.001, 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 1 for calling the TestInitialParameters obj's underlying member method code with example usage: obj.test_initial_params_provided() without return types