Open
Conversation
Contributor
|
Thanks for starting to gather the code in a notebook 👍 If you want to display the most recent clusters (n=3) then this change would be required (fixing a typo too): diff --git a/examples/river_kmeans.py b/examples/river_kmeans.py
index 4acbaf1..f204e9e 100644
--- a/examples/river_kmeans.py
+++ b/examples/river_kmeans.py
@@ -58,7 +58,7 @@ def main(viz=True):
return concat([previous, new]).iloc[-last_lines:, :]
partition_obs = 10
- particion_clusters = 10
+ partition_clusters = 10
backlog_obs = 100
# .partition is used to gather x number of points
@@ -74,8 +74,8 @@ def main(viz=True):
)
(
clusters
- .partition(particion_clusters)
- .map(pd.concat)
+ .partition(partition_clusters)
+ .map(lambda t: t[-1])
.sink(pipe_out.send)
)Instead of concatenating the clusters (n=3partition) the stream just gets the last clusters (n=3) that were accumulated in Even if the script is working at the required cadence thanks to the use of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simply copying the script code to a notebook. Could use some cleaning and prose. For some reason, we are getting lookback on the cluster centres, whereas we should only be showing the most recent.
cc @maximlt