def main(): means = ([5,5], [0,5], [5,0], [0,0]) points = [np.random.multivariate_normal(np.array(mean), 3.0 * np.eye(2)) for n in range(50) for mean in means] results = kmeans.kmeans(points, 4) animations = [draw_points(result[0], result[1]) + "\n".join([draw_box({"x" : p[0], "y" : p[1], "color": "black!80", "fill" : "black!70", "extra" : "thick"}) for p in means]) for result in results] latex_lib.write_animation("kmeans", animations)
def main(): means = ([5, 5], [0, 5], [5, 0], [0, 0]) points = [ np.random.multivariate_normal(np.array(mean), 3.0 * np.eye(2)) for n in range(50) for mean in means ] results = kmeans.kmeans(points, 4) animations = [ draw_points(result[0], result[1]) + "\n".join([ draw_box({ "x": p[0], "y": p[1], "color": "black!80", "fill": "black!70", "extra": "thick" }) for p in means ]) for result in results ] latex_lib.write_animation("kmeans", animations)
from beamer_animation import latex_lib # import pyplot latex_lib.write_diagram("dot", r"\node [circle] {};") latex_lib.write_animation("dots", [r"\node [circle, fill=%s] {};" % color for color in ["red", "blue", "green"]]) # write_plot()