class_docstr: Linear regressor.
  
  :param loss: the loss function to be optimized. 
      The quadratic loss L2 is the only one supported.
  :type loss: str, {'l2'}, default='l2'
  
  :param max_iteration_count: the maximum number of iterations.
  :type max_iteration_count: int, default=1000
  
  :param error_weight: the error weight relative to the regularization coefficient.
  :type error_weight: float, default=1.0
  
  :param sigmoid: the predefined sigmoid function coefficients.
  :type sigmoid: array of 2 float, default=(0.0, 0.0)
  
  :param tolerance: the stop criterion.
      -1 means calculate stop criterion automatically, 
      from the amount of vectors in each class in the training sample.
  :type tolerance: float, default=-1.0
  
  :param normalizeError: specifies if the error should be normalized.
  :type normalizeError: bool, default=False
  
  :param l1_reg: the L1 regularization coefficient.
      If 0, L2 regularization will be used instead.
  :type l1_reg: float, default=0.0
  
  :param thread_count: the number of threads to be used while training the model.
  :type thread_count: int, default=1
class_docstr_tok: ["Linear","regressor",".",":","param","loss",":","the","loss","function","to","be","optimized",".","The","quadratic","loss","L2","is","the","only","one","supported",".",":","type","loss",":","str",",","{","'l2","'","}",",","default='l2'",":","param","max_iteration_count",":","the","maximum","number","of","iterations",".",":","type","max_iteration_count",":","int",",","default=1000",":","param","error_weight",":","the","error","weight","relative","to","the","regularization","coefficient",".",":","type","error_weight",":","float",",","default=1.0",":","param","sigmoid",":","the","predefined","sigmoid","function","coefficients",".",":","type","sigmoid",":","array","of","2","float",",","default=","(","0.0",",","0.0",")",":","param","tolerance",":","the","stop","criterion",".","-1","means","calculate","stop","criterion","automatically",",","from","the","amount","of","vectors","in","each","class","in","the","training","sample",".",":","type","tolerance",":","float",",","default=-1.0",":","param","normalizeError",":","specifies","if","the","error","should","be","normalized",".",":","type","normalizeError",":","bool",",","default=False",":","param","l1_reg",":","the","L1","regularization","coefficient",".","If","0",",","L2","regularization","will","be","used","instead",".",":","type","l1_reg",":","float",",","default=0.0",":","param","thread_count",":","the","number","of","threads","to","be","used","while","training","the","model",".",":","type","thread_count",":","int",",","default=1"]
docstr: Trains the linear regression model.
  
  :param X: the training sample. The values will be converted 
      to ``dtype=np.float32``. If a sparse matrix is
      passed in, it will be converted to a sparse ``csr_matrix``.
  :type X: {array-like, sparse matrix} of shape (n_samples, n_features)
  
  :param Y: correct function values (``float``) for the training set vectors.
  :type Y: array-like of shape (n_samples,)
  
  :param weight: sample weights. If None, then samples are equally weighted.
  :type weight: array-like of shape (n_samples,), default=None
  
  :return: the trained regression model.
  :rtype: neoml.Linear.LinearRegressionModel
docstr_tok: ["Trains","the","linear","regression","model",".",":","param","X",":","the","training","sample",".","The","values","will","be","converted","to","``","dtype=np.float32","``",".","If","a","sparse","matrix","is","passed","in",",","it","will","be","converted","to","a","sparse","``","csr_matrix","``",".",":","type","X",":","{","array-like",",","sparse","matrix","}","of","shape","(","n_samples",",","n_features",")",":","param","Y",":","correct","function","values","(","``","float","``",")","for","the","training","set","vectors",".",":","type","Y",":","array-like","of","shape","(","n_samples",",",")",":","param","weight",":","sample","weights",".","If","None",",","then","samples","are","equally","weighted",".",":","type","weight",":","array-like","of","shape","(","n_samples",",",")",",","default=None",":","return",":","the","trained","regression","model",".",":","rtype",":","neoml.Linear.LinearRegressionModel"]
code: def train(self, X, Y, weight=None):
      """Trains the linear regression model.
  
      :param X: the training sample. The values will be converted
          to ``dtype=np.float32``. If a sparse matrix is
          passed in, it will be converted to a sparse ``csr_matrix``.
      :type X: {array-like, sparse matrix} of shape (n_samples, n_features)
  
      :param Y: correct function values (``float``) for the training set vectors.
      :type Y: array-like of shape (n_samples,)
  
      :param weight: sample weights. If None, then samples are equally weighted.
      :type weight: array-like of shape (n_samples,), default=None
  
      :return: the trained regression model.
      :rtype: neoml.Linear.LinearRegressionModel
      """
      x = convert_data(X)
      y = numpy.array(Y, dtype=numpy.float32, copy=False, order="C")
  
      if x.shape[0] != y.size:
          raise ValueError(
              "The `X` and `Y` inputs must be the same length."
          )
  
      if weight is None:
          weight = numpy.ones(y.size, numpy.float32, order="C")
      else:
          weight = numpy.array(
              weight, dtype=numpy.float32, copy=False, order="C"
          )
  
      if numpy.any(weight < 0):
          raise ValueError("All `weight` elements must be >= 0.")
  
      return LinearRegressionModel(
          super().train_regressor(
              *get_data(x), int(x.shape[1]), y, weight
          )
      )
  
file_path: neoml/NeoML/Python/neoml/Linear.py
imports: import numpy
  from .Utils import convert_data, get_data
  from scipy.sparse import csr_matrix, issparse
  import neoml.PythonWrapper
label_desc: Use image node_id 2 for calling the LinearRegressor obj's underlying member method code with example usage: obj.train(X, Y, weight) and returns: LinearRegressionModel