Open tmelorc opened 5 years ago
Cool, thanks. Note that you can often do without for loops. For instance,
def figure_eight_pts(N, a=1):
theta_list = 2 * np.pi * np.random.sample(N)
pts = np.zeros((N,2))
pts[:, 0] = a * np.cos(theta_list) * np.sqrt(2*np.cos(2*theta_list))
pts[:, 1] = a * np.sin(theta_list) * np.sqrt(2*np.cos(2*theta_list))
return pts
Very interesting. This is my difficulty, I have no knowledge how to do better programs. I have only ideas... :-) Thanks.
Yeah numpy is great, and whenever you can avoid for loops it's usually faster
On Thu, Apr 18, 2019, 12:26 PM Thiago notifications@github.com wrote:
Very interesting. This is my difficulty, I have no knowledge how to do better programs. I have only ideas... :-) Thanks.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/6#issuecomment-484581789, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJWDZXE54X3XJVGMSC2TZ3PRCOKZANCNFSM4HG4Z6TA .
Some time ago, before I had discovered scikit-tda, I created the following functions to generate some datasets. Feel free to use and improve if you wish. Regards.