code: def make_predictions(model, algo, calibrate):
      r"""Make predictions for the training and testing data.
  
      Parameters
      ----------
      model : alphapy.Model
          The model object with specifications.
      algo : str
          Abbreviation of the algorithm to make predictions.
      calibrate : bool
          If ``True``, calibrate the probabilities for a classifier.
  
      Returns
      -------
      model : alphapy.Model
          The model object with the predictions.
  
      Notes
      -----
      For classification, calibration is a precursor to making the
      actual predictions. In this case, AlphaPy predicts both labels
      and probabilities. For regression, real values are predicted.
  
      """
  
      logger.info("Final Model Predictions for %s", algo)
  
      # Extract model parameters.
  
      cal_type = model.specs["cal_type"]
      cv_folds = model.specs["cv_folds"]
      model_type = model.specs["model_type"]
  
      # Get the estimator
  
      est = model.estimators[algo]
  
      # Extract model data.
  
      try:
          support = model.support[algo]
          X_train = model.X_train[:, support]
          X_test = model.X_test[:, support]
      except:
          X_train = model.X_train
          X_test = model.X_test
      y_train = model.y_train
  
      # Calibration
  
      if model_type == ModelType.classification:
          if calibrate:
              logger.info("Calibrating Classifier")
              est = CalibratedClassifierCV(
                  est, cv=cv_folds, method=cal_type
              )
              est.fit(X_train, y_train)
              model.estimators[algo] = est
              logger.info("Calibration Complete")
          else:
              logger.info("Skipping Calibration")
  
      # Make predictions on original training and test data.
  
      logger.info("Making Predictions")
      model.preds[(algo, Partition.train)] = est.predict(X_train)
      model.preds[(algo, Partition.test)] = est.predict(X_test)
      if model_type == ModelType.classification:
          model.probas[(algo, Partition.train)] = est.predict_proba(
              X_train
          )[:, 1]
          model.probas[(algo, Partition.test)] = est.predict_proba(
              X_test
          )[:, 1]
      logger.info("Predictions Complete")
  
      # Return the model
      return model
  
imports: from alphapy.estimators import scorers
  from alphapy.estimators import xgb_score_map
  from alphapy.features import feature_scorers
  from alphapy.frame import read_frame
  from alphapy.frame import write_frame
  from alphapy.globals import Encoders
  from alphapy.globals import ModelType
  from alphapy.globals import Objective
  from alphapy.globals import Partition, datasets
  from alphapy.globals import PSEP, SSEP, USEP
  from alphapy.globals import SamplingMethod
  from alphapy.globals import Scalers
  from alphapy.utilities import get_datestamp
  from alphapy.utilities import most_recent_file
  from copy import copy
  from datetime import datetime
  import itertools
  import joblib
  from keras.models import load_model
  import logging
  import numpy
  import pandas
  from sklearn.calibration import CalibratedClassifierCV
  from sklearn.linear_model import LogisticRegression
  from sklearn.linear_model import RidgeCV
  from sklearn.metrics import accuracy_score
  from sklearn.metrics import auc
  from sklearn.metrics import average_precision_score
  from sklearn.metrics import balanced_accuracy_score
  from sklearn.metrics import brier_score_loss
  from sklearn.metrics import classification_report
  from sklearn.metrics import cohen_kappa_score
  from sklearn.metrics import confusion_matrix
  from sklearn.metrics import explained_variance_score
  from sklearn.metrics import f1_score
  from sklearn.metrics import log_loss
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import mean_squared_log_error
  from sklearn.metrics import median_absolute_error
  from sklearn.metrics import precision_score
  from sklearn.metrics import r2_score
  from sklearn.metrics import recall_score
  from sklearn.metrics import roc_auc_score
  from sklearn.metrics import roc_curve
  from sklearn.metrics.cluster import adjusted_rand_score
  from sklearn.model_selection import cross_val_score
  from sklearn.model_selection import train_test_split
  import sys
  import yaml
label_desc: Use image node_id 7 for calling a global function with example usage: make_predictions(model, algo, calibrate) and returns: model