Package rdkit :: Package ML :: Package KNN :: Module KNNClassificationModel :: Class KNNClassificationModel

[hide private]
[frames] | no frames]

# Class 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) x.__init__(...) initializes x; see help(type(x)) for signature | 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`

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

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

source code

    x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### 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_