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

Class KNNModel

source code

object --+
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]
__init__(self, k, attrs, dfunc, radius=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
_setup(self, k, attrs, dfunc, radius) source code
GetName(self) source code
SetName(self, name) source code
GetExamples(self) source code
SetExamples(self, examples) source code
GetTrainingExamples(self) source code
SetTrainingExamples(self, examples) source code
GetTestExamples(self) source code
SetTestExamples(self, examples) source code
GetNeighbors(self, example)
Returns the k nearest neighbors of the example
source code

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)

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

Overrides: object.__init__
(inherited documentation)