code: def average(scores, estimator_weights=None):
      """Combination method to merge the scores from multiple estimators
      by taking the average.
  
      Parameters
      ----------
      scores : numpy array of shape (n_samples, n_estimators)
          Score matrix from multiple estimators on the same samples.
  
      estimator_weights : numpy array of shape (1, n_estimators)
          If specified, using weighted average.
  
      Returns
      -------
      combined_scores : numpy array of shape (n_samples, )
          The combined scores.
  
      """
      scores = check_array(scores)
  
      if estimator_weights is not None:
          if estimator_weights.shape != (1, scores.shape[1]):
              raise ValueError(
                  "Bad input shape of estimator_weight: (1, {score_shape}),"
                  "and {estimator_weights} received".format(
                      score_shape=scores.shape[1],
                      estimator_weights=estimator_weights.shape,
                  )
              )
  
          # (d1*w1 + d2*w2 + ...+ dn*wn)/(w1+w2+...+wn)
          # generated weighted scores
          scores = np.sum(
              np.multiply(scores, estimator_weights), axis=1
          ) / np.sum(estimator_weights)
          return scores.ravel()
  
      else:
          return np.mean(scores, axis=1).ravel()
  
file_path: combo/combo/models/score_comb.py
imports: import numpy
  from numpy.random import RandomState
  from sklearn.utils import check_array
  from sklearn.utils import column_or_1d
  from sklearn.utils import shuffle
  from sklearn.utils.extmath import weighted_mode
  from sklearn.utils.random import sample_without_replacement
  from numpy.testing import assert_equal
  from sklearn.utils.multiclass import check_classification_targets
  from pyod.utils.utility import check_parameter
label_desc: Use image node_id 4 for calling a global function with example usage: average(scores, estimator_weights) and returns: scores, np