rdkit.ML.KNN.KNNClassificationModel module — The RDKit 2016.09.1 documentation

# rdkit.ML.KNN.KNNClassificationModel module

Define the class _KNNClassificationModel_, used to represent a k-nearest neighbhors classification model

Inherits from _KNNModel_

class `rdkit.ML.KNN.KNNClassificationModel.` `KNNClassificationModel`(k, attrs, dfunc, radius=None)

  Bases: `rdkit.ML.KNN.KNNModel.KNNModel`

  This is used to represent a k-nearest neighbor classifier

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

    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_

  `GetBadExamples`()
  `NameModel`(varNames)
  `SetBadExamples`(examples)
  `type`()