code: def heldout_score(clf, X_test, y_test):
      """compute deviance scores on ``X_test`` and ``y_test``."""
      score = np.zeros((n_estimators,), dtype=np.float64)
      for i, y_proba in enumerate(clf.staged_predict_proba(X_test)):
          score[i] = 2 * log_loss(y_test, y_proba[:, 1])
      return score
  
file_path: scikit-learn/examples/ensemble/plot_gradient_boosting_oob.py
imports: import matplotlib.pyplot
  import numpy
  from scipy.special import expit
  from sklearn import ensemble
  from sklearn.metrics import log_loss
  from sklearn.model_selection import KFold, train_test_split
label_desc: Use image node_id 1 for calling a global function with example usage: heldout_score(clf, X_test, y_test) and returns: score