code: def integrated_brier_score(
      survival_train, survival_test, estimate, times
  ):
      """The Integrated Brier Score (IBS) provides an overall calculation of
      the model performance at all available times :math:`t_1 \\leq t \\leq t_\\text{max}`.
  
      The integrated time-dependent Brier score over the interval
      :math:`[t_1; t_\\text{max}]` is defined as
  
      .. math::
  
          \\mathrm{IBS} = \\int_{t_1}^{t_\\text{max}} \\mathrm{BS}^c(t) d w(t)
  
      where the weighting function is :math:`w(t) = t / t_\\text{max}`.
      The integral is estimated via the trapezoidal rule.
  
      See the :ref:`User Guide </user_guide/evaluating-survival-models.ipynb#Time-dependent-Brier-Score>`
      and [1]_ for further details.
  
      Parameters
      ----------
      survival_train : structured array, shape = (n_train_samples,)
          Survival times for training data to estimate the censoring
          distribution from.
          A structured array containing the binary event indicator
          as first field, and time of event or time of censoring as
          second field.
  
      survival_test : structured array, shape = (n_samples,)
          Survival times of test data.
          A structured array containing the binary event indicator
          as first field, and time of event or time of censoring as
          second field.
  
      estimate : array-like, shape = (n_samples, n_times)
          Estimated probability of remaining event-free at time points
          specified by `times`. The value of ``estimate[i]`` must correspond to
          the estimated probability of remaining event-free up to the time point
          ``times[i]``. Typically, estimated probabilities are obtained via the
          survival function returned by an estimator's
          ``predict_survival_function`` method.
  
      times : array-like, shape = (n_times,)
          The time points for which to estimate the Brier score.
          Values must be within the range of follow-up times of
          the test data `survival_test`.
  
      Returns
      -------
      ibs : float
          The integrated Brier score.
  
      Examples
      --------
      >>> import numpy as np
      >>> from sksurv.datasets import load_gbsg2
      >>> from sksurv.linear_model import CoxPHSurvivalAnalysis
      >>> from sksurv.metrics import integrated_brier_score
      >>> from sksurv.preprocessing import OneHotEncoder
  
      Load and prepare data.
  
      >>> X, y = load_gbsg2()
      >>> X.loc[:, "tgrade"] = X.loc[:, "tgrade"].map(len).astype(int)
      >>> Xt = OneHotEncoder().fit_transform(X)
  
      Fit a Cox model.
  
      >>> est = CoxPHSurvivalAnalysis(ties="efron").fit(Xt, y)
  
      Retrieve individual survival functions and get probability
      of remaining event free from 1 year to 5 years (=1825 days).
  
      >>> survs = est.predict_survival_function(Xt)
      >>> times = np.arange(365, 1826)
      >>> preds = np.asarray([[fn(t) for t in times] for fn in survs])
  
      Compute the integrated Brier score from 1 to 5 years.
  
      >>> score = integrated_brier_score(y, y, preds, times)
      >>> print(score)
      0.1815853064627424
  
      See also
      --------
      brier_score
          Computes the Brier score at specified time points.
  
      as_integrated_brier_score_scorer
          Wrapper class that uses :func:`integrated_brier_score`
          in its ``score`` method instead of the default
          :func:`concordance_index_censored`.
  
      References
      ----------
      .. [1] E. Graf, C. Schmoor, W. Sauerbrei, and M. Schumacher,
             "Assessment and comparison of prognostic classification schemes for survival data,"
             Statistics in Medicine, vol. 18, no. 17-18, pp. 2529–2545, 1999.
      """
      # Computing the brier scores
      times, brier_scores = brier_score(
          survival_train, survival_test, estimate, times
      )
  
      if times.shape[0] < 2:
          raise ValueError("At least two time points must be given")
  
      # Computing the IBS
      ibs_value = np.trapz(brier_scores, times) / (times[-1] - times[0])
  
      return ibs_value
  
imports: import numpy
  from sklearn.base import BaseEstimator
  from sklearn.utils import check_array, check_consistent_length
  from sklearn.utils.metaestimators import available_if
  from sklearn.utils.validation import check_is_fitted
  from .exceptions import NoComparablePairException
  from .nonparametric import CensoringDistributionEstimator, SurvivalFunctionEstimator
  from .util import check_y_survival
label_desc: Use image node_id 11 for calling a global function with example usage: integrated_brier_score(survival_train, survival_test, estimate, times) and returns: ibs_value