code: def sgd(df_1, y, json_file, trained=True):
      """
      sgd  training function
      :param df_1: dataframe
      :param y: is the target column
      :trained: whether the model is already trained or not
      :return compiled sgd model
      """
  
      loss = "hinge"
      alpha = 0.0001
      fit_intercept = True
      max_iter = 1000
  
      if "params" in json_file:
          parameters = json_file["params"]
          if "loss" in json_file["params"]:
              loss = parameters["loss"]
          if "alpha" in json_file["params"]:
              alpha = parameters["alpha"]
          if "fit_intercept" in json_file["params"]:
              fit_intercept = parameters["fit_intercept"]
          if "max_iter" in json_file["params"]:
              max_iter = parameters["max_iter"]
  
          clf = SGDClassifier(
              loss=loss,
              alpha=alpha,
              fit_intercept=fit_intercept,
              max_iter=max_iter,
          )
  
          if trained:
              clf.fit(df_1, y)
      else:
          param_grid = {
              "average": [True, False],
              "alpha": np.power(10, np.arange(-4, 1, dtype=float)),
          }
          clf = SGDClassifier()
          clf.fit(df_1, y)
  
          grid = GridSearchCV(clf, param_grid=param_grid, verbose=1)
          clf = 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 5 for calling a global function with example usage: sgd(df_1, y, json_file, trained) and returns: clf