pyclustering
0.10.1
pyclustring is a Python, C++ data mining library.

Module provides various random sampling algorithms. More...
Functions  
def  reservoir_r (data, n) 
Performs data sampling using Reservoir Algorithm R. More...  
def  reservoir_x (data, n) 
Performs data sampling using Reservoir Algorithm X. More...  
Module provides various random sampling algorithms.
def pyclustering.utils.sampling.reservoir_r  (  data,  
n  
) 
Performs data sampling using Reservoir Algorithm R.
Algorithm complexity O(n). Implementation is based on paper [41]. Average number of uniform random variates: \(N  n\).
[in]  data  (list): Input data for sampling. 
[in]  n  (uint): Size of sample that should be extracted from 'data'. 
Generate random samples with 5 elements and with 3 elements using Reservoir Algorithm R:
Output example for the code above:
Definition at line 15 of file sampling.py.
def pyclustering.utils.sampling.reservoir_x  (  data,  
n  
) 
Performs data sampling using Reservoir Algorithm X.
Algorithm complexity O(n). Implementation is based on paper [41]. Average number of uniform random variates:
\[\approx 2n\ln \left (\frac{N}{n} \right)\]
[in]  data  (list): Input data for sampling. 
[in]  n  (uint): Size of sample that should be extracted from 'data'. 
Generate random sample with 5 elements using Reservoir Algorithm X:
Output example for the code above:
Definition at line 57 of file sampling.py.