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

fix: set edge weights for normalized adjacency in sctag #194

Merged
merged 5 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Note: the data split modality of DeepImpute is different from ScGNN and GraphSCI
| scDCC | ARI | 0.82 / 0.81 | 0.98 / N/A | 0.51 / 0.58 | 0.60 / 0.66 |
| scDeepCluster | ARI | 0.81 / 0.78 | 0.98 / 0.97 | 0.51 / 0.52 | 0.56 / 0.58 |
| scDSC | ARI | 0.72 / 0.78 | 0.84 / N/A | 0.46 / 0.65 | 0.65 / 0.72 |
| scTAG | ARI | 0.75 / N/A | 0.96 / N/A | 0.53 / N/A | 0.60 / N/A |
| scTAG | ARI | 0.77 / N/A | 0.96 / N/A | 0.49 / N/A | 0.69 / N/A |

### Multimodality Module

Expand Down
12 changes: 6 additions & 6 deletions dance/modules/single_modality/clustering/sctag.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def init_model(self, adj: np.ndarray, x: np.ndarray):
src_n, dist_n = np.nonzero(adj_n)

self.g = dgl.graph((src, dist)).to(self.device)
# FIX: set edge weight?...
self.g_n = dgl.graph((src_n, dist_n)).to(self.device)
self.g_n.edata["weight"] = torch.FloatTensor(adj_n[src_n, dist_n]).to(self.device)

self.mu = Parameter(torch.Tensor(self.n_clusters, self.latent_dim).to(self.device))
self.encoder1 = TAGConv(self.in_dim, self.hidden_dim, k=self.k)
Expand Down Expand Up @@ -149,13 +149,13 @@ def preprocessing_pipeline(n_top_genes: int = 3000, n_components: int = 50, n_ne
log_level=log_level,
)

def forward(self, adj_in, x_input):
def forward(self, g, x_input):
"""Forward propagation.

Parameters
----------
adj_in
Input adjacency matrix.
g
Input graph.
x_input
Input features.

Expand All @@ -175,8 +175,8 @@ def forward(self, adj_in, x_input):
Data dropout probability from ZINB.

"""
enc_h = self.encoder1(adj_in, x_input)
z = self.encoder2(adj_in, enc_h)
enc_h = self.encoder1(g, x_input, edge_weight=g.edata["weight"])
z = self.encoder2(g, enc_h, edge_weight=g.edata["weight"])
adj_out = self.decoder_adj(z)
_mean, _disp, _pi = self.decoder_x(z)
q = self.soft_assign(z)
Expand Down