Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX initialise Birch centroid_ in all cases #13651

Merged
merged 2 commits into from Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whats_new/v0.21.rst
Expand Up @@ -85,6 +85,9 @@ Support for Python 3.4 and below has been officially dropped.
to set and that scales better, by :user:`Shane <espg>`,
:user:`Adrin Jalali <adrinjalali>`, and :user:`Erich Schubert <kno10>`.

- |Fix| Fixed a bug where :class:`cluster.Birch` could occasionally raise an
AttributeError. :issue:`13651` by `Joel Nothman`_.

- |API| The ``n_components_`` attribute in :class:`cluster.AgglomerativeClustering`
and :class:`cluster.FeatureAgglomeration` has been renamed to
``n_connected_components_``.
Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/birch.py
Expand Up @@ -277,7 +277,7 @@ def __init__(self, linear_sum=None):
if linear_sum is None:
self.n_samples_ = 0
self.squared_sum_ = 0.0
self.linear_sum_ = 0
self.centroid_ = self.linear_sum_ = 0
else:
self.n_samples_ = 1
self.centroid_ = self.linear_sum_ = linear_sum
Expand Down