code: def linear_surrogate_weights(
      x_perturbations: np.ndarray,
      y_perturbations: np.ndarray,
      surrogate: LinearSurrogateModel = None,
  ):
      """Function to compute weights from a linear interpretable model
      using provided time series pertubations."""
  
      if surrogate is None:
          surrogate = LinearRegressionSurrogate()
  
      surrogate.fit(
          x_perturbations.reshape(x_perturbations.shape[0], -1),
          y_perturbations.reshape(y_perturbations.shape[0], -1),
      )
  
      # retrieve weights
      return surrogate, surrogate.get_weights()
  
file_path: AIX360/aix360/algorithms/tslime/surrogate.py
imports: from abc import abstractmethod
  import numpy
  from sklearn.linear_model import LinearRegression
label_desc: Use image node_id 1 for calling a global function with example usage: linear_surrogate_weights(x_perturbations, y_perturbations, surrogate) and returns: surrogate,  surrogate