code: def create_rai_insights_object_classification(with_model=True):
      X, y = shap.datasets.adult()
      y = [1 if r else 0 for r in y]
  
      X, y = sklearn.utils.resample(
          X, y, n_samples=1000, random_state=7, stratify=y
      )
  
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, test_size=0.01, random_state=7, stratify=y
      )
      categorical_features = [
          "Workclass",
          "Education-Num",
          "Marital Status",
          "Occupation",
          "Relationship",
          "Race",
          "Sex",
          "Country",
      ]
  
      knn = sklearn.neighbors.KNeighborsClassifier()
      knn.fit(X_train, y_train)
  
      if not with_model:
          all_data = pd.concat([X_test, X_train])
          model_predict_output = knn.predict(all_data)
          model_predict_proba_output = knn.predict_proba(all_data)
          knn_wrapper = PredictionsModelWrapperClassification(
              all_data, model_predict_output, model_predict_proba_output
          )
          verify_predict_outputs(knn, knn_wrapper, all_data)
          verify_predict_proba_outputs(knn, knn_wrapper, all_data)
          knn = knn_wrapper
  
      X["Income"] = y
      X_test["Income"] = y_test
  
      ri = RAIInsights(
          knn,
          X,
          X_test,
          "Income",
          "classification",
          categorical_features=categorical_features,
      )
      ri.explainer.add()
      if with_model:
          ri.counterfactual.add(10, desired_class="opposite")
      ri.error_analysis.add()
      ri.causal.add(
          treatment_features=["Hours per week", "Occupation"],
          heterogeneity_features=None,
          upper_bound_on_cat_expansion=42,
          skip_cat_limit_checks=True,
      )
      ri.compute()
      return ri
  
imports: import numpy
  import pandas
  import pytest
  import shap
  import sklearn
  from ml_wrappers.model.predictions_wrapper import PredictionsModelWrapperClassification, PredictionsModelWrapperRegression
  from sklearn.datasets import fetch_california_housing, load_iris
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.model_selection import train_test_split
  from responsibleai import RAIInsights
label_desc: Use image node_id 3 for calling a global function with example usage: create_rai_insights_object_classification(with_model) and returns: ri