class_docstr: Linear model (scikit-learn): https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html
  
  Model backend differs depending on problem_type:
  
      'binary' & 'multiclass': https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html
  
      'regression': https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html#sklearn.linear_model.Ridge
code: def _fit(
      self,
      X,
      y,
      time_limit=None,
      num_cpus=-1,
      sample_weight=None,
      **kwargs,
  ):
      time_fit_start = time.time()
      X = self.preprocess(X, is_train=True)
      if self.problem_type == BINARY:
          y = y.astype(int).values
  
      params = {
          k: v
          for k, v in self.params.items()
          if k not in preprocess_params_set
      }
      if "n_jobs" not in params:
          if self.problem_type != REGRESSION:
              params["n_jobs"] = num_cpus
  
      # Ridge/Lasso are using alpha instead of C, which is C^-1
      # https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html#sklearn.linear_model.Ridge
      if self.problem_type == REGRESSION and "alpha" not in params:
          # For numerical reasons, using alpha = 0 with the Lasso object is not advised, so we add epsilon
          params["alpha"] = 1 / (
              params["C"] if params["C"] != 0 else 1e-8
          )
          params.pop("C", None)
  
      logger.log(
          15,
          f"Training Model with the following hyperparameter settings:",
      )
      logger.log(15, params)
  
      max_iter = params.pop("max_iter", 10000)
  
      # TODO: copy_X=True currently set during regression problem type, could potentially set to False to avoid unnecessary data copy.
      model_cls = self._get_model_type()
  
      time_fit_model_start = time.time()
      if time_limit is not None:
          time_left = time_limit - (
              time_fit_model_start - time_fit_start
          )
          time_left = time_left - 0.2  # Account for 0.2s of overhead
          if time_left <= 0:
              raise TimeLimitExceeded
      else:
          time_left = None
  
      if (
          time_left is not None
          and max_iter >= 200
          and self.problem_type != REGRESSION
      ):
          max_iter_list = [100, max_iter - 100]
      else:
          max_iter_list = [max_iter]
  
      fit_args = dict(X=X, y=y)
      if sample_weight is not None:
          fit_args["sample_weight"] = sample_weight
  
      if len(max_iter_list) > 1:
          params["warm_start"] = True  # Force True
  
      total_iter = 0
      total_iter_used = 0
      total_max_iter = sum(max_iter_list)
      model = model_cls(max_iter=max_iter_list[0], **params)
      early_stop = False
      for i, cur_max_iter in enumerate(max_iter_list):
          if time_left is not None and (i > 0):
              time_spent = time.time() - time_fit_model_start
              time_left_train = time_left - time_spent
              time_per_iter = time_spent / total_iter
              time_to_train_cur_max_iter = time_per_iter * cur_max_iter
              if time_to_train_cur_max_iter > time_left_train:
                  cur_max_iter = min(
                      int(time_left_train / time_per_iter) - 1,
                      cur_max_iter,
                  )
                  if cur_max_iter <= 0:
                      logger.warning(
                          f"\tEarly stopping due to lack of time remaining. Fit {total_iter}/{total_max_iter} iters..."
                      )
                      break
                  early_stop = True
  
          model.max_iter = cur_max_iter
          with warnings.catch_warnings():
              # Filter the not-converged warning since we are purposefully training in increments.
              # FIXME: Annoyingly, this doesn't filter the warning on Mac due to how multiprocessing works when n_cpus>1. Unsure how to fix.
              warnings.simplefilter(
                  action="ignore", category=UserWarning
              )
              model = model.fit(**fit_args)
          total_iter += model.max_iter
          if model.n_iter_ is not None:
              if isinstance(model.n_iter_, int):
                  total_iter_used += model.n_iter_
              else:
                  try:
                      # FIXME: For some reason this crashes on regression with some versions of scikit-learn.
                      total_iter_used += model.n_iter_[0]
                  except:
                      pass
          else:
              total_iter_used += model.max_iter
          if early_stop:
              if total_iter_used == total_iter:  # Not yet converged
                  logger.warning(
                      f"\tEarly stopping due to lack of time remaining. Fit {total_iter}/{total_max_iter} iters..."
                  )
              break
  
      self.model = model
      self.params_trained["max_iter"] = total_iter
  
imports: import logging
  import re
  import time
  import warnings
  from collections import defaultdict
  import numpy
  from sklearn.compose import ColumnTransformer
  from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.impute import SimpleImputer
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import QuantileTransformer, StandardScaler
  from autogluon.common.features.types import R_BOOL, R_CATEGORY, R_FLOAT, R_INT, R_OBJECT, S_BOOL, S_TEXT_AS_CATEGORY
  from autogluon.core.constants import BINARY, REGRESSION
  from autogluon.core.models import AbstractModel
  from autogluon.core.utils.exceptions import TimeLimitExceeded
  from .hyperparameters.parameters import IGNORE, INCLUDE, ONLY, _get_solver, get_param_baseline, preprocess_params_set
  from .hyperparameters.searchspaces import get_default_searchspace
  from .lr_preprocessing_utils import NlpDataPreprocessor, OheFeaturesGenerator
label_desc: Use image node_id 10 for calling the LinearModel obj's underlying member method code with example usage: obj._fit(X, y, time_limit, num_cpus, sample_weight) without return types