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","."]
code: def _validate_classes(
      self, model, train, test, target_column, feature_metadata, classes
  ):
      if classes is not None:
          self._validate_classes_helper(
              identified_classes=set(train[target_column].unique()),
              user_classes=set(classes),
          )
  
          self._validate_classes_helper(
              identified_classes=set(test[target_column].unique()),
              user_classes=set(classes),
              if_train_data=False,
          )
  
          if model is not None:
              if (
                  feature_metadata is not None
                  and feature_metadata.dropped_features is not None
                  and len(feature_metadata.dropped_features) != 0
              ):
                  features_to_drop = (
                      feature_metadata.dropped_features
                      + [target_column]
                  )
              else:
                  features_to_drop = [target_column]
  
              train_data = train.drop(columns=features_to_drop, axis=1)
              test_data = test.drop(columns=features_to_drop, axis=1)
  
              train_predictions = model.predict(train_data)
              test_predictions = model.predict(test_data)
  
              self._validate_classes_helper(
                  identified_classes=set(np.unique(train_predictions)),
                  user_classes=set(classes),
                  if_predictions=True,
              )
  
              self._validate_classes_helper(
                  identified_classes=set(np.unique(test_predictions)),
                  user_classes=set(classes),
                  if_train_data=False,
                  if_predictions=True,
              )
  
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 11 for calling the RAIInsights obj's underlying member method code with example usage: obj._validate_classes(model, train, test, target_column, feature_metadata, classes) without return types