class_docstr: Polynomial smoother up to a given order.
  Fit based on weighted least squares.
  
  The x values can be specified at instantiation or when called.
  
  This is a 3 liner with OLS or WLS, see test.
  It's here as a test smoother for GAM
class_docstr_tok: ["Polynomial","smoother","up","to","a","given","order",".","Fit","based","on","weighted","least","squares",".","The","x","values","can","be","specified","at","instantiation","or","when","called",".","This","is","a","3","liner","with","OLS","or","WLS",",","see","test",".","It","'s","here","as","a","test","smoother","for","GAM"]
code: def fit(self, y, x=None, weights=None):
      self.N = y.shape[0]
      if y.ndim == 1:
          y = y[:, None]
      if weights is None or np.isnan(weights).all():
          weights = 1
          _w = 1
      else:
          _w = np.sqrt(weights)[:, None]
      if x is None:
          if not hasattr(self, "X"):
              raise ValueError("x needed to fit PolySmoother")
      else:
          if x.ndim > 1:
              print(
                  "Warning: 2d x detected in PolySmoother predict, shape:",
                  x.shape,
              )
              # x=x[0,:] #TODO: check orientation, row or col
          self.X = np.array([(x**i) for i in range(self.order + 1)]).T
      # print _w.shape
  
      X = self.X * _w
  
      _y = y * _w  # [:,None]
      # self.coef = np.dot(L.pinv(X).T, _y[:,None])
      # self.coef = np.dot(L.pinv(X), _y)
      self.coef = np.linalg.lstsq(X, _y, rcond=-1)[0]
      self.params = np.squeeze(self.coef)
  
file_path: statsmodels/statsmodels/sandbox/nonparametric/smoothers.py
imports: import numpy
  from .None import kernels
label_desc: Use image node_id 9 for calling the PolySmoother obj's underlying member method code with example usage: obj.fit(y, x, weights) without return types