code: def get_expected_polynomial_coefs(y, degree, with_intercept=True):
      """Compute expected coefficients from polynomial regression."""
      t_ix = _get_X_numpy_int_from_pandas(y.index).reshape(-1)
      poly_matrix = np.vander(t_ix, degree + 1)
      if not with_intercept:
          poly_matrix = poly_matrix[:, :-1]
      return np.linalg.lstsq(poly_matrix, y.to_numpy(), rcond=None)[0]
  
file_path: sktime/sktime/forecasting/trend/tests/test_trend.py
imports: import numpy
  import pandas
  import pytest
  from sktime.datasets import load_airline
  from sktime.forecasting.trend import PolynomialTrendForecaster, TrendForecaster
  from sktime.forecasting.trend._util import _get_X_numpy_int_from_pandas
  from sktime.utils._testing.forecasting import make_forecasting_problem
label_desc: Use image node_id 2 for calling a global function with example usage: get_expected_polynomial_coefs(y, degree, with_intercept) and returns: np