input: Write a python function to perform linear regression using numpy.
  assert np.allclose(linear_regression(np.array([1, 2, 3]), np.array([2, 2.5, 3.5])), np.array([1.16666667, 0.5]), atol=1e-6)
  assert np.allclose(linear_regression(np.array([1, 2, 4]), np.array([2, 3, 5])), np.array([1.25, 0.75]), atol=1e-6)
  assert np.allclose(linear_regression(np.array([0, 1, 2]), np.array([1, 3, 5])), np.array([1., 2.]), atol=1e-6)
output: import numpy as np
  
  def linear_regression(x, y):
      n = len(x)
      x_mean = np.mean(x)
      y_mean = np.mean(y)
      
      xy_cov = np.sum((x - x_mean) * (y - y_mean))
      xx_cov = np.sum((x - x_mean) ** 2)
      
      slope = xy_cov / xx_cov
      intercept = y_mean - slope * x_mean
      
      return np.array([intercept, slope])