Skip to content

BIRCH fails with "'_CFSubcluster' object has no attribute 'centroid_'" #6172

@Nordwald

Description

@Nordwald

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.

Strangely it works for smaller sets of features and does not run out of memory.

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.

Here is the full stack trace:

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_'

Sadly I'm not able to reproduce this with an minimal example

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions