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 for Issues with CluStream clustering #1634

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions river/cluster/clustream.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ def learn_one(self, x, w=1.0):

if closest_dist < radius:
closest_mc.insert(x, w, self._timestamp)
return
else:

# If the new point does not fit in the micro-cluster, micro-clusters
# whose relevance stamps are less than the threshold are deleted.
# Otherwise, closest micro-clusters are merged with each other.
self._maintain_micro_clusters(x=x, w=w)
# If the new point does not fit in the micro-cluster, micro-clusters
# whose relevance stamps are less than the threshold are deleted.
# Otherwise, closest micro-clusters are merged with each other.
self._maintain_micro_clusters(x=x, w=w)

# Apply incremental K-Means on micro-clusters after each time_gap
if self._timestamp % self.time_gap == self.time_gap - 1:
Expand All @@ -260,7 +260,7 @@ def learn_one(self, x, w=1.0):
def predict_one(self, x):
index, _ = self._get_closest_mc(x)
try:
return self._kmeans_mc.predict_one(self._mc_centers[index])
return self._kmeans_mc.predict_one(self.micro_clusters[index].center)
except (KeyError, AttributeError):
return 0

Expand Down
Loading