code: def gradient_boosting(df_1, y, json_file, trained=True):
      """
      gradient_boosting  training function
      :param df_1: dataframe
      :param y: is the target column
      :trained: whether the model is already trained or not
      :return compiled gradient_boosting model
      """
      loss = "deviance"
      learning_rate = 0.1
      n_estimators = 100
      criterion = "friedman_mse"
  
      if "params" in json_file:
          parameters = json_file["params"]
          if "loss" in json_file["params"]:
              loss = parameters["loss"]
          if "learning_rate" in json_file["params"]:
              learning_rate = parameters["learning_rate"]
          if "n_estimators" in json_file["params"]:
              n_estimators = parameters["n_estimators"]
          if "criterion" in json_file["params"]:
              criterion = parameters["criterion"]
  
          clf = GradientBoostingClassifier(
              loss=loss,
              learning_rate=learning_rate,
              n_estimators=n_estimators,
              criterion="friedman_mse",
          )
  
          if trained:
              clf.fit(df_1, y)
      else:
          parameters = {
              "learning_rate": [
                  0.01,
                  0.025,
                  0.05,
                  0.075,
                  0.1,
                  0.15,
                  0.2,
              ],
              "criterion": ["friedman_mse", "mae"],
              "n_estimators": range(5, 15),
          }
          clf = GradientBoostingClassifier()
          clf.fit(df_1, y)
          grid = GridSearchCV(clf, param_grid=parameters, verbose=1)
  
          grid.fit(df_1, y)
  
      return clf
  
imports: from sklearn.tree import DecisionTreeClassifier
  from sklearn import svm
  import numpy
  from sklearn.linear_model import SGDClassifier
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.ensemble import GradientBoostingClassifier
  from sklearn.ensemble import AdaBoostClassifier
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.neural_network import MLPClassifier
  from sklearn.metrics import accuracy_score
  from sklearn.ensemble import ExtraTreesClassifier
  from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
  import warnings
label_desc: Use image node_id 6 for calling a global function with example usage: gradient_boosting(df_1, y, json_file, trained) and returns: clf