class_docstr: Vowpal Wabbit Scikit-learn Base Estimator wrapper
class_docstr_tok: ["Vowpal","Wabbit","Scikit-learn","Base","Estimator","wrapper"]
docstr: VW model constructor, exposing all supported parameters to keep sklearn happy
  
  Args:
      convert_to_vw (bool): flag to convert X input to vw format
      convert_labels (bool): Convert labels of the form [0,1] to [-1,1]
      ring_size (int): size of example ring
      strict_parse (bool): throw on malformed examples
      learning_rate,l (float): Set learning rate
      power_t (float): t power value
      decay_learning_rate (float): Set Decay factor for learning_rate between passes
      initial_t (float): initial t value
      feature_mask (str): Use existing regressor to determine which parameters may be updated.
          If no initial_regressor given, also used for initial weights.
      initial_regressor,i (str): Initial regressor(s)
      initial_weight (float): Set all weights to an initial value of arg.
      random_weights (bool): make initial weights random
      normal_weights (bool): make initial weights normal
      truncated_normal_weights (bool): make initial weights truncated normal
      sparse_weights (float): Use a sparse datastructure for weights
      input_feature_regularizer (str): Per feature regularization input file
      quiet (bool): Don't output disgnostics and progress updates
      random_seed (integer): seed random number generator
      hash (str): , all
      hash_seed (int): seed for hash function
      ignore (str): ignore namespaces beginning with character <arg>
      ignore_linear (str): ignore namespaces beginning with character <arg> for linear terms only
      keep (str): keep namespaces beginning with character <arg>
      redefine (str): Redefine namespaces beginning with characters of string S as namespace N. <arg> shall be in
          form 'N:=S' where := is operator. Empty N or S are treated as default namespace.
          Use ':' as a wildcard in S.
      bit_precision,b (integer): number of bits in the feature table
      noconstant (bool): Don't add a constant feature
      constant,C (float): Set initial value of constant
      ngram (str): Generate N grams. To generate N grams for a single namespace 'foo', arg should be fN.
      skips (str): Generate skips in N grams. This in conjunction with the ngram tag can be used to generate
          generalized n-skip-k-gram. To generate n-skips for a single namespace 'foo', arg should be fN.
      feature_limit (str): limit to N features. To apply to a single namespace 'foo', arg should be fN
      affix (str): generate prefixes/suffixes of features; argument '+2a,-3b,+1' means generate 2-char prefixes for
          namespace a, 3-char suffixes for b and 1 char prefixes for default namespace
      spelling (str): compute spelling features for a give namespace (use '_' for default namespace)
      dictionary (str): read a dictionary for additional features (arg either 'x:file' or just 'file')
      dictionary_path (str): look in this directory for dictionaries; defaults to current directory or env{PATH}
      interactions (str): Create feature interactions of any level between namespaces.
      permutations (bool): Use permutations instead of combinations for feature interactions of same namespace.
      leave_duplicate_interactions (bool): Don't remove interactions with duplicate combinations of namespaces. For
          ex. this is a duplicate: '-q ab -q ba' and a lot more in '-q ::'.
      quadratic,q (str): Create and use quadratic features, q:: corresponds to a wildcard for all printable characters
      cubic (str): Create and use cubic features
      testonly,t (bool): Ignore label information and just test
      holdout_off (bool): no holdout data in multiple passes
      holdout_period (int): holdout period for test only
      holdout_after (int): holdout after n training examples
      early_terminate (int): Specify the number of passes tolerated when holdout loss doesn't
          decrease before early termination
      passes (int): Number of Training Passes
      initial_pass_length (int): initial number of examples per pass
      examples (int): number of examples to parse
      min_prediction (float): Smallest prediction to output
      max_prediction (float): Largest prediction to output
      sort_features (bool): turn this on to disregard order in which features have been defined. This will lead to
          smaller cache sizes
      loss_function (str): default_value("squared"), "Specify the loss function to be used, uses squared by default.
          Currently available ones are squared, classic, hinge, logistic and quantile.
      quantile_tau (float): Parameter \tau associated with Quantile loss. Defaults to 0.5
      l1 (float): l_1 lambda (L1 regularization)
      l2 (float): l_2 lambda (L2 regularization)
      no_bias_regularization (bool): no bias in regularization
      named_labels (str): use names for labels (multiclass, etc.) rather than integers, argument specified all
          possible labels, comma-sep, eg "--named_labels Noun,Verb,Adj,Punc"
      final_regressor,f (str): Final regressor
      readable_model (str): Output human-readable final regressor with numeric features
      invert_hash (str): Output human-readable final regressor with feature names.  Computationally expensive.
      save_resume (bool): save extra state so learning can be resumed later with new data
      preserve_performance_counters (bool): reset performance counters when warmstarting
      output_feature_regularizer_binary (str): Per feature regularization output file
      output_feature_regularizer_text (str): Per feature regularization output file, in text
      oaa (integer): Use one-against-all multiclass learning with labels
      oaa_subsample (int): subsample this number of negative examples when learning
      ect (integer): Use error correcting tournament multiclass learning
      csoaa (integer): Use cost sensitive one-against-all multiclass learning
      wap (integer): Use weighted all pairs multiclass learning
      probabilities (float): predict probabilities of all classes
      nn (integer): Use a sigmoidal feed-forward neural network with N hidden units
      inpass (bool): Train or test sigmoidal feed-forward network with input pass-through
      multitask (bool): Share hidden layer across all reduced tasks
      dropout (bool): Train or test sigmoidal feed-forward network using dropout
      meanfield (bool): Train or test sigmoidal feed-forward network using mean field
      conjugate_gradient (bool): use conjugate gradient based optimization
      bgfs (bool): use bfgs updates
      hessian_on (bool): use second derivative in line search
      mem (int): memory in bfgs
      termination (float): termination threshold
      lda (int): Run lda with <int> topics
      lda_alpha (float): Prior on sparsity of per-document topic weights
      lda_rho (float): Prior on sparsity of topic distributions
      lda_D (int): Number of documents
      lda_epsilon (float): Loop convergence threshold
      minibatch (int): Minibatch size for LDA
      svrg (bool): Streaming Stochastic Variance Reduced Gradient
      stage_size (int): Number of passes per SVRG stage
      ftrl (bool): Run Follow the Proximal Regularized Leader
      coin (bool): Coin betting optimizer
      pistol (bool): PiSTOL - Parameter free STOchastic Learning
      ftrl_alpha (float): Alpha parameter for FTRL optimization
      ftrl_beta (float): Beta parameters for FTRL optimization
      ksvm (bool): kernel svm
      kernel (str): type of kernel (rbf or linear (default))
      bandwidth (int): bandwidth of rbf kernel
      degree (int): degree of poly kernel
      sgd (bool): use regular stochastic gradient descent update
      adaptive (bool): use adaptive, individual learning rates
      adax (bool): use adaptive learning rates with x^2 instead of g^2x^2
      invariant (bool): use save/importance aware updates
      normalized (bool): use per feature normalized updates
      link (str): Specify the link function - identity, logistic, glf1 or poisson
      stage_poly (bool): use stagewise polynomial feature learning
      sched_exponent (int): exponent controlling quantity of included features
      batch_sz (int): multiplier on batch size before including more features
      batch_sz_no_doubling (bool): batch_sz does not double
      lrq (bool): use low rank quadratic features
      lrqdropout (bool): use dropout training for low rank quadratic features
      lrqfa (bool): use low rank quadratic features with field aware weights
      data,d (str): path to data file for fitting external to sklearn
      cache,c (str): use a cache. default is <data>.cache
      cache_file (str): path to cache file to use
      json (bool): enable JSON parsing
      kill_cache, k (bool): do not reuse existing cache file, create a new one always
