Package PyML :: Package containers :: Module baseDatasets :: Class BaseVectorDataSet
[frames] | no frames]

Class BaseVectorDataSet

source code

 object --+    
          |    
BaseDataSet --+
              |
             BaseVectorDataSet

A base class for vector dataset container classes

Construction:

 DataSet(fileName)  -  read data from a file
 DataSet(fileName, classes = listOfClasses) - read only the
 classes that are named in listOfClasses
 DataSet(otherDataSet) - copy construction
 DataSet(otherDataSet, patterns = listOfPatterns) - copy construction
 using a list of patterns to copy
 DataSet(otherDataSet, classes = classesToCopy) - copy construction
 using a list of classes to copy

Keywords:

 deepcopy - whether to deepcopy a dataset (default = True)
 The only container that implements a shallow copy is the SparseDataSet.

Usage/attributes:

 len(dataset) - the number of patterns
 numFeatures - the number of features in the data (when applicable)
Instance Methods
 
__init__(self, arg=None, **args)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
constructFromFile(self, fileName, **args) source code
 
fromArray(self, X, **args) source code
 
fromArrayAdd(self, X) source code
 
__repr__(self)
repr(x)
source code
 
save(self, fileName, **args)
save a dataset to a file (does not use pickle!)
source code
 
getMatrix(self) source code
 
extend(self, other, patterns=None) source code
 
keepFeatures(self, features)
eliminate all but the give list of features INPUT: features - a list of features to eliminate; these are either numbers between 0 and numFeatures-1 (indices of features, not their IDs) or featureIDs
source code
 
featureNames2IDs(self, featureList)
convert a list of feature Names into their numeric IDs
source code
 
addFeatureKeyDict(self) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

    Inherited from BaseDataSet
 
attachKernel(self, kernel='linear', **args) source code
 
attachLabels(self, labels) source code
 
copy(self, other, patterns, deepcopy)
Each class that wants to use the generic copy constructor needs to define this function for doing class-specific copying
source code
 
copyConstruct(self, other, **args) source code
 
getKernelMatrix(self)
returns the kernel matrix as a numpy array
source code
 
getTestingFunc(self) source code
 
getTrainingFunc(self) source code
 
registerAttribute(self, attributeName, attributeValue=None, action=None) source code
 
setTestingFunc(self, func) source code
 
setTrainingFunc(self, func) source code
 
test(self, trainingData, **args) source code
 
train(self, **args) source code
Class Variables
  isVector = True
  verbose = 1
    Inherited from BaseDataSet
  testingFunc = property(getTestingFunc, setTestingFunc, None, '...
  trainingFunc = property(getTrainingFunc, setTrainingFunc, None...
  type = 'dataset'
Properties

Inherited from object: __class__

Method Details

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

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

save(self, fileName, **args)

source code 

save a dataset to a file (does not use pickle!)

:Parameters:

  • `fileName` - a file name or a file handle

:Keywords:

  • `format` - 'csv' or 'sparse'; by default format is chosen by the type of the dataset -- sparse containers save in sparse format and non-sparse containers in csv format.
  • `delimiter` - which delimiter to use when saving in csv format
  • `patterns` - save only those patterns whose indices are given
  • `ids` - save only those patterns whose pattern ID are given
  • `sortByID` - whether to sort the lines according to the pattern ID (default = False)
  • `sortByLabel` - whether to sort the lines according to the class label (default = False)