code: def residuals(regressor, X, y):
      # Create the train and test splits
      (
          X_train,
          X_test,
          y_train,
          y_test,
      ) = model_selection.train_test_split(X, y, test_size=0.2)
  
      # Store labels and colors for the legend ordered by call
      regressor.fit(X_train, y_train)
      train_score_ = regressor.score(X_train, y_train)
      test_score_ = regressor.score(X_test, y_test)
  
      y_pred_train = regressor.predict(X_train)
      residuals_train = y_pred_train - y_train
  
      y_pred_test = regressor.predict(X_test)
      residuals_test = y_pred_test - y_test
  
      table = make_table(
          y_pred_train,
          residuals_train,
          y_pred_test,
          residuals_test,
          train_score_,
          test_score_,
      )
      chart = wandb.visualize("wandb/residuals_plot/v1", table)
  
      return chart
  
imports: from warnings import simplefilter
  from sklearn import model_selection
  import wandb
  from wandb.sklearn import utils
label_desc: Use image node_id 1 for calling a global function with example usage: residuals(regressor, X, y) and returns: chart