class_docstr: Manages post-hoc SVM training for a single object class.
class_docstr_tok: ["Manages","post-hoc","SVM","training","for","a","single","object","class","."]
code: def __init__(
      self,
      cls,
      dim,
      feature_scale,
      C,
      B,
      pos_weight,
      svm_penality,
      svm_loss,
      svm_rngSeed,
      svm_retrainLimit,
      svm_evictThreshold,
  ):
      self.pos = np.zeros((0, dim), dtype=np.float32)
      self.neg = np.zeros((0, dim), dtype=np.float32)
      self.B = B
      self.C = C
      self.cls = cls
      self.pos_weight = pos_weight
      self.dim = dim
      self.feature_scale = feature_scale
      if type(pos_weight) == str:  # e.g. pos_weight == 'auto'
          class_weight = pos_weight
      else:
          class_weight = {1: pos_weight, -1: 1}
  
      self.svm = svm.LinearSVC(
          C=C,
          class_weight=class_weight,
          intercept_scaling=B,
          verbose=1,
          penalty=svm_penality,
          loss=svm_loss,
          random_state=svm_rngSeed,
          dual=True,
      )
  
      self.pos_cur = 0
      self.num_neg_added = 0
      self.retrain_limit = svm_retrainLimit
      self.evict_thresh = svm_evictThreshold
      self.loss_history = []
  
imports: from timer import Timer
  from sklearn import svm
  import numpy
label_desc: Use image node_id 1 to create a new SVMClassTrainer object from inherited base classes: object with example: obj = SVMClassTrainer(cls, dim, feature_scale, C, B, pos_weight, svm_penality, svm_loss, svm_rngSeed, svm_retrainLimit, svm_evictThreshold)