scikit-tda / tadasets

Synthetic data sets apt for Topological Data Analysis
http://tadasets.scikit-tda.org
MIT License
34 stars 7 forks source link

Add high-dimensional manifolds #10

Open Filco306 opened 4 years ago

Filco306 commented 4 years ago

Hello!

First of all, thank you for a very nice python package! I think high-dimensional manifolds, that is, manifolds beyond 2 and 3 dimensions would be very interesting to add. d-dimensional spheres have already been added, but if somebody knows how generate other types of manifolds of higher dimensions, I would be happy to cooperate and contribute to create this for this package :)

Cheers, Filip

ctralie commented 4 years ago

Yes, I would love to help with this. Uniformly sampling manifolds is tricky, but naively I would start by just doing furthest points sampling to make sure things are even

On Thu, Nov 12, 2020 at 10:44 AM Filip Cornell notifications@github.com wrote:

Hello!

I think high-dimensional manifolds, that is, manifolds beyond 2 and 3 dimensions would be very interesting to add. d-dimensional spheres have already been added, but if somebody knows how generate other types of manifolds of higher dimensions, I would be happy to cooperate and contribute to create this for this package :)

Cheers, Filip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZRI7GVGYMASEY5VJ2LSPP7GXANCNFSM4TTOIQOA .

Filco306 commented 4 years ago

How great to hear! I think #11 is a start, but what other high-dimensional manifolds can we construct?

Filco306 commented 4 years ago

Have a look here. He claims an n-dimensional Torus can simply be built by taking the cartesian of S^1, seen here. Can we use this perhaps?

ctralie commented 4 years ago

Yeah actually, a flat torus is very straightforward that way. Simply use meshgrid and have pairs of dimensions be a different circle, as you said

On Thu, Nov 12, 2020 at 3:39 PM Filip Cornell notifications@github.com wrote:

Have a look here http://planning.cs.uiuc.edu/node137.html. He claims an n-dimensional Torus can simply be built by taking the cartesian of S^1, seen here http://planning.cs.uiuc.edu/node136.html. Can we use this perhaps?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/10#issuecomment-726329332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZS6WHG6L5ICKFRRCWDSPRBY5ANCNFSM4TTOIQOA .

Filco306 commented 4 years ago

Hmm, I am not sure I understand how you mean. Do you perhaps have some sample code?

ctralie commented 4 years ago

For 10,000 samples on a flat 2-torus, for example, one could do this

N = 100 t = np.linspace(0, 2np.pi, N) theta, phi = np.meshgrid(t, t) theta = theta.flatten() phi = phi.flatten() X = np.zeros((NN, 4)) X[:, 0] = np.cos(theta) X[:, 1] = np.sin(theta) X[:, 2] = np.cos(phi) X[:, 3] = np.sin(phi)

On Fri, Nov 13, 2020 at 3:17 AM Filip Cornell notifications@github.com wrote:

Hmm, I am not sure I understand how you mean. Do you perhaps have some sample code?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/10#issuecomment-726595551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZS3A5EO4OZHEL5QWPDSPTTQDANCNFSM4TTOIQOA .

Filco306 commented 3 years ago

Very sorry for such a late reply. That is very interesting, I suppose we can extend that to an arbitrary number of dimensions?

Filco306 commented 3 years ago

Would something like this do as a first draft?

def sample_4d_torus(n_points, seed):
    assert np.sqrt(n_points) % 1 == 0, "Please pick a number of points with integer root. "
    np.random.seed(seed)
    N = int(np.sqrt())
    t = np.random.uniform(0,2*np.pi, N)
    t = np.linspace(0, 2*np.pi, N)
    theta, phi = np.meshgrid(t, t)
    theta = theta.flatten()
    phi = phi.flatten()
    X = np.zeros((N*N, 4))
    X[:, 0] = np.cos(theta)
    X[:, 1] = np.sin(theta)
    X[:, 2] = np.cos(phi)
    X[:, 3] = np.sin(phi)
    return X
ctralie commented 3 years ago

Yeah, for a flat torus in 4D, that should be uniform. Did you mean to say N = int(np.sqrt(n_points)) ?

On Fri, Feb 12, 2021 at 3:50 AM Filip Cornell notifications@github.com wrote:

Would something like this do as a first draft?

def sample_4d_torus(n_points, seed): assert np.sqrt(n_points) % 1 == 0, "Please pick a number of points with integer root. " np.random.seed(seed) N = int(np.sqrt()) t = np.random.uniform(0,2np.pi, N) t = np.linspace(0, 2np.pi, N) theta, phi = np.meshgrid(t, t) theta = theta.flatten() phi = phi.flatten() X = np.zeros((N*N, 4)) X[:, 0] = np.cos(theta) X[:, 1] = np.sin(theta) X[:, 2] = np.cos(phi) X[:, 3] = np.sin(phi) return X

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/10#issuecomment-778063233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZWS7TECUCE7PSM6RDDS6TTVNANCNFSM4TTOIQOA .

Filco306 commented 3 years ago

Oh yes, it should be int(np.sqrt(n_points)). Can we extend this to more than 4 dimensions?

ctralie commented 3 years ago

Yup, you can do this sort of thing in every even dimension at 4 and beyond

On Fri, Feb 12, 2021 at 10:52 AM Filip Cornell notifications@github.com wrote:

Oh yes, it should be int(np.sqrt(n_points)). Can we extend this to more than 4 dimensions?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scikit-tda/tadasets/issues/10#issuecomment-778276227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWDZTS3GMDA5HQRJVGFBTS6VFDHANCNFSM4TTOIQOA .