code: def _polyfit(x, y, order):
      """Brute force implementation of polynomial fit"""
      x = qml.math.convert_like(x, y[0])
      x = qml.math.cast_like(x, y[0])
      X = qml.math.vander(x, order + 1)
      y = qml.math.stack(y)
  
      # scale X to improve condition number and solve
      scale = qml.math.sum(qml.math.sqrt((X * X)), axis=0)
      X = X / scale
  
      # Compute coeffs:
      # This part is typically done using a lstq solver, do it with the penrose inverse by hand:
      # i.e. coeffs = (X.T @ X)**-1 X.T @ y see https://en.wikipedia.org/wiki/Polynomial_regression
      c = qml.math.linalg.pinv(qml.math.transpose(X) @ X)
      c = c @ qml.math.transpose(X)
      c = qml.math.dot(c, y)
      c = qml.math.transpose(qml.math.transpose(c) / scale)
      return c
  
file_path: pennylane/pennylane/transforms/mitigate.py
imports: from copy import copy
  from typing import Any, Dict, Optional, Sequence, Callable
  from pennylane import apply, adjoint
  from pennylane.math import mean, shape, round
  from pennylane.queuing import AnnotatedQueue
  from pennylane.tape import QuantumTape, QuantumScript
  from pennylane.transforms import transform
  import pennylane
label_desc: Use image node_id 4 for calling a global function with example usage: _polyfit(x, y, order) and returns: c