rdkit.ML.KNN.KNNModel module¶
Define the class _KNNModel_, used to represent a k-nearest neighbhors model
-
class
rdkit.ML.KNN.KNNModel.KNNModel(k, attrs, dfunc, radius=None)¶ Bases:
objectThis 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:
- _Examples_: a list of examples which have been predicted (either classified
or values predicted)
- _TrainingExamples_: List of training examples (since this is a KNN model these examples
along with the value _k_ below define the model)
_TestExamples_: the list of examples used to test the model
_k_: the number of closest neighbors used for prediction
-
GetExamples()¶
-
GetName()¶
-
GetNeighbors(example)¶ Returns the k nearest neighbors of the example
-
GetTestExamples()¶
-
GetTrainingExamples()¶
-
SetExamples(examples)¶
-
SetName(name)¶
-
SetTestExamples(examples)¶
-
SetTrainingExamples(examples)¶