class_docstr: Defines the top-level Model Analysis API.
  Use RAIInsights to analyze errors, explain the most important
  features, compute counterfactuals and run causal analysis in a
  single API.
class_docstr_tok: ["Defines","the","top-level","Model","Analysis","API",".","Use","RAIInsights","to","analyze","errors",",","explain","the","most","important","features",",","compute","counterfactuals","and","run","causal","analysis","in","a","single","API","."]
docstr: Load the metadata.
  
  :param inst: RAIInsights object instance.
  :type inst: RAIInsights
  :param path: The directory path to metadata location.
  :type path: str
docstr_tok: ["Load","the","metadata",".",":","param","inst",":","RAIInsights","object","instance",".",":","type","inst",":","RAIInsights",":","param","path",":","The","directory","path","to","metadata","location",".",":","type","path",":","str"]
code: def _load_metadata(inst, path):
      """Load the metadata.
  
      :param inst: RAIInsights object instance.
      :type inst: RAIInsights
      :param path: The directory path to metadata location.
      :type path: str
      """
      top_dir = Path(path)
      with open(top_dir / Metadata.META_JSON, "r") as meta_file:
          meta = meta_file.read()
      meta = json.loads(meta)
      inst.__dict__[Metadata.TARGET_COLUMN] = meta[
          Metadata.TARGET_COLUMN
      ]
      inst.__dict__[Metadata.TASK_TYPE] = meta[Metadata.TASK_TYPE]
      inst.__dict__[Metadata.CATEGORICAL_FEATURES] = meta[
          Metadata.CATEGORICAL_FEATURES
      ]
      classes = None
      if _TRAIN_LABELS in meta:
          classes = meta[_TRAIN_LABELS]
      else:
          classes = meta[Metadata.CLASSES]
  
      inst.__dict__["_" + Metadata.CLASSES] = RAIInsights._get_classes(
          task_type=meta[Metadata.TASK_TYPE],
          train=inst.__dict__[Metadata.TRAIN],
          target_column=meta[Metadata.TARGET_COLUMN],
          classes=classes,
      )
  
      inst.__dict__["_" + Metadata.FEATURE_COLUMNS] = meta[
          Metadata.FEATURE_COLUMNS
      ]
      inst.__dict__["_" + Metadata.FEATURE_RANGES] = meta[
          Metadata.FEATURE_RANGES
      ]
      if (
          Metadata.FEATURE_METADATA not in meta
          or meta[Metadata.FEATURE_METADATA] is None
      ):
          inst.__dict__[
              "_" + Metadata.FEATURE_METADATA
          ] = FeatureMetadata()
      else:
          inst.__dict__[
              "_" + Metadata.FEATURE_METADATA
          ] = FeatureMetadata(
              identity_feature_name=meta[Metadata.FEATURE_METADATA][
                  _IDENTITY_FEATURE_NAME
              ],
              datetime_features=meta[Metadata.FEATURE_METADATA][
                  _DATETIME_FEATURES
              ],
              time_series_id_features=meta[Metadata.FEATURE_METADATA][
                  _TIME_SERIES_ID_FEATURES
              ],
              categorical_features=meta[Metadata.FEATURE_METADATA][
                  _CATEGORICAL_FEATURES
              ],
              dropped_features=meta[Metadata.FEATURE_METADATA][
                  _DROPPED_FEATURES
              ],
          )
  
      all_features_names = inst.__dict__["_" + Metadata.FEATURE_COLUMNS]
      categorical_features = inst.__dict__[
          Metadata.CATEGORICAL_FEATURES
      ]
      dataset = inst.__dict__[Metadata.TEST].drop(
          columns=[inst.__dict__[Metadata.TARGET_COLUMN]]
      )
      (
          inst.__dict__["_" + Metadata.CATEGORIES],
          inst.__dict__["_" + Metadata.CATEGORICAL_INDEXES],
          inst.__dict__["_" + Metadata.CATEGORY_DICTIONARY],
          inst.__dict__["_" + Metadata.STRING_IND_DATA],
      ) = process_categoricals(
          all_feature_names=all_features_names,
          categorical_features=categorical_features,
          dataset=dataset,
      )
  
imports: import json
  import pickle
  import warnings
  from enum import Enum
  from pathlib import Path
  from typing import Any, List, Optional, Union
  import numpy
  import pandas
  from erroranalysis._internal.cohort_filter import FilterDataWithCohortFilters
  from erroranalysis._internal.process_categoricals import process_categoricals
  from raiutils.data_processing import convert_to_list
  from raiutils.exceptions import SystemErrorException, UserConfigValidationException
  from raiutils.models import Forecasting, ModelTask, SKLearn
  from responsibleai._interfaces import Dataset, RAIInsightsData, TabularDatasetMetadata
  from responsibleai._internal._forecasting_wrappers import _wrap_model
  from responsibleai._internal.constants import FileFormats, ManagerNames, Metadata, SerializationAttributes
  from responsibleai.feature_metadata import FeatureMetadata
  from responsibleai.managers.causal_manager import CausalManager
  from responsibleai.managers.counterfactual_manager import CounterfactualManager
  from responsibleai.managers.data_balance_manager import DataBalanceManager
  from responsibleai.managers.error_analysis_manager import ErrorAnalysisManager
  from responsibleai.managers.explainer_manager import ExplainerManager
  from responsibleai.rai_insights.rai_base_insights import RAIBaseInsights
label_desc: Use image node_id 35 for calling the RAIInsights obj's underlying member method code with example usage: obj._load_metadata(inst, path) without return types