Module qsarmodelingpy.kennardstonealgorithm

Select samples using Kennard-Stone algorithm.

The KENNARDSTONE method selects a subset of samples from x which provide uniform coverage over the data set and includes samples on the boundary of the data set. The method begins by finding the two samples which are farthest apart using geometric distance. To add another sample to the selection set the algorithm selects from the remaining samples that one which has the greatest separation distance from the selected samples. The separation distance of a candidate sample from the selected set is the distance from the candidate to its closest selected sample. This most separated sample is then added to the selection set and the process is repeated until the required number of samples, k, have been added to the selection set. In practice this produces a very uniformly distributed network of selected points over the data set and includes samples along the boundary of the dataset. The method performs efficiently because it calculates the inter-sample distances matrix only once.

(Source)

Functions

def kennardstonealgorithm(x_variables, k)

Run the Kennard-Stone algorithm.

Args

x_variables : dataset
data to select samples from
k : int
number of samples to be selected

Returns

list
The indexes of selected samples (training data).
list
The indexes of remaining samples (test data).