Swissroll model

Sample a hidden state and an swissroll-transformed emission trajectory. Demonstrates deeptime.data.swissroll_model().

 9 import matplotlib.pyplot as plt
10 from matplotlib import animation
11
12 from deeptime.data import swissroll_model
13
14 n_samples = 500
15 dtraj, traj = swissroll_model(n_samples)
16
17 fig = plt.figure()
18 ax = fig.add_subplot(111, projection='3d')
19
20
21 def init():
22     ax.scatter(*traj.T, marker='o', s=20, c=dtraj, alpha=0.6)
23     return fig,
24
25
26 def animate(i):
27     ax.view_init(elev=10., azim=3*i)
28     return fig,
29
30
31 # Animate
32 anim = animation.FuncAnimation(fig, animate, init_func=init,
33                                frames=120, interval=40, blit=False)

Total running time of the script: ( 0 minutes 21.927 seconds)

Estimated memory usage: 8 MB