class_docstr: Ordinary least squares linear regression.
  
  Parameters
  ------------
  method : string (default: 'direct')
      For gradient descent-based optimization, use `sgd` (see `minibatch`
      parameter for further options). Otherwise, if `direct` (default),
      the analytical method is used. For alternative, numerically more
      stable solutions, use either `qr` (QR decomopisition) or `svd`
      (Singular Value Decomposition).
  eta : float (default: 0.01)
      solver learning rate (between 0.0 and 1.0). Used with `method =`
      `'sgd'`. (See `methods` parameter for details)
  epochs : int (default: 50)
      Passes over the training dataset.
      Prior to each epoch, the dataset is shuffled
      if `minibatches > 1` to prevent cycles in stochastic gradient descent.
      Used with `method = 'sgd'`. (See `methods` parameter for details)
  minibatches : int (default: None)
      The number of minibatches for gradient-based optimization.
      If None: Direct method, QR, or SVD method (see `method` parameter
               for details)
      If 1: Gradient Descent learning
      If len(y): Stochastic Gradient Descent learning
      If 1 < minibatches < len(y): Minibatch learning
  random_seed : int (default: None)
      Set random state for shuffling and initializing the weights. Used in
      `method = 'sgd'`. (See `methods` parameter for details)
  print_progress : int (default: 0)
      Prints progress in fitting to stderr if `method = 'sgd'`.
      0: No output
      1: Epochs elapsed and cost
      2: 1 plus time elapsed
      3: 2 plus estimated time until completion
  
  Attributes
  -----------
  w_ : 2d-array, shape={n_features, 1}
    Model weights after fitting.
  b_ : 1d-array, shape={1,}
    Bias unit after fitting.
  cost_ : list
      Sum of squared errors after each epoch;
      ignored if solver='normal equation'
  
  Examples
  -----------
  For usage examples, please see
  https://rasbt.github.io/mlxtend/user_guide/regressor/LinearRegression/
class_docstr_tok: ["Ordinary","least","squares","linear","regression",".","Parameters","--","--","--","--","--","--","method",":","string","(","default",":","'direct","'",")","For","gradient","descent-based","optimization",",","use","`","sgd","`","(","see","`","minibatch","`","parameter","for","further","options",")",".","Otherwise",",","if","`","direct","`","(","default",")",",","the","analytical","method","is","used",".","For","alternative",",","numerically","more","stable","solutions",",","use","either","`","qr","`","(","QR","decomopisition",")","or","`","svd","`","(","Singular","Value","Decomposition",")",".","eta",":","float","(","default",":","0.01",")","solver","learning","rate","(","between","0.0","and","1.0",")",".","Used","with","`","method","=","`","`","'sgd","'","`",".","(","See","`","methods","`","parameter","for","details",")","epochs",":","int","(","default",":","50",")","Passes","over","the","training","dataset",".","Prior","to","each","epoch",",","the","dataset","is","shuffled","if","`","minibatches",">","1","`","to","prevent","cycles","in","stochastic","gradient","descent",".","Used","with","`","method","=","'sgd","'","`",".","(","See","`","methods","`","parameter","for","details",")","minibatches",":","int","(","default",":","None",")","The","number","of","minibatches","for","gradient-based","optimization",".","If","None",":","Direct","method",",","QR",",","or","SVD","method","(","see","`","method","`","parameter","for","details",")","If","1",":","Gradient","Descent","learning","If","len","(","y",")",":","Stochastic","Gradient","Descent","learning","If","1","<","minibatches","<","len","(","y",")",":","Minibatch","learning","random_seed",":","int","(","default",":","None",")","Set","random","state","for","shuffling","and","initializing","the","weights",".","Used","in","`","method","=","'sgd","'","`",".","(","See","`","methods","`","parameter","for","details",")","print_progress",":","int","(","default",":","0",")","Prints","progress","in","fitting","to","stderr","if","`","method","=","'sgd","'","`",".","0",":","No","output","1",":","Epochs","elapsed","and","cost","2",":","1","plus","time","elapsed","3",":","2","plus","estimated","time","until","completion","Attributes","--","--","--","--","--","-","w_",":","2d-array",",","shape=","{","n_features",",","1","}","Model","weights","after","fitting",".","b_",":","1d-array",",","shape=","{","1",",","}","Bias","unit","after","fitting",".","cost_",":","list","Sum","of","squared","errors","after","each","epoch",";","ignored","if","solver='normal","equation'","Examples","--","--","--","--","--","-","For","usage","examples",",","please","see","https",":","\/\/rasbt.github.io\/mlxtend\/user_guide\/regressor\/LinearRegression\/"]
docstr: Solve linear regression analytically.
docstr_tok: ["Solve","linear","regression","analytically","."]
code: def _normal_equation(self, X, y):
      """Solve linear regression analytically."""
      Xb = np.hstack((np.ones((X.shape[0], 1)), X))
      w = np.zeros(X.shape[1])
      z = np.linalg.inv(np.dot(Xb.T, Xb))
      params = np.dot(z, np.dot(Xb.T, y))
      b, w = np.array([params[0]]), params[1:].reshape(X.shape[1], 1)
      return b, w
  
file_path: mlxtend/mlxtend/regressor/linear_regression.py
imports: from time import time
  import numpy
  from .._base import _BaseModel, _IterativeModel, _Regressor
label_desc: Use image node_id 3 for calling the LinearRegression obj's underlying member method code with example usage: obj._normal_equation(X, y) and returns: b,  w