class_docstr: Total least squares estimator for N-dimensional lines.
  
  In contrast to ordinary least squares line estimation, this estimator
  minimizes the orthogonal distances of points to the estimated line.
  
  Lines are defined by a point (origin) and a unit vector (direction)
  according to the following vector equation::
  
      X = origin + lambda * direction
  
  Attributes
  ----------
  params : tuple
      Line model parameters in the following order `origin`, `direction`.
  
  Examples
  --------
  >>> x = np.linspace(1, 2, 25)
  >>> y = 1.5 * x + 3
  >>> lm = LineModelND()
  >>> lm.estimate(np.stack([x, y], axis=-1))
  True
  >>> tuple(np.round(lm.params, 5))
  (array([1.5 , 5.25]), array([0.5547 , 0.83205]))
  >>> res = lm.residuals(np.stack([x, y], axis=-1))
  >>> np.abs(np.round(res, 9))
  array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0.])
  >>> np.round(lm.predict_y(x[:5]), 3)
  array([4.5  , 4.562, 4.625, 4.688, 4.75 ])
  >>> np.round(lm.predict_x(y[:5]), 3)
  array([1.   , 1.042, 1.083, 1.125, 1.167])
class_docstr_tok: ["Total","least","squares","estimator","for","N-dimensional","lines",".","In","contrast","to","ordinary","least","squares","line","estimation",",","this","estimator","minimizes","the","orthogonal","distances","of","points","to","the","estimated","line",".","Lines","are","defined","by","a","point","(","origin",")","and","a","unit","vector","(","direction",")","according","to","the","following","vector","equation",":",":","X","=","origin","+","lambda","*","direction","Attributes","--","--","--","--","--","params",":","tuple","Line","model","parameters","in","the","following","order","`","origin","`",",","`","direction","`",".","Examples","--","--","--","--",">",">",">","x","=","np.linspace","(","1",",","2",",","25",")",">",">",">","y","=","1.5","*","x","+","3",">",">",">","lm","=","LineModelND","(",")",">",">",">","lm.estimate","(","np.stack","(","[","x",",","y","]",",","axis=-1",")",")","True",">",">",">","tuple","(","np.round","(","lm.params",",","5",")",")","(","array","(","[","1.5",",","5.25","]",")",",","array","(","[","0.5547",",","0.83205","]",")",")",">",">",">","res","=","lm.residuals","(","np.stack","(","[","x",",","y","]",",","axis=-1",")",")",">",">",">","np.abs","(","np.round","(","res",",","9",")",")","array","(","[","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0",".","]",")",">",">",">","np.round","(","lm.predict_y","(","x","[",":5","]",")",",","3",")","array","(","[","4.5",",","4.562",",","4.625",",","4.688",",","4.75","]",")",">",">",">","np.round","(","lm.predict_x","(","y","[",":5","]",")",",","3",")","array","(","[","1.",",","1.042",",","1.083",",","1.125",",","1.167","]",")"]
docstr: Predict x-coordinates for 2D lines using the estimated model.
  
  Alias for::
  
      predict(y, axis=1)[:, 0]
  
  Parameters
  ----------
  y : array
      y-coordinates.
  params : (2,) array, optional
      Optional custom parameter set in the form (`origin`, `direction`).
  
  Returns
  -------
  x : array
      Predicted x-coordinates.
docstr_tok: ["Predict","x-coordinates","for","2D","lines","using","the","estimated","model",".","Alias","for",":",":","predict","(","y",",","axis=1",")","[",":",",","0","]","Parameters","--","--","--","--","--","y",":","array","y-coordinates",".","params",":","(","2",",",")","array",",","optional","Optional","custom","parameter","set","in","the","form","(","`","origin","`",",","`","direction","`",")",".","Returns","--","--","--","-","x",":","array","Predicted","x-coordinates","."]
code: def predict_x(self, y, params=None):
      """Predict x-coordinates for 2D lines using the estimated model.
  
      Alias for::
  
          predict(y, axis=1)[:, 0]
  
      Parameters
      ----------
      y : array
          y-coordinates.
      params : (2,) array, optional
          Optional custom parameter set in the form (`origin`, `direction`).
  
      Returns
      -------
      x : array
          Predicted x-coordinates.
  
      """
      x = self.predict(y, axis=1, params=params)[:, 0]
      return x
  
imports: import math
  from warnings import warn
  import numpy
  from numpy.linalg import inv
  from scipy import optimize, spatial
label_desc: Use image node_id 4 for calling the LineModelND obj's underlying member method code with example usage: obj.predict_x(y, params) and returns: x