code: def tune_pipeline(X, y, X_val, y_val, generate_model, tuner):
      
      print("Tuning with GP tuner for %s iterations" % TUNING_BUDGET_PER_ITER)
      for i in range(TUNING_BUDGET_PER_ITER):
          params = tuner.propose()
          # create model using proposed hyperparams from tuner
          model = generate_model(params)
          model.fit(X, y)
          predicted = model.predict(X_val)
          score = accuracy_score(predicted, y_val)
          # record hyper-param combination and score for tuning
          tuner.add(params, score)
      print("Final score:", tuner._best_score)
docs: Tunes a specified pipeline with the
      specified tuner for TUNING_BUDGET_PER_ITER (3) iterations.
  
      Params:
          X: np.array of X training data
          y: np.array of y training data
          X_val: np.array of X validation data
          y_val: np.array of y validation data
          generate_model: function that returns an slkearn model to fit
          tuner: BTB tuner object for tuning hyperparameters