code: def test_svrg_callback(bin_train_data):
      class Callback(object):
          def __init__(self, X, y):
              self.X = X
              self.y = y
              self.obj = []
  
          def __call__(self, clf):
              clf._finalize_coef()
              y_pred = clf.decision_function(self.X).ravel()
              loss = (np.maximum(1 - self.y * y_pred, 0) ** 2).mean()
              coef = clf.coef_.ravel()
              regul = 0.5 * clf.alpha * np.dot(coef, coef)
              self.obj.append(loss + regul)
  
      X_bin, y_bin = bin_train_data
      cb = Callback(X_bin, y_bin)
      clf = SVRGClassifier(
          loss="squared_hinge",
          eta=1e-3,
          max_iter=20,
          random_state=0,
          callback=cb,
      )
      clf.fit(X_bin, y_bin)
      assert np.all(np.diff(cb.obj) <= 0)
  
file_path: lightning/lightning/impl/tests/test_svrg.py
imports: import numpy
  from lightning.classification import SVRGClassifier
  from lightning.regression import SVRGRegressor
label_desc: Use image node_id 2 for calling a global function with example usage: test_svrg_callback(bin_train_data) without return types