code: def _init_avg(X, barycenter_size):
      if X.shape[1] == barycenter_size:
          return numpy.nanmean(X, axis=0)
      else:
          X_avg = numpy.nanmean(X, axis=0)
          xnew = numpy.linspace(0, 1, barycenter_size)
          f = interp1d(
              numpy.linspace(0, 1, X_avg.shape[0]),
              X_avg,
              kind="linear",
              axis=0,
          )
          return f(xnew)
  
imports: import numpy
  import warnings
  from scipy.interpolate import interp1d
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils import check_random_state
  from ..metrics import dtw_path
  from ..utils import to_time_series_dataset, ts_size
  from .utils import _set_weights
label_desc: Use image node_id 1 for calling a global function with example usage: _init_avg(X, barycenter_size) and returns: numpy, f