Changeset 10694:eb4617009f30 in orange


Ignore:
Timestamp:
03/30/12 13:16:08 (2 years ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added explanation of solver_type constants in LinearSVMLearner.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/svm/__init__.py

    r10682 r10694  
    726726LIBLINEAR learners interface 
    727727""" 
     728 
    728729class LinearSVMLearner(Orange.core.LinearLearner): 
    729730    """Train a linear SVM model.""" 
     
    732733    L2R_L2LOSS = Orange.core.LinearLearner.L2R_L2Loss_SVC 
    733734    L2R_L1LOSS_DUAL = Orange.core.LinearLearner.L2R_L1Loss_SVC_Dual 
    734     L2R_L1LOSS_DUAL = Orange.core.LinearLearner.L2R_L2Loss_SVC_Dual 
    735735    L1R_L2LOSS = Orange.core.LinearLearner.L1R_L2Loss_SVC 
    736736 
     
    740740                 normalization=True, **kwargs): 
    741741        """ 
    742         :param solver_type: One of the following class constants:  
    743             ``LR2_L2LOSS_DUAL``, ``L2R_L2LOSS``,  
    744             ``LR2_L1LOSS_DUAL``, ``L2R_L1LOSS`` or  
    745             ``L1R_L2LOSS`` 
     742        :param solver_type: One of the following class constants: 
     743            ``L2R_L2LOSS_DUAL``, ``L2R_L2LOSS``, 
     744            ``L2R_L1LOSS_DUAL``, ``L1R_L2LOSS`` 
     745             
     746            The first part (``L2R`` or ``L1R``) is the regularization term  
     747            on the weight vector (squared or absolute norm respectively), 
     748            the ``L1LOSS`` or ``L2LOSS`` indicate absolute or squared 
     749            loss function ``DUAL`` means the optimization problem is 
     750            solved in the dual space (for more information see the 
     751            documentation on `LIBLINEAR`_). 
    746752         
    747753        :param C: Regularization parameter (default 1.0) 
    748         :type C: float   
     754        :type C: float 
    749755         
    750756        :param eps: Stopping criteria (default 0.01) 
     
    754760            (default True) 
    755761        :type normalization: bool 
     762         
     763        Example 
     764         
     765            >>> linear_svm = LinearSVMLearner(solver_type=LinearSVMLearner.L1R_L2LOSS, 
     766            ...                               C=2.0) 
     767            ... 
    756768         
    757769        """ 
     
    764776            setattr(self, name, val) 
    765777        if self.solver_type not in [self.L2R_L2LOSS_DUAL, self.L2R_L2LOSS, 
    766                 self.L2R_L1LOSS_DUAL, self.L2R_L1LOSS_DUAL, self.L1R_L2LOSS]: 
     778                self.L2R_L1LOSS_DUAL, self.L1R_L2LOSS]: 
    767779            import warnings 
    768780            warnings.warn("""\ 
     
    792804class MultiClassSVMLearner(Orange.core.LinearLearner): 
    793805    """ Multi-class SVM (Crammer and Singer) from the `LIBLINEAR`_ library. 
     806     
    794807    """ 
    795808    __new__ = _orange__new__(base=Orange.core.LinearLearner) 
     
    911924class ScoreSVMWeights(Orange.feature.scoring.Score): 
    912925    """ 
    913     Score a feature using squares of weights of a linear SVM 
    914     model. 
     926    Score a feature using squared weights of a linear SVM model. 
    915927         
    916928    Example: 
Note: See TracChangeset for help on using the changeset viewer.