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

Port grasp_show_transform from GraSP to thgsp #1

Closed
6 of 7 tasks
bwdeng20 opened this issue Mar 26, 2021 · 0 comments
Closed
6 of 7 tasks

Port grasp_show_transform from GraSP to thgsp #1

bwdeng20 opened this issue Mar 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@bwdeng20
Copy link
Owner

bwdeng20 commented Mar 26, 2021

The function grasp_show_transform by Benjamin Girault and Antonio Ortega is a visualization tool of GFT already implemented in GraSP. This note summarizes the current state of grasp_show_transform implementation provided in thgsp.

  • Embedding Algorithm
    • The eigenvector of Lrw's second smallest eigenvalue
    • Equispaced embbedding
  • Sampling Method: implemented here
  • grasp_show_transform : implemented here
  • Examples: An example with USC toy graph is below.
  • Better consistence between embedding and clustering results
import numpy as np
from scipy.sparse import lil_matrix
from thgsp.datasets import Toy
from thgsp.sampling import ess_sampling
from thgsp.visual import show_transform
g = Toy()[0]
fs, U = g.spectral(lap_type="comb")
bands = np.linspace(fs[0], fs[-1], num=9) 
bands2= np.hstack([bands[:-1, None], bands[1:, None]]) # both two kinds of bands are supported
N, M = U.shape 
print(bands)
print(bands2)
sampled_nodes = ess_sampling(g.L("comb"), g.n_node, k=4)
highlights = lil_matrix((M, N))
highlights[range(M), sampled_nodes] = 1
fig, _, _ = show_transform(g, U.t(), fs, highlights, cluster=2, bands=bands)

# Before showing the figure, you can adjust the figure on many aspects, including but not limited to
# font, text, colors of axes, using APIs provided by `plotly.go.Figure` class.
fig.show()

The interactive figure will be displayed in a browser window, and one can download the static png version like the following one.
newplot (3)

Gaussian-kernel-weighted USCToy Graph with GFT based on normalized Laplacian.

ShowTransGaussianSym

Gaussian-kernel-weighted USCToy Graph with GFT based on combinatorial Laplacian.

ShowTransGaussianComb

@bwdeng20 bwdeng20 added the enhancement New feature or request label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant