Last active
July 19, 2020 18:29
-
-
Save instance01/06ff712778cc40fece18feacc082cfe5 to your computer and use it in GitHub Desktop.
This file contains 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
# More information: "A Framework for Clustering Evolving Data Streams", Aggarwal, 2003 | |
# This does not deal with redundancy (which apparently is rampant). | |
import math | |
alpha = 2 | |
beta = 2 | |
levels = [] | |
def new_snapshot(tnow): | |
global levels | |
height = int(math.log(tnow, alpha) + 1) | |
print(height) | |
if len(levels) < height: | |
levels.insert(0, []) | |
for level in range(height)[::-1]: | |
if tnow % (alpha ** level) == 0: | |
levels[level].append(tnow) | |
if len(levels[level]) > (alpha ** beta + 1): | |
levels[level].pop(0) | |
print(levels) | |
for i in range(1, 2001): | |
new_snapshot(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment