<p dir="auto">Hi， I found the code in this<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/scikit-learn/scikit-learn/blob/bac89c253b35a8f1a3827389fbee0f5bebcbc985/sklearn/cluster/birch.py#L212">scikit-learn/sklearn/cluster/birch.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 212
      in
      <a data-pjax="true" class="commit-tease-sha" href="/scikit-learn/scikit-learn/commit/bac89c253b35a8f1a3827389fbee0f5bebcbc985">bac89c2</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L212" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="212"></td>
          <td id="LC212" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">self</span>.<span class="pl-en">update_split_subclusters</span>( </td>
        </tr>
    </tbody></table>
  </div>
</div>
 line would cause this error.<br>
Because new_subcluster1, new_subcluster2  created by<br>
new_subcluster1, new_subcluster2 = <em>split_node(<br>
closest_subcluster.child</em>, threshold, branching_factor)<br>
are constructed with<br>
new_subcluster1 = _CFSubcluster()<br>
new_subcluster2 = _CFSubcluster()<p></p>
<p dir="auto">so, the problem is when calls the function update_split_subclusters in line<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/scikit-learn/scikit-learn/blob/bac89c253b35a8f1a3827389fbee0f5bebcbc985/sklearn/cluster/birch.py#L164">scikit-learn/sklearn/cluster/birch.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 164
      in
      <a data-pjax="true" class="commit-tease-sha" href="/scikit-learn/scikit-learn/commit/bac89c253b35a8f1a3827389fbee0f5bebcbc985">bac89c2</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L164" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="164"></td>
          <td id="LC164" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">def</span> <span class="pl-en">update_split_subclusters</span>(<span class="pl-s1">self</span>, <span class="pl-s1">subcluster</span>, </td>
        </tr>
    </tbody></table>
  </div>
</div>
, there will call 'self.init_centroids_[ind] = new_subcluster1.centroid_'.<br>
But this construction method of 'new_subcluster1 = <em>CFSubcluster()' has no attribute 'centroid</em>'.<p></p>
<p dir="auto">Can you help me to fix this issue? Thanks.</p>


<h4 dir="auto">Description</h4>

<h4 dir="auto">Steps/Code to Reproduce</h4>

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

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

<h4 dir="auto">Versions</h4>
<p dir="auto">This issue occurs to me during an evaluation with growing feature set sizes. In under a second after the call to fit_predict on the BIRCH instance.</p>
<p dir="auto">Strangely it works for smaller sets of features and does not run out of memory.</p>
<p dir="auto">For my evaluation I employ 183719 datasets and construct feature sets of growing size. It works with 6 features, but returns this error with 12. I use the version 1.7.</p>
<p dir="auto">Here is the full stack trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;clusterer.py&quot;, line 27, in score
    labels = self.clusterer.fit_predict(x)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/base.py&quot;, line 371, in fit_predict
    self.fit(X)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py&quot;, line 424, in fit
    return self._fit(X)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py&quot;, line 458, in _fit
    split = self.root_.insert_cf_subcluster(subcluster)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py&quot;, line 193, in insert_cf_subcluster
    subcluster)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py&quot;, line 212, in insert_cf_subcluster
    closest_subcluster, new_subcluster1, new_subcluster2)
  File &quot;/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py&quot;, line 170, in update_split_subclusters
    self.init_centroids_[ind] = new_subcluster1.centroid_
AttributeError: '_CFSubcluster' object has no attribute 'centroid_'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "clusterer.py", line 27, in score
    labels = self.clusterer.fit_predict(x)
  File "/usr/lib/python2.7/dist-packages/sklearn/base.py", line 371, in fit_predict
    self.fit(X)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py", line 424, in fit
    return self._fit(X)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py", line 458, in _fit
    split = self.root_.insert_cf_subcluster(subcluster)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py", line 193, in insert_cf_subcluster
    subcluster)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py", line 212, in insert_cf_subcluster
    closest_subcluster, new_subcluster1, new_subcluster2)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/birch.py", line 170, in update_split_subclusters
    self.init_centroids_[ind] = new_subcluster1.centroid_
AttributeError: '_CFSubcluster' object has no attribute 'centroid_'
</code></pre></div>
<p dir="auto">Sadly I'm not able to reproduce this with an minimal example</p>