code: def test_error_transform_full(N=20, rseed=0):
      rng = np.random.RandomState(rseed)
      X = rng.rand(N, 2)
  
      # generate a pos-definite error matrix
      Sigma = 0.05 * rng.randn(N, N)
      u, s, v = np.linalg.svd(Sigma)
      Sigma = np.dot(u * s, u.T)
  
      # draw y from this error distribution
      y = X[:, 0] ** 2 + X[:, 1]
      y = rng.multivariate_normal(y, Sigma)
  
      X2, y2 = LinearRegression._scale_by_error(X, y, Sigma)
  
      # check that the form entering the chi^2 is correct
      assert_allclose(
          np.dot(X2.T, X2), np.dot(X.T, np.linalg.solve(Sigma, X))
      )
      assert_allclose(
          np.dot(y2, y2), np.dot(y, np.linalg.solve(Sigma, y))
      )
  
file_path: astroML/astroML/linear_model/tests/test_linear_regression.py
imports: import pytest
  import numpy
  from numpy.testing import assert_allclose
  from sklearn.linear_model import LinearRegression
  from astroML.linear_model import LinearRegression, PolynomialRegression, BasisFunctionRegression
label_desc: Use image node_id 2 for calling a global function with example usage: test_error_transform_full(N, rseed) without return types