Package PyML :: Package classifiers :: Module composite :: Class Chain
[frames] | no frames]

Class Chain

source code

base.pymlObject.PyMLobject --+        
                             |        
    baseClassifiers.Classifier --+    
                                 |    
               CompositeClassifier --+
                                     |
                                    Chain

A chain is a list of actions to be performed on a dataset, the last of which is assumed to be a classifier. The actions can be for example a chain of preprocessing steps or a step of feature selection (same as using the FeatureSelect class) Each action in the chain is assumed to have a "train" method and is assumed to have a copy constructor
Nested Classes
    Inherited from baseClassifiers.Classifier
  resultsObject
Instance Methods
 
__init__(self, arg) source code
 
train(self, data, **args) source code
 
test(self, data, **args)
test a classifier on a given dataset
source code
    Inherited from CompositeClassifier
 
__repr__(self) source code
 
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
 
save(self, fileHandle) 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
  deepcopy = True
    Inherited from baseClassifiers.Classifier
  type = 'classifier'
Method Details

__init__(self, arg)
(Constructor)

source code 
Parameters:
  • arg - a Chain object of a list of objects, each of which implements a 'train', 'test' and has a copy constructor
Overrides: baseClassifiers.Classifier.__init__

train(self, data, **args)

source code 
Overrides: baseClassifiers.Classifier.train

test(self, data, **args)

source code 
test a classifier on a given dataset
Parameters:
  • classifier - a trained classifier
  • data - a dataset
  • stats - whether to compute the statistics of the match between the predicted labels and the given labels [True by default]
Returns:
a Results class instance
Overrides: evaluators.assess.test
(inherited documentation)