code: def generate_data(case):
      """Generate regression/classification data."""
      if case == "regression":
          X, y = datasets.load_diabetes(return_X_y=True)
          train_size = 0.8
      elif case == "classification":
          X, y = datasets.fetch_20newsgroups_vectorized(
              subset="all", return_X_y=True
          )
          train_size = 0.4  # to make the example run faster
  
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, train_size=train_size, random_state=0
      )
  
      data = {
          "X_train": X_train,
          "X_test": X_test,
          "y_train": y_train,
          "y_test": y_test,
      }
      return data
  
file_path: scikit-learn/examples/applications/plot_model_complexity_influence.py
imports: import time
  import matplotlib.pyplot
  import numpy
  from sklearn import datasets
  from sklearn.ensemble import GradientBoostingRegressor
  from sklearn.linear_model import SGDClassifier
  from sklearn.metrics import hamming_loss, mean_squared_error
  from sklearn.model_selection import train_test_split
  from sklearn.svm import NuSVR
label_desc: Use image node_id 1 for calling a global function with example usage: generate_data(case) and returns: data