code: def __init__(
      self,
      convert_to_vw=True,
      convert_labels=True,
      ring_size=None,
      strict_parse=None,
      learning_rate=None,
      l=None,
      power_t=None,
      decay_learning_rate=None,
      initial_t=None,
      feature_mask=None,
      initial_regressor=None,
      i=None,
      initial_weight=None,
      random_weights=None,
      normal_weights=None,
      truncated_normal_weights=None,
      sparse_weights=None,
      input_feature_regularizer=None,
      quiet=True,
      random_seed=None,
      hash=None,
      hash_seed=None,
      ignore=None,
      ignore_linear=None,
      keep=None,
      redefine=None,
      bit_precision=None,
      b=None,
      noconstant=None,
      constant=None,
      C=None,
      ngram=None,
      skips=None,
      feature_limit=None,
      affix=None,
      spelling=None,
      dictionary=None,
      dictionary_path=None,
      interactions=None,
      permutations=None,
      leave_duplicate_interactions=None,
      quadratic=None,
      q=None,
      cubic=None,
      testonly=None,
      t=None,
      holdout_off=None,
      holdout_period=None,
      holdout_after=None,
      early_terminate=None,
      passes=1,
      initial_pass_length=None,
      examples=None,
      min_prediction=None,
      max_prediction=None,
      sort_features=None,
      loss_function=None,
      quantile_tau=None,
      l1=None,
      l2=None,
      no_bias_regularization=None,
      named_labels=None,
      final_regressor=None,
      f=None,
      readable_model=None,
      invert_hash=None,
      save_resume=None,
      preserve_performance_counters=None,
      output_feature_regularizer_binary=None,
      output_feature_regularizer_text=None,
      oaa=None,
      ect=None,
      csoaa=None,
      wap=None,
      probabilities=None,
      nn=None,
      inpass=None,
      multitask=None,
      dropout=None,
      meanfield=None,
      conjugate_gradient=None,
      bfgs=None,
      hessian_on=None,
      mem=None,
      termination=None,
      lda=None,
      lda_alpha=None,
      lda_rho=None,
      lda_D=None,
      lda_epsilon=None,
      minibatch=None,
      svrg=None,
      stage_size=None,
      ftrl=None,
      coin=None,
      pistol=None,
      ftrl_alpha=None,
      ftrl_beta=None,
      ksvm=None,
      kernel=None,
      bandwidth=None,
      degree=None,
      sgd=None,
      adaptive=None,
      invariant=None,
      normalized=None,
      link=None,
      stage_poly=None,
      sched_exponent=None,
      batch_sz=None,
      batch_sz_no_doubling=None,
      lrq=None,
      lrqdropout=None,
      lrqfa=None,
      data=None,
      d=None,
      cache=None,
      c=None,
      cache_file=None,
      json=None,
      kill_cache=None,
      k=None,
  ):
      """VW model constructor, exposing all supported parameters to keep sklearn happy
  
      Args:
          convert_to_vw (bool): flag to convert X input to vw format
          convert_labels (bool): Convert labels of the form [0,1] to [-1,1]
          ring_size (int): size of example ring
          strict_parse (bool): throw on malformed examples
          learning_rate,l (float): Set learning rate
          power_t (float): t power value
          decay_learning_rate (float): Set Decay factor for learning_rate between passes
          initial_t (float): initial t value
          feature_mask (str): Use existing regressor to determine which parameters may be updated.
              If no initial_regressor given, also used for initial weights.
          initial_regressor,i (str): Initial regressor(s)
          initial_weight (float): Set all weights to an initial value of arg.
          random_weights (bool): make initial weights random
          normal_weights (bool): make initial weights normal
          truncated_normal_weights (bool): make initial weights truncated normal
          sparse_weights (float): Use a sparse datastructure for weights
          input_feature_regularizer (str): Per feature regularization input file
          quiet (bool): Don't output disgnostics and progress updates
          random_seed (integer): seed random number generator
          hash (str): , all
          hash_seed (int): seed for hash function
          ignore (str): ignore namespaces beginning with character <arg>
          ignore_linear (str): ignore namespaces beginning with character <arg> for linear terms only
          keep (str): keep namespaces beginning with character <arg>
          redefine (str): Redefine namespaces beginning with characters of string S as namespace N. <arg> shall be in
              form 'N:=S' where := is operator. Empty N or S are treated as default namespace.
              Use ':' as a wildcard in S.
          bit_precision,b (integer): number of bits in the feature table
          noconstant (bool): Don't add a constant feature
          constant,C (float): Set initial value of constant
          ngram (str): Generate N grams. To generate N grams for a single namespace 'foo', arg should be fN.
          skips (str): Generate skips in N grams. This in conjunction with the ngram tag can be used to generate
              generalized n-skip-k-gram. To generate n-skips for a single namespace 'foo', arg should be fN.
          feature_limit (str): limit to N features. To apply to a single namespace 'foo', arg should be fN
          affix (str): generate prefixes/suffixes of features; argument '+2a,-3b,+1' means generate 2-char prefixes for
              namespace a, 3-char suffixes for b and 1 char prefixes for default namespace
          spelling (str): compute spelling features for a give namespace (use '_' for default namespace)
          dictionary (str): read a dictionary for additional features (arg either 'x:file' or just 'file')
          dictionary_path (str): look in this directory for dictionaries; defaults to current directory or env{PATH}
          interactions (str): Create feature interactions of any level between namespaces.
          permutations (bool): Use permutations instead of combinations for feature interactions of same namespace.
          leave_duplicate_interactions (bool): Don't remove interactions with duplicate combinations of namespaces. For
              ex. this is a duplicate: '-q ab -q ba' and a lot more in '-q ::'.
          quadratic,q (str): Create and use quadratic features, q:: corresponds to a wildcard for all printable characters
          cubic (str): Create and use cubic features
          testonly,t (bool): Ignore label information and just test
          holdout_off (bool): no holdout data in multiple passes
          holdout_period (int): holdout period for test only
          holdout_after (int): holdout after n training examples
          early_terminate (int): Specify the number of passes tolerated when holdout loss doesn't
              decrease before early termination
          passes (int): Number of Training Passes
          initial_pass_length (int): initial number of examples per pass
          examples (int): number of examples to parse
          min_prediction (float): Smallest prediction to output
          max_prediction (float): Largest prediction to output
          sort_features (bool): turn this on to disregard order in which features have been defined. This will lead to
              smaller cache sizes
          loss_function (str): default_value("squared"), "Specify the loss function to be used, uses squared by default.
              Currently available ones are squared, classic, hinge, logistic and quantile.
          quantile_tau (float): Parameter \\tau associated with Quantile loss. Defaults to 0.5
          l1 (float): l_1 lambda (L1 regularization)
          l2 (float): l_2 lambda (L2 regularization)
          no_bias_regularization (bool): no bias in regularization
          named_labels (str): use names for labels (multiclass, etc.) rather than integers, argument specified all
              possible labels, comma-sep, eg \"--named_labels Noun,Verb,Adj,Punc\"
          final_regressor,f (str): Final regressor
          readable_model (str): Output human-readable final regressor with numeric features
          invert_hash (str): Output human-readable final regressor with feature names.  Computationally expensive.
          save_resume (bool): save extra state so learning can be resumed later with new data
          preserve_performance_counters (bool): reset performance counters when warmstarting
          output_feature_regularizer_binary (str): Per feature regularization output file
          output_feature_regularizer_text (str): Per feature regularization output file, in text
          oaa (integer): Use one-against-all multiclass learning with labels
          oaa_subsample (int): subsample this number of negative examples when learning
          ect (integer): Use error correcting tournament multiclass learning
          csoaa (integer): Use cost sensitive one-against-all multiclass learning
          wap (integer): Use weighted all pairs multiclass learning
          probabilities (float): predict probabilities of all classes
          nn (integer): Use a sigmoidal feed-forward neural network with N hidden units
          inpass (bool): Train or test sigmoidal feed-forward network with input pass-through
          multitask (bool): Share hidden layer across all reduced tasks
          dropout (bool): Train or test sigmoidal feed-forward network using dropout
          meanfield (bool): Train or test sigmoidal feed-forward network using mean field
          conjugate_gradient (bool): use conjugate gradient based optimization
          bgfs (bool): use bfgs updates
          hessian_on (bool): use second derivative in line search
          mem (int): memory in bfgs
          termination (float): termination threshold
          lda (int): Run lda with <int> topics
          lda_alpha (float): Prior on sparsity of per-document topic weights
          lda_rho (float): Prior on sparsity of topic distributions
          lda_D (int): Number of documents
          lda_epsilon (float): Loop convergence threshold
          minibatch (int): Minibatch size for LDA
          svrg (bool): Streaming Stochastic Variance Reduced Gradient
          stage_size (int): Number of passes per SVRG stage
          ftrl (bool): Run Follow the Proximal Regularized Leader
          coin (bool): Coin betting optimizer
          pistol (bool): PiSTOL - Parameter free STOchastic Learning
          ftrl_alpha (float): Alpha parameter for FTRL optimization
          ftrl_beta (float): Beta parameters for FTRL optimization
          ksvm (bool): kernel svm
          kernel (str): type of kernel (rbf or linear (default))
          bandwidth (int): bandwidth of rbf kernel
          degree (int): degree of poly kernel
          sgd (bool): use regular stochastic gradient descent update
          adaptive (bool): use adaptive, individual learning rates
          adax (bool): use adaptive learning rates with x^2 instead of g^2x^2
          invariant (bool): use save/importance aware updates
          normalized (bool): use per feature normalized updates
          link (str): Specify the link function - identity, logistic, glf1 or poisson
          stage_poly (bool): use stagewise polynomial feature learning
          sched_exponent (int): exponent controlling quantity of included features
          batch_sz (int): multiplier on batch size before including more features
          batch_sz_no_doubling (bool): batch_sz does not double
          lrq (bool): use low rank quadratic features
          lrqdropout (bool): use dropout training for low rank quadratic features
          lrqfa (bool): use low rank quadratic features with field aware weights
          data,d (str): path to data file for fitting external to sklearn
          cache,c (str): use a cache. default is <data>.cache
          cache_file (str): path to cache file to use
          json (bool): enable JSON parsing
          kill_cache, k (bool): do not reuse existing cache file, create a new one always
      """
  
      for k, v in dict(locals()).items():
          if k != "self" and not k.endswith("_"):
              setattr(self, k, v)
  
      super(VW, self).__init__()
  
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 1 to create a new VW object from inherited base classes: BaseEstimator with example: obj = VW(convert_to_vw, convert_labels, ring_size, strict_parse, learning_rate, l, power_t, decay_learning_rate, initial_t, feature_mask, initial_regressor, i, initial_weight, random_weights, normal_weights, truncated_normal_weights, sparse_weights, input_feature_regularizer, quiet, random_seed, hash, hash_seed, ignore, ignore_linear, keep, redefine, bit_precision, b, noconstant, constant, C, ngram, skips, feature_limit, affix, spelling, dictionary, dictionary_path, interactions, permutations, leave_duplicate_interactions, quadratic, q, cubic, testonly, t, holdout_off, holdout_period, holdout_after, early_terminate, passes, initial_pass_length, examples, min_prediction, max_prediction, sort_features, loss_function, quantile_tau, l1, l2, no_bias_regularization, named_labels, final_regressor, f, readable_model, invert_hash, save_resume, preserve_performance_counters, output_feature_regularizer_binary, output_feature_regularizer_text, oaa, ect, csoaa, wap, probabilities, nn, inpass, multitask, dropout, meanfield, conjugate_gradient, bfgs, hessian_on, mem, termination, lda, lda_alpha, lda_rho, lda_D, lda_epsilon, minibatch, svrg, stage_size, ftrl, coin, pistol, ftrl_alpha, ftrl_beta, ksvm, kernel, bandwidth, degree, sgd, adaptive, invariant, normalized, link, stage_poly, sched_exponent, batch_sz, batch_sz_no_doubling, lrq, lrqdropout, lrqfa, data, d, cache, c, cache_file, json, kill_cache, k)