PyML :: classifiers :: modelSelection :: SVMselect :: Class SVMselect
[frames] | no frames]

Class SVMselect

source code

base.pymlObject.PyMLobject --+            
                             |            
    baseClassifiers.Classifier --+        
                                 |        
     composite.CompositeClassifier --+    
                                     |    
                         ModelSelector --+
                                         |
                                        SVMselect

A model selector for searching for best parameters for an SVM classifier with a Gaussian kernel Its search strategy is as follows: First optimize the width of the Gaussian (gamma) for a fixed (low) value of C, and then optimize C.
Nested Classes
    Inherited from baseClassifiers.Classifier
  resultsObject
Instance Methods
 
__init__(self, arg=None, **args) source code
 
__repr__(self) source code
 
train(self, data, **args) source code
    Inherited from ModelSelector
 
save(self, fileHandle) source code
    Inherited from composite.CompositeClassifier
 
classify(self, data, i) source code
 
decisionFunc(self, data, i) source code
 
getTest(self) source code
 
preproject(self, data) source code
 
setTest(self) source code
    Inherited from baseClassifiers.Classifier
 
cv(classifier, data, numFolds=5, **args)
perform k-fold cross validation
source code
 
getTrainingTime(self) source code
 
logger(self) source code
 
loo(classifier, data, **args)
perform Leave One Out
source code
 
nCV(classifier, data, **args)
runs CV n times, returning a 'ResultsList' object.
source code
 
project(self, data)
project a test dataset to the training data features.
source code
 
stratifiedCV(classifier, data, numFolds=5, **args)
perform k-fold stratified cross-validation; in each fold the number of patterns from each class is proportional to the relative fraction of the class in the dataset
source code
 
trainFinalize(self) source code
 
trainTest(classifierTemplate, data, trainingPatterns, testingPatterns, **args)
Train a classifier on the list of training patterns, and test it on the test patterns
source code
 
twoClassClassify(self, data, i) source code
Class Variables
  attributes = {'C': [0.01, 0.1, 1, 10, 100, 1000], 'gamma': [0....
    Inherited from composite.CompositeClassifier
  deepcopy = True
  test = property(getTest, setTest, None, 'the test function of ...
test a classifier on a given dataset
    Inherited from baseClassifiers.Classifier
  type = 'classifier'
Method Details

__init__(self, arg=None, **args)
(Constructor)

source code 
Parameters:
  • arg - another ModelSelector object
  • C - a list of values to try for C
  • gamma - a list of value to try for gamma
  • measure - which measure of accuracy to use for selecting the best classifier (default = 'balancedSuccessRate') supported measures are: 'balancedSuccessRate', 'successRate', 'roc', 'roc50' (you can substitute another number instead of 50)
  • numFolds - number of CV folds to use when performing model selection
Overrides: baseClassifiers.Classifier.__init__

__repr__(self)
(Representation operator)

source code 
Overrides: baseClassifiers.Classifier.__repr__

train(self, data, **args)

source code 
Parameters:
  • train - boolean - whether to train the best classifier (default: True)
  • vdata - data to use for testing instead of using cross-validation (not implemented yet)
Overrides: baseClassifiers.Classifier.train

Class Variable Details

attributes

Value:
{'C': [0.01, 0.1, 1, 10, 100, 1000], 'gamma': [0.001, 0.01, 0.1, 1, 10\
], 'Clow': 10, 'numFolds': 5, 'measure': 'balancedSuccessRate'}