class_docstr: Counterfactual Reinforcement Learning. 
class_docstr_tok: ["Counterfactual","Reinforcement","Learning","."]
docstr: Parameter serialization. The function replaces object by human-readable representation.
  
  Parameters
  ----------
  params
      Dictionary of parameters to be serialized.
  
  Returns
  -------
  Human-readable replacement of data.
code: def _serialize_params(params: Dict[str, Any]) -> Dict[str, Any]:
      """
      Parameter serialization. The function replaces object by human-readable representation.
  
      Parameters
      ----------
      params
          Dictionary of parameters to be serialized.
  
      Returns
      -------
      Human-readable replacement of data.
      """
      meta = dict()
  
      for param, value in params.items():
          if param in _PARAM_TYPES["primitives"]:
              # primitive types are passed as they are
              meta.update({param: value})
  
          elif param in _PARAM_TYPES["complex"]:
              if isinstance(value, list):
                  # each complex element in the list is serialized by replacing it with a name
                  meta.update(
                      {
                          param: [
                              CounterfactualRL._get_name(v)
                              for v in value
                          ]
                      }
                  )
              else:
                  # complex element is serialized by replacing it with a name
                  meta.update(
                      {param: CounterfactualRL._get_name(value)}
                  )
          else:
              # Unknown parameters are passed as they are. TODO: think of a better way to handle this.
              meta.update({param: value})
  
      return meta
  
imports: import logging
  import os
  from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Union, cast
  import numpy
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_CFRL, DEFAULT_META_CFRL
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.explainers.backends.cfrl_base import generate_empty_condition, get_classification_reward, get_hard_distribution, identity_function
  from alibi.utils.frameworks import Framework, has_pytorch, has_tensorflow
label_desc: Use image node_id 2 for calling the CounterfactualRL obj's underlying member method code with example usage: obj._serialize_params(params) and returns: meta