class_docstr: Simple Linear Regression with errors in y
  
  This is a stripped-down version of sklearn.linear_model.LinearRegression
  which can correctly accounts for errors in the y variable
  
  Parameters
  ----------
  fit_intercept : bool (optional)
      if True (default) then fit the intercept of the data
  regularization : string (optional)
      ['l1'|'l2'|'none'] Use L1 (Lasso) or L2 (Ridge) regression
  kwds: dict
      additional keyword arguments passed to sklearn estimators:
      LinearRegression, Lasso (L1), or Ridge (L2)
  
  Notes
  -----
  This implementation may be compared to that in
  sklearn.linear_model.LinearRegression.
  The difference is that here errors are
class_docstr_tok: ["Simple","Linear","Regression","with","errors","in","y","This","is","a","stripped-down","version","of","sklearn.linear_model.LinearRegression","which","can","correctly","accounts","for","errors","in","the","y","variable","Parameters","--","--","--","--","--","fit_intercept",":","bool","(","optional",")","if","True","(","default",")","then","fit","the","intercept","of","the","data","regularization",":","string","(","optional",")","[","'l1'|'l2'|'none","'","]","Use","L1","(","Lasso",")","or","L2","(","Ridge",")","regression","kwds",":","dict","additional","keyword","arguments","passed","to","sklearn","estimators",":","LinearRegression",",","Lasso","(","L1",")",",","or","Ridge","(","L2",")","Notes","--","--","-","This","implementation","may","be","compared","to","that","in","sklearn.linear_model.LinearRegression",".","The","difference","is","that","here","errors","are"]
docstr: Scale regression by error on y
docstr_tok: ["Scale","regression","by","error","on","y"]
code: def _scale_by_error(X, y, y_error=1):
      """Scale regression by error on y"""
      X = np.atleast_2d(X)
      y = np.asarray(y)
      y_error = np.asarray(y_error)
  
      assert X.ndim == 2
      assert y.ndim == 1
      assert X.shape[0] == y.shape[0]
  
      if y_error.ndim == 0:
          return X / y_error, y / y_error
  
      elif y_error.ndim == 1:
          assert y_error.shape == y.shape
          X_out, y_out = X / y_error[:, None], y / y_error
  
      elif y_error.ndim == 2:
          assert y_error.shape == (y.size, y.size)
          evals, evecs = np.linalg.eigh(y_error)
          X_out = np.dot(evecs * (evals**-0.5), np.dot(evecs.T, X))
          y_out = np.dot(evecs * (evals**-0.5), np.dot(evecs.T, y))
      else:
          raise ValueError("shape of y_error does not match that of y")
  
      return X_out, y_out
  
imports: import numpy
  from sklearn.base import BaseEstimator
  from sklearn.preprocessing import PolynomialFeatures
  from sklearn.linear_model import LinearRegression, Lasso, Ridge
label_desc: Use image node_id 3 for calling the LinearRegression obj's underlying member method code with example usage: obj._scale_by_error(X, y, y_error) and returns: X_out,  y_out, unknown,  unknown