class_docstr: Defines the CounterfactualManager for generating counterfactuals
  from a model.
class_docstr_tok: ["Defines","the","CounterfactualManager","for","generating","counterfactuals","from","a","model","."]
code: def _get_counterfactual(
      self, counterfactual_config, counterfactual_object=None
  ):
      cfdata = CounterfactualData()
  
      if counterfactual_object is None:
          json_data = json.loads(
              counterfactual_config.counterfactual_obj.to_json()
          )
      else:
          json_data = json.loads(counterfactual_object.to_json())
  
      cfdata.cfs_list = json_data["cfs_list"]
      cfdata.feature_names = json_data["feature_names"]
      cfdata.feature_names_including_target = json_data[
          "feature_names_including_target"
      ]
      cfdata.summary_importance = json_data["summary_importance"]
      cfdata.local_importance = json_data["local_importance"]
      cfdata.model_type = json_data["model_type"]
      cfdata.desired_class = json_data["desired_class"]
      cfdata.desired_range = json_data["desired_range"]
      cfdata.id = counterfactual_config.id
      cfdata.test_data = json_data["test_data"]
      return cfdata
  
imports: import json
  import uuid
  import warnings
  from pathlib import Path
  from typing import Any, List, Optional, Union
  import dice_ml
  import jsonschema
  import numpy
  import pandas
  from dice_ml import Dice
  from dice_ml.counterfactual_explanations import CounterfactualExplanations
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
  from raiutils.exceptions import UserConfigValidationException
  from raiutils.models import ModelTask
  from responsibleai._config.base_config import BaseConfig
  from responsibleai._data_validations import validate_train_test_categories
  from responsibleai._interfaces import CounterfactualData
  from responsibleai._internal.constants import CounterfactualManagerKeys, FileFormats, ListProperties, ManagerNames
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.exceptions import DuplicateManagerConfigException, SchemaErrorException
  from responsibleai.managers.base_manager import BaseManager
  from responsibleai.utils import _find_features_having_missing_values, _measure_time
label_desc: Use image node_id 11 for calling the CounterfactualManager obj's underlying member method code with example usage: obj._get_counterfactual(counterfactual_config, counterfactual_object) and returns: cfdata