<h4 dir="auto">Description</h4>
<p dir="auto">i use minibatchkmeans and set k=2000, but, the number of clusters that minibatchkmeans returns is 1997, that is less than 2000. Then, i set k=1950, the minibatchkmeans return 1947, and it is less than 1950.  I have over 16 million samples of datasets and each sample have 150 features.</p>
<h4 dir="auto">Steps/Code to Reproduce</h4>

<h4 dir="auto">Expected Results</h4>

<p dir="auto">when set k =2000, return 2000</p>
<h4 dir="auto">Actual Results</h4>

<p dir="auto">1947</p>
<h4 dir="auto">Versions</h4>

<p dir="auto">sklean 0.20.1<br>
system: centos6.3<br>
scipy 1.1.0<br>
numpy 1.14.5</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="clf = DecisionTreeClassifier(min_samples_split=20,
                                 min_samples_leaf=5,
                                 max_features=None)



shape X (3220, 3375)
shape y (3220,)
calling clf.fit(X,y)
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored"><pre class="notranslate"><code class="notranslate">clf = DecisionTreeClassifier(min_samples_split=20,
                                 min_samples_leaf=5,
                                 max_features=None)



shape X (3220, 3375)
shape y (3220,)
calling clf.fit(X,y)
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
Exception ValueError: ValueError('Attempting to find a split with an empty sample_mask',) in 'sklearn.tree._tree.Tree.recursive_partition' ignored
</code></pre></div>
<p dir="auto"><del>I tested this with the current git version. Using cython 0.16, the problem goes away.</del></p>
<p dir="auto"><del>Broken:</del></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo make clean &amp;&amp; sudo python2 setup.py install"><pre class="notranslate"><code class="notranslate">sudo make clean &amp;&amp; sudo python2 setup.py install
</code></pre></div>
<p dir="auto"><del>Fixed:</del></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo make clean &amp;&amp; make cython &amp;&amp; sudo python2 setup.py install"><pre class="notranslate"><code class="notranslate">sudo make clean &amp;&amp; make cython &amp;&amp; sudo python2 setup.py install
</code></pre></div>