Package rdkit :: Package ML :: Package KNN :: Module KNNClassificationModel :: Class KNNClassificationModel
[hide private]
[frames] | no frames]

type KNNClassificationModel

source code

       object --+    
                |    
KNNModel.KNNModel --+
                    |
                   KNNClassificationModel

This is used to represent a k-nearest neighbor classifier

  

Instance Methods [hide private]
 
__init__(self, k, attrs, dfunc, radius=None) source code
 
type(self) source code
 
SetBadExamples(self, examples) source code
 
GetBadExamples(self) source code
 
NameModel(self, varNames) source code
 
ClassifyExample(self, example, appendExamples=0, neighborList=None)
Classify a an example by looking at its closest neighbors
source code

Inherited from KNNModel.KNNModel: GetExamples, GetName, GetNeighbors, GetTestExamples, GetTrainingExamples, SetExamples, SetName, SetTestExamples, SetTrainingExamples

Inherited from KNNModel.KNNModel (private): _setup

Method Details [hide private]

__init__(self, k, attrs, dfunc, radius=None)
(Constructor)

source code 
Overrides: KNNModel.KNNModel.__init__

ClassifyExample(self, example, appendExamples=0, neighborList=None)

source code 
Classify a an example by looking at its closest neighbors

The class assigned to this example is same as the class for the mojority of its
_k neighbors

**Arguments**

- examples: the example to be classified

- appendExamples: if this is nonzero then the example will be stored on this model

- neighborList: if provided, will be used to return the list of neighbors

**Returns**

  - the classification of _example_