code: def create_rai_insights_object_regression(with_model=True):
      housing = fetch_california_housing()
      X_train, X_test, y_train, y_test = train_test_split(
          housing.data,
          housing.target,
          train_size=500,
          test_size=50,
          random_state=7,
      )
      X_train = pd.DataFrame(X_train, columns=housing.feature_names)
      X_test = pd.DataFrame(X_test, columns=housing.feature_names)
  
      rfc = RandomForestRegressor(
          n_estimators=10, max_depth=4, random_state=777
      )
      model = rfc.fit(X_train, y_train)
  
      if not with_model:
          all_data = pd.concat([X_test, X_train])
          model_predict_output = model.predict(all_data)
          model_wrapper = PredictionsModelWrapperRegression(
              all_data, model_predict_output
          )
          verify_predict_outputs(model, model_wrapper, all_data)
          model = model_wrapper
  
      X_train["target"] = y_train
      X_test["target"] = y_test
  
      ri = RAIInsights(model, X_train, X_test, "target", "regression")
      ri.explainer.add()
      if with_model:
          ri.counterfactual.add(10, desired_range=[3, 5])
      ri.error_analysis.add()
      ri.causal.add(
          treatment_features=["AveRooms"],
          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 4 for calling a global function with example usage: create_rai_insights_object_regression(with_model) and returns: ri