parameters: (self, data, **args)
docstring: train an SVM
docstring_summary: train an SVM
docstring_tokens: train an SVM
function: def train(self, data, **args) :
  
          """
          train an SVM
          """
      
          if data.__class__.__name__ in containersNotSupported :
              raise ValueError, 'convert your data into one of the C++ containers'
  
          Classifier.train(self, data, **args)
          if self.kernel is not None :
              data.attachKernel(self.kernel)
  
          # libsvm optimizer can only be used with vector data:
          if (not data.isVector) and self.optimizer == 'libsvm' :
              self.optimizer = 'mysmo'
  
          isPrimal = False
          if 'alpha' in args :
              print 'loading model'
              alpha = args['alpha']
              b = args['b']
              svID = args['svID']
          elif self.optimizer == 'libsvm' :
              alpha,b,svID = self.trainLibsvm(data, **args)
          elif self.optimizer == 'liblinear' :
              isPrimal = True
              w, b = self.trainLiblinear(data, **args)
          elif self.optimizer == 'gist' :
              alpha,b,svID = self.trainGist(data, **args)
          elif self.optimizer == 'gradient' :
              alpha,b,svID = self.trainGradient(data, **args)            
          else :
              alpha,b,svID = self.trainMySMO(data, **args)
  
          if isPrimal :
              self.model = self.modelDispatcher(data, w=w, b=b)
          else :
              self.model = self.modelDispatcher(data, svID=svID, alpha=alpha, b=b)
  
          self.trained = True
          if not isPrimal :
              self.log.numSV = len(alpha)
          self.log.trainingTime = self.getTrainingTime()
function_tokens: def train ( self , data , * * args ) : if data . __class__ . __name__ in containersNotSupported : raise ValueError , 'convert your data into one of the C++ containers' Classifier . train ( self , data , * * args ) if self . kernel is not None : data . attachKernel ( self . kernel ) # libsvm optimizer can only be used with vector data: if ( not data . isVector ) and self . optimizer == 'libsvm' : self . optimizer = 'mysmo' isPrimal = False if 'alpha' in args : print 'loading model' alpha = args [ 'alpha' ] b = args [ 'b' ] svID = args [ 'svID' ] elif self . optimizer == 'libsvm' : alpha , b , svID = self . trainLibsvm ( data , * * args ) elif self . optimizer == 'liblinear' : isPrimal = True w , b = self . trainLiblinear ( data , * * args ) elif self . optimizer == 'gist' : alpha , b , svID = self . trainGist ( data , * * args ) elif self . optimizer == 'gradient' : alpha , b , svID = self . trainGradient ( data , * * args ) else : alpha , b , svID = self . trainMySMO ( data , * * args ) if isPrimal : self . model = self . modelDispatcher ( data , w = w , b = b ) else : self . model = self . modelDispatcher ( data , svID = svID , alpha = alpha , b = b ) self . trained = True if not isPrimal : self . log . numSV = len ( alpha ) self . log . trainingTime = self . getTrainingTime ( )