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

type KNNModel

source code

object --+
         |
        KNNModel
Known Subclasses:

This is a base class used by KNNClassificationModel
and KNNRegressionModel to represent a k-nearest neighbor predictor. In general
one of this child classes needs to be instantiated.

_KNNModel_s can save the following pieces of internal state, accessible via
  standard setter/getter functions - the child object store additional stuff:

  1) _Examples_: a list of examples which have been predicted (either classified
                  or values predicted)

  2) _TrainingExamples_: List of training examples (since this is a KNN model these examples
                         along with the value _k_ below define the model)

  3) _TestExamples_: the list of examples used to test the model

  4) _k_: the number of closest neighbors used for prediction

Instance Methods [hide private]
 
GetExamples(self) source code
 
GetName(self) source code
 
GetNeighbors(self, example)
Returns the k nearest neighbors of the example
source code
 
GetTestExamples(self) source code
 
GetTrainingExamples(self) source code
 
SetExamples(self, examples) source code
 
SetName(self, name) source code
 
SetTestExamples(self, examples) source code
 
SetTrainingExamples(self, examples) source code
 
__init__(self, k, attrs, dfunc, radius=None) source code
 
_setup(self, k, attrs, dfunc, radius) source code
Method Details [hide private]

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

source code 
Overrides: object.__init__
(inherited documentation)