Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clustering code #6

Closed
karanahujax opened this issue May 30, 2019 · 2 comments
Closed

Clustering code #6

karanahujax opened this issue May 30, 2019 · 2 comments

Comments

@karanahujax
Copy link

Is the code to cluster the motions into the latent space also available?

@ChrisWu1997
Copy link
Owner

Those clusters are made by PCA and t-SNE, and drawn by matplotlib. The code has not been organized for release, but I can put the core code here for temporal usage:

from sklearn.decomposition import PCA
from sklearn.manifold import TSNE

def tsne_on_pca(arr):
    """
    visualize through t-sne on pca reduced data
    :param arr: ndarray, (nr_examples, nr_features)
    :return: ndarray, (nr_examples, 2)
    """
    pca_50 = PCA(n_components=50)
    res = pca_50.fit_transform(arr)
    tsne_2 = TSNE(n_components=2)
    res = tsne_2.fit_transform(res)
    return res

# apply this function on latent vectors

Please let me know if you need further help.

@NicksonYap
Copy link

NicksonYap commented May 24, 2020

Since the docs did not mention clustering:

Code for clustering:
https://github.com/ChrisWu1997/2D-Motion-Retargeting/blob/master/cluster.py

Example for clustering
#20 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants