class_docstr: Vowpal Wabbit Scikit-learn Base Estimator wrapper
class_docstr_tok: ["Vowpal","Wabbit","Scikit-learn","Base","Estimator","wrapper"]
docstr: Fit the model according to the given training data
  
  TODO:
      For first pass create and store example objects. For N-1 passes use example objects
      directly (simulate cache file...but in memory for faster processing)
  
  Args:
      X : {array-like, sparse matrix}, shape (n_samples, n_features or 1 if not convert_to_vw) or
          Training vector, where n_samples in the number of samples and
          n_features is the number of features.
          if not using convert_to_vw, X is expected to be a list of vw formatted feature vector strings with labels
      y : array-like, shape (n_samples,), optional if not convert_to_vw
          Target vector relative to X.
      sample_weight : array-like, shape (n_samples,)
                      sample weight vector relative to X.
  
  Returns:
      self
code: def fit(self, X=None, y=None, sample_weight=None):
      """Fit the model according to the given training data
  
      TODO:
          For first pass create and store example objects. For N-1 passes use example objects
          directly (simulate cache file...but in memory for faster processing)
  
      Args:
          X : {array-like, sparse matrix}, shape (n_samples, n_features or 1 if not convert_to_vw) or
              Training vector, where n_samples in the number of samples and
              n_features is the number of features.
              if not using convert_to_vw, X is expected to be a list of vw formatted feature vector strings with labels
          y : array-like, shape (n_samples,), optional if not convert_to_vw
              Target vector relative to X.
          sample_weight : array-like, shape (n_samples,)
                          sample weight vector relative to X.
  
      Returns:
          self
      """
  
      params = {
          k: v for k, v in self.get_params().items() if v is not None
      }
  
      passes = 1
      use_data_file = params.get("data", params.get("d", False))
      if not use_data_file:
          # remove passes from vw params since we're feeding in the data manually
          passes = params.pop("passes", passes)
          if params.get("bfgs", False):
              raise RuntimeError(
                  "An external data file must be used to fit models using the bfgs option"
              )
  
      # remove estimator attributes from vw params
      for key in self._get_est_params():
          params.pop(key, None)
  
      # add vw attributes
      params.update(self._get_vw_params())
  
      self.vw_ = Workspace(**params)
  
      if X is not None:
          if self.convert_to_vw:
              X = tovw(
                  x=X,
                  y=y,
                  sample_weight=sample_weight,
                  convert_labels=self.convert_labels,
              )
  
          # add examples to model
          for n in range(passes):
              if n >= 1:
                  examples = shuffle(X)
              else:
                  examples = X
              for idx, example in enumerate(examples):
                  self.vw_.learn(example)
  
      return self
  
imports: import io
  import os
  import re
  from tempfile import NamedTemporaryFile
  from typing import Dict
  import numpy
  from scipy.sparse import csr_matrix
  from scipy.special import logit
  from sklearn.exceptions import NotFittedError
  from sklearn.base import BaseEstimator, RegressorMixin
  from sklearn.utils.extmath import log_logistic
  from sklearn.linear_model import LogisticRegression
  from sklearn.datasets import dump_svmlight_file
  from sklearn.utils import check_array, check_X_y, shuffle
  from vowpalwabbit import Workspace
label_desc: Use image node_id 3 for calling the VW obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self