class_docstr: Defines the configuration for generating counterfactuals.
class_docstr_tok: ["Defines","the","configuration","for","generating","counterfactuals","."]
code: def load_config(config_directory_path):
      config_path = (
          config_directory_path / CounterfactualConfig.CONFIG_FILE_NAME
      )
      with open(config_path, "r") as config_file:
          cf_config = json.load(config_file)
  
      counterfactual_config = CounterfactualConfig(
          method=cf_config[CounterfactualConfig.METHOD],
          continuous_features=cf_config[
              CounterfactualConfig.CONTINUOUS_FEATURES
          ],
          total_CFs=cf_config[CounterfactualConfig.TOTAL_CFS],
          desired_class=cf_config[CounterfactualConfig.DESIRED_CLASS],
          desired_range=cf_config[CounterfactualConfig.DESIRED_RANGE],
          permitted_range=cf_config[
              CounterfactualConfig.PERMITTED_RANGE
          ],
          features_to_vary=cf_config[
              CounterfactualConfig.FEATURES_TO_VARY
          ],
          feature_importance=cf_config[
              CounterfactualConfig.FEATURE_IMPORTANCE
          ],
          id=cf_config[CounterfactualConfig.ID],
      )
  
      return counterfactual_config
  
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 5 for calling the CounterfactualConfig obj's underlying member method code with example usage: obj.load_config(config_directory_path) and returns: counterfactual_